tracing

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

tracing 为 routing.Routing API 提供高级方法追踪。 API 的每个方法在 Tracer 上都有对应的方法,返回延迟包装回调或仅延迟回调。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tracer

type Tracer string

Tracer 是将传递给 otel.Tracer 的库名。

func (Tracer) Bootstrap

func (t Tracer) Bootstrap(routerName string, ctx context.Context) (_ context.Context, end func(error))

Bootstrap 引导 参数:

  • routerName: string 路由器名称
  • ctx: context.Context 上下文

返回值:

  • context.Context 新的上下文
  • func(error) 结束回调函数

func (Tracer) FindPeer

func (t Tracer) FindPeer(routerName string, ctx context.Context, id peer.ID) (_ context.Context, end func(peer.AddrInfo, error))

FindPeer 查找对等点 参数:

  • routerName: string 路由器名称
  • ctx: context.Context 上下文
  • id: peer.ID 要查找的对等点 ID

返回值:

  • context.Context 新的上下文
  • func(peer.AddrInfo, error) 结束回调函数

func (Tracer) FindProvidersAsync

func (t Tracer) FindProvidersAsync(routerName string, ctx context.Context, key cid.Cid, count int) (_ context.Context, passthrough func(<-chan peer.AddrInfo, error) <-chan peer.AddrInfo)

FindProvidersAsync 异步查找提供者 参数:

  • routerName: string 路由器名称
  • ctx: context.Context 上下文
  • key: cid.Cid 要查找的 CID
  • count: int 最大返回数量

返回值:

  • context.Context 新的上下文
  • func(<-chan peer.AddrInfo, error) <-chan peer.AddrInfo 处理函数

func (Tracer) GetValue

func (t Tracer) GetValue(routerName string, ctx context.Context, key string, opts ...routing.Option) (_ context.Context, end func([]byte, error))

GetValue 获取值 参数:

  • routerName: string 路由器名称
  • ctx: context.Context 上下文
  • key: string 键
  • opts: ...routing.Option 选项

返回值:

  • context.Context 新的上下文
  • func([]byte, error) 结束回调函数

func (Tracer) Provide

func (t Tracer) Provide(routerName string, ctx context.Context, key cid.Cid, announce bool) (_ context.Context, end func(error))

Provide 提供一个 CID 参数:

  • routerName: string 路由器名称
  • ctx: context.Context 上下文
  • key: cid.Cid 要提供的 CID
  • announce: bool 是否公告

返回值:

  • context.Context 新的上下文
  • func(error) 结束回调函数

func (Tracer) ProvideMany

func (t Tracer) ProvideMany(routerName string, ctx context.Context, keys []multihash.Multihash) (_ context.Context, end func(error))

ProvideMany 提供多个 Multihash 参数:

  • routerName: string 路由器名称
  • ctx: context.Context 上下文
  • keys: []multihash.Multihash 要提供的 Multihash 列表

返回值:

  • context.Context 新的上下文
  • func(error) 结束回调函数

func (Tracer) PutValue

func (t Tracer) PutValue(routerName string, ctx context.Context, key string, val []byte, opts ...routing.Option) (_ context.Context, end func(error))

PutValue 存储值 参数:

  • routerName: string 路由器名称
  • ctx: context.Context 上下文
  • key: string 键
  • val: []byte 值
  • opts: ...routing.Option 选项

返回值:

  • context.Context 新的上下文
  • func(error) 结束回调函数

func (Tracer) SearchValue

func (t Tracer) SearchValue(routerName string, ctx context.Context, key string, opts ...routing.Option) (_ context.Context, passthrough func(<-chan []byte, error) (<-chan []byte, error))

SearchValue 搜索值 参数:

  • routerName: string 路由器名称
  • ctx: context.Context 上下文
  • key: string 键
  • opts: ...routing.Option 选项

返回值:

  • context.Context 新的上下文
  • func(<-chan []byte, error) (<-chan []byte, error) 处理函数

func (Tracer) StartSpan

func (t Tracer) StartSpan(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)

StartSpan 启动一个新的追踪 span 参数:

  • ctx: context.Context 上下文
  • name: string span 名称
  • opts: ...trace.SpanStartOption span 选项

返回值:

  • context.Context 新的上下文
  • trace.Span 新的 span

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL