Documentation
¶
Index ¶
- func Value[K comparable, V any](c IContext, key K) (V, bool)
- type BaseContext
- func (c *BaseContext) Deadline() (deadline time.Time, ok bool)
- func (c *BaseContext) Done() <-chan struct{}
- func (c *BaseContext) Err() error
- func (c *BaseContext) GetTrace() Trace
- func (c *BaseContext) MustBaseContext() *BaseContext
- func (c *BaseContext) Reset()
- func (c *BaseContext) SetValue(key any, value any)
- func (c *BaseContext) Value(key any) any
- type IContext
- type IContextPtr
- type Int64TraceCtx
- type IntTrace
- func (i *IntTrace) GetServerIdAndType() (int64, string)
- func (i *IntTrace) SetServerIdAndType(serverId int64, serverType string)
- func (i *IntTrace) ToHash() uint64
- func (i *IntTrace) TraceLogField(zc logger.Context) logger.Context
- func (i *IntTrace) TraceMarshalAppend(b []byte) ([]byte, error)
- func (i *IntTrace) TraceMarshalFrom(b []byte) error
- func (i *IntTrace) TraceMarshalSize() int
- type RoleIdType
- type StringTrace
- func (i *StringTrace) GetServerIdAndType() (int64, string)
- func (i *StringTrace) Reset()
- func (i *StringTrace) SetServerIdAndType(serverId int64, serverType string)
- func (i *StringTrace) ToHash() uint64
- func (i *StringTrace) TraceLogField(zc logger.Context) logger.Context
- func (i *StringTrace) TraceMarshalAppend(b []byte) ([]byte, error)
- func (i *StringTrace) TraceMarshalFrom(b []byte) error
- func (i *StringTrace) TraceMarshalSize() int
- type StringTraceCtx
- type ToHash
- type Trace
- type TraceCtx
- type TracePtr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BaseContext ¶
type BaseContext struct { Context context.Context TraceLog logger.Logger Req proto.Message Resp []proto.Message // for rpc reply NatsMsg *nats.Msg }
func (*BaseContext) Done ¶
func (c *BaseContext) Done() <-chan struct{}
func (*BaseContext) Err ¶
func (c *BaseContext) Err() error
func (*BaseContext) GetTrace ¶
func (c *BaseContext) GetTrace() Trace
func (*BaseContext) MustBaseContext ¶
func (c *BaseContext) MustBaseContext() *BaseContext
func (*BaseContext) Reset ¶
func (c *BaseContext) Reset()
func (*BaseContext) SetValue ¶
func (c *BaseContext) SetValue(key any, value any)
func (*BaseContext) Value ¶
func (c *BaseContext) Value(key any) any
type IContextPtr ¶
type Int64TraceCtx ¶
type IntTrace ¶
func (*IntTrace) GetServerIdAndType ¶
func (*IntTrace) SetServerIdAndType ¶
func (*IntTrace) TraceMarshalAppend ¶
func (*IntTrace) TraceMarshalFrom ¶
func (*IntTrace) TraceMarshalSize ¶
type RoleIdType ¶
type StringTrace ¶
type StringTrace struct {
basepb.StringTrace
}
func (*StringTrace) GetServerIdAndType ¶
func (i *StringTrace) GetServerIdAndType() (int64, string)
func (*StringTrace) Reset ¶
func (i *StringTrace) Reset()
func (*StringTrace) SetServerIdAndType ¶
func (i *StringTrace) SetServerIdAndType(serverId int64, serverType string)
func (*StringTrace) ToHash ¶
func (i *StringTrace) ToHash() uint64
func (*StringTrace) TraceLogField ¶
func (i *StringTrace) TraceLogField(zc logger.Context) logger.Context
func (*StringTrace) TraceMarshalAppend ¶
func (i *StringTrace) TraceMarshalAppend(b []byte) ([]byte, error)
func (*StringTrace) TraceMarshalFrom ¶
func (i *StringTrace) TraceMarshalFrom(b []byte) error
func (*StringTrace) TraceMarshalSize ¶
func (i *StringTrace) TraceMarshalSize() int
type StringTraceCtx ¶
type StringTraceCtx = TraceCtx[StringTrace, *StringTrace]
type ToHash ¶
type ToHash interface { // ToHash return a hash value for cluster router msg // uint64 is the hash value // one hash one goroutine if bool is true ToHash() uint64 }
type Trace ¶
type Trace interface { ToHash() uint64 TraceMarshalSize() int // TraceMarshalAppend marshal the object to byte slice TraceMarshalAppend([]byte) ([]byte, error) // TraceMarshalFrom unmarshal the object from byte slice TraceMarshalFrom([]byte) error TraceLogField(logger.Context) logger.Context GetServerIdAndType() (int64, string) SetServerIdAndType(int64, string) Reset() }
type TraceCtx ¶
type TraceCtx[TraceData any, TP TracePtr[TraceData]] struct { BaseContext TD TraceData }
TraceCtx is a context with a trace data, trace data can be roleID,or roleInfo, or other
func NewMarkCtx ¶
NewMarkCtx create a new TraceCtx
func NewMarkCtxWithMark ¶
func NewMarkCtxWithMark[TraceData any, TP TracePtr[TraceData]](traceData TraceData) *TraceCtx[TraceData, TP]
NewMarkCtxWithMark create a new TraceCtx
Click to show internal directories.
Click to hide internal directories.