utils

package
v0.31.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAttributeHeaderPrefix = "X-Attribute-"
)

Variables

This section is empty.

Functions

func BackwardTransformIfSystem

func BackwardTransformIfSystem(key string) string

func GetContextFromRequest added in v0.28.0

func GetContextFromRequest(c *fasthttp.RequestCtx) context.Context

GetContextFromRequest returns main context from fasthttp request context.

func GetReqLog added in v0.31.0

func GetReqLog(ctx context.Context) *zap.Logger

GetReqLog returns log if set. If zap.Logger isn't set returns nil.

func GetReqLogOrDefault added in v0.31.0

func GetReqLogOrDefault(ctx context.Context, defaultLog *zap.Logger) *zap.Logger

GetReqLogOrDefault returns log from context, if it exists. If the log is missing from the context, the default logger is returned.

func PrepareExpirationHeader

func PrepareExpirationHeader(ctx context.Context, epochFetcher EpochInfoFetcher, headers map[string]string, now time.Time) error

func SetContextToRequest added in v0.28.0

func SetContextToRequest(ctx context.Context, c *fasthttp.RequestCtx)

SetContextToRequest adds new context to fasthttp request.

func SetHTTPTraceInfo added in v0.28.0

func SetHTTPTraceInfo(ctx context.Context, span trace.Span, req *fasthttp.RequestCtx)

SetHTTPTraceInfo saves trace headers to response.

func SetReqLog added in v0.31.0

func SetReqLog(ctx context.Context, log *zap.Logger) context.Context

SetReqLog sets child zap.Logger in the context.

func StartHTTPServerSpan added in v0.28.0

func StartHTTPServerSpan(ctx context.Context, req *fasthttp.RequestCtx, operationName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)

StartHTTPServerSpan starts root HTTP server span.

func TransformIfSystem

func TransformIfSystem(key []byte) []byte

Types

type EpochDurations

type EpochDurations struct {
	CurrentEpoch  uint64
	MsPerBlock    int64
	BlockPerEpoch uint64
}

type EpochInfoFetcher added in v0.30.0

type EpochInfoFetcher interface {
	GetEpochDurations(context.Context) (*EpochDurations, error)
}

Jump to

Keyboard shortcuts

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