Documentation ¶
Overview ¶
Package metadata is a way of defining message headers
Package metadata is a way of defining message headers
Index ¶
- Variables
- func AppendIncomingContext(ctx context.Context, kv ...string) context.Context
- func AppendOutgoingContext(ctx context.Context, kv ...string) context.Context
- func NewContext(ctx context.Context, md Metadata) context.Contextdeprecated
- func NewIncomingContext(ctx context.Context, md Metadata) context.Context
- func NewOutgoingContext(ctx context.Context, md Metadata) context.Context
- func SetIncomingContext(ctx context.Context, md Metadata) bool
- func SetOutgoingContext(ctx context.Context, md Metadata) bool
- type Iterator
- type Metadata
- func Copy(md Metadata) Metadata
- func FromContext(ctx context.Context) (Metadata, bool)deprecated
- func FromIncomingContext(ctx context.Context) (Metadata, bool)
- func FromOutgoingContext(ctx context.Context) (Metadata, bool)
- func Merge(omd Metadata, mmd Metadata, overwrite bool) Metadata
- func New(size int) Metadata
- func Pairs(kv ...string) (Metadata, bool)
Constants ¶
This section is empty.
Variables ¶
var ( // HeaderTopic is the header name that contains topic name HeaderTopic = "Micro-Topic" // HeaderContentType specifies content type of message HeaderContentType = "Content-Type" // HeaderEndpoint specifies endpoint in service HeaderEndpoint = "Micro-Endpoint" // HeaderService specifies service HeaderService = "Micro-Service" // HeaderTimeout specifies timeout of operation HeaderTimeout = "Micro-Timeout" // HeaderAuthorization specifies Authorization header HeaderAuthorization = "Authorization" )
Functions ¶
func AppendIncomingContext ¶
AppendIncomingContext apends new md to context
func AppendOutgoingContext ¶
AppendOutgoingContext apends new md to context
func NewIncomingContext ¶
NewIncomingContext creates a new context with incoming metadata attached
func NewOutgoingContext ¶
NewOutgoingContext creates a new context with outcoming metadata attached
func SetIncomingContext ¶
SetIncomingContext modify incoming context with given metadata
Types ¶
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator used to iterate over metadata with order
type Metadata ¶
Metadata is our way of representing request headers internally. They're used at the RPC level and translate back and forth from Transport headers.
func FromContext
deprecated
func FromIncomingContext ¶
FromIncomingContext returns metadata from incoming ctx returned metadata shoud not be modified or race condition happens
func FromOutgoingContext ¶
FromOutgoingContext returns metadata from outgoing ctx returned metadata shoud not be modified or race condition happens