Documentation
¶
Index ¶
- func Value[K comparable, V any](c IContext, key K) (V, bool)
- type BaseCtx
- func (c *BaseCtx[TraceData, TP]) Deadline() (deadline time.Time, ok bool)
- func (c *BaseCtx[TraceData, TP]) Debug() *logger.Event
- func (c *BaseCtx[TraceData, TP]) Disabled() *logger.Event
- func (c *BaseCtx[TraceData, TP]) Done() <-chan struct{}
- func (c *BaseCtx[TraceData, TP]) Err() error
- func (c *BaseCtx[TraceData, TP]) Error() *logger.Event
- func (c *BaseCtx[TraceData, TP]) Fatal() *logger.Event
- func (c *BaseCtx[TraceData, TP]) GetTrace() Trace
- func (c *BaseCtx[TraceData, TP]) Info() *logger.Event
- func (c *BaseCtx[TraceData, TP]) NoLevel() *logger.Event
- func (c *BaseCtx[TraceData, TP]) Panic() *logger.Event
- func (c *BaseCtx[TraceData, TP]) Reset()
- func (c *BaseCtx[TraceData, TP]) SetValue(key any, value any)
- func (c *BaseCtx[TraceData, TP]) Trace() *logger.Event
- func (c *BaseCtx[TraceData, TP]) Value(key any) any
- func (c *BaseCtx[TraceData, TP]) Warn() *logger.Event
- func (c *BaseCtx[TraceData, TP]) WithLevel(level logger.Level) *logger.Event
- 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(e *logger.Event) *logger.Event
- 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(e *logger.Event) *logger.Event
- 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 TracePtr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BaseCtx ¶ added in v0.1.0
type BaseCtx[TraceData any, TP TracePtr[TraceData]] struct { Context context.Context Req proto.Message Resp []proto.Message // for rpc reply NatsMsg *nats.Msg TD TraceData }
BaseCtx is a context with a trace data, trace data can be roleID,or roleInfo, or other
func NewBaseCtx ¶ added in v0.1.4
NewBaseCtx create a new BaseCtx
func NewBaseCtxWithTrace ¶ added in v0.1.4
func NewBaseCtxWithTrace[TraceData any, TP TracePtr[TraceData]](traceData TraceData) *BaseCtx[TraceData, TP]
NewBaseCtxWithTrace create a new BaseCtx
func (*BaseCtx[TraceData, TP]) Done ¶ added in v0.1.0
func (c *BaseCtx[TraceData, TP]) Done() <-chan struct{}
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
// contains filtered or unexported fields
}
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(e *logger.Event) *logger.Event
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 = BaseCtx[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.Event) *logger.Event
GetServerIdAndType() (int64, string)
SetServerIdAndType(int64, string)
Reset()
}
Click to show internal directories.
Click to hide internal directories.