metadata

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CtxHeader          = CtxKey("header")
	CtxRetries         = CtxKey("retries")
	CtxOrigin          = CtxKey("origin")
	CtxParentTimestamp = CtxKey("parent-timestamp")
	CtxParentID        = CtxKey("parent-id")
)

Available context key types

View Source
const (
	// HeaderValueDevider represents the UTF-8 value that is used to devide values
	HeaderValueDevider = ";"
)

Variables

This section is empty.

Functions

func AppendToHeaderContext

func AppendToHeaderContext(ctx context.Context, kv Header) context.Context

AppendToHeaderContext returns a new context with the provided Header merged with any existing metadata in the context.

func NewHeaderContext

func NewHeaderContext(ctx context.Context, header Header) context.Context

NewHeaderContext creates a new context with Header attached. If used in conjunction with AppendToHeaderContext, NewHeaderContext will overwrite any previously-appended types.

func NewParentIDContext

func NewParentIDContext(ctx context.Context, id ParentID) context.Context

NewParentIDContext creates a new context with ParentID attached. If used NewParentIDContext will overwrite any previously-appended

func NewParentTimestampContext

func NewParentTimestampContext(ctx context.Context, timestamp ParentTimestamp) context.Context

NewParentTimestampContext creates a new context with ParentTimestamp attached. If used NewParentTimestampContext will overwrite any previously-appended

func NewRetriesContext

func NewRetriesContext(ctx context.Context, retries Header) context.Context

NewRetriesContext creates a new context with Retries attached. If used NewRetriesContext will overwrite any previously-appended

Types

type CtxKey

type CtxKey string

CtxKey type

func (CtxKey) String

func (k CtxKey) String() string
type Header map[string]HeaderValue

Header is a mapping from metadata keys to values.

func HeaderFromContext

func HeaderFromContext(ctx context.Context) (header Header, ok bool)

HeaderFromContext returns the Header in ctx if it exists. The returned Header should not be modified. Writing to it may cause races. Modification should be made to copies of the returned Header.

func RetriesFromContext

func RetriesFromContext(ctx context.Context) (retries Header, ok bool)

RetriesFromContext returns the Retries in ctx if it exists. The returned Retries should not be modified. Writing to it may cause races. Modification should be made to copies of the returned Header.

type HeaderValue

type HeaderValue []string

HeaderValue a slice of header values

func (HeaderValue) String

func (h HeaderValue) String() string

String returns the header values seperated by a ";"

type Key

type Key []byte

Key representation of message key

type ParentID

type ParentID string

ParentID parent message id

func ParentIDFromContext

func ParentIDFromContext(ctx context.Context) (id ParentID, ok bool)

ParentIDFromContext returns the ParentID in ctx if it exists. The returned ParentID should not be modified. Writing to it may cause races. Modification should be made to copies of the returned Header.

type ParentTimestamp

type ParentTimestamp time.Time

ParentTimestamp parent message creation time

func ParentTimestampFromContext

func ParentTimestampFromContext(ctx context.Context) (timestamp ParentTimestamp, ok bool)

ParentTimestampFromContext returns the ParentTimestamp in ctx if it exists. The returned ParentTimestamp should not be modified. Writing to it may cause races. Modification should be made to copies of the returned Header.

type Retries

type Retries int32

Retries representation of the ammount of attempted retries

Jump to

Keyboard shortcuts

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