Documentation
¶
Overview ¶
tracing 为 routing.Routing API 提供高级方法追踪。 API 的每个方法在 Tracer 上都有对应的方法,返回延迟包装回调或仅延迟回调。
Index ¶
- type Tracer
- func (t Tracer) Bootstrap(routerName string, ctx context.Context) (_ context.Context, end func(error))
- func (t Tracer) FindPeer(routerName string, ctx context.Context, id peer.ID) (_ context.Context, end func(peer.AddrInfo, error))
- func (t Tracer) FindProvidersAsync(routerName string, ctx context.Context, key cid.Cid, count int) (_ context.Context, ...)
- func (t Tracer) GetValue(routerName string, ctx context.Context, key string, opts ...routing.Option) (_ context.Context, end func([]byte, error))
- func (t Tracer) Provide(routerName string, ctx context.Context, key cid.Cid, announce bool) (_ context.Context, end func(error))
- func (t Tracer) ProvideMany(routerName string, ctx context.Context, keys []multihash.Multihash) (_ context.Context, end func(error))
- func (t Tracer) PutValue(routerName string, ctx context.Context, key string, val []byte, ...) (_ context.Context, end func(error))
- func (t Tracer) SearchValue(routerName string, ctx context.Context, key string, opts ...routing.Option) (_ context.Context, ...)
- func (t Tracer) StartSpan(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
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 要查找的内容标识符
- 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 追踪提供者操作 参数:
- routerName: string 路由器名称
- ctx: context.Context 上下文
- key: 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 追踪批量提供者操作 参数:
- routerName: string 路由器名称
- ctx: context.Context 上下文
- keys: []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
Click to show internal directories.
Click to hide internal directories.