metadata

package
v0.0.0-...-3cc3ff2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package metadata allows for the definition of metadata such as headers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(ctx context.Context, key string) (string, bool)

Get returns a single value from metadata in the context

func MergeContext

func MergeContext(ctx context.Context, patchMd MD, overwrite bool) context.Context

MergeContext merges metadata to existing metadata, overwriting if specified

func NewContext

func NewContext(ctx context.Context, md MD) context.Context

NewContext creates a new context with the given metadata

Types

type MD

type MD map[string]string

MD is our way of representing request headers internally. They're used at the RPC level and translate back and forth from Transport headers.

func Copy

func Copy(md MD) MD

Copy makes a copy of the metadata

func FromContext

func FromContext(ctx context.Context) (MD, bool)

FromContext returns metadata from the given context

func (MD) Append

func (md MD) Append(append MD)

Append appends the given md

type Manager

type Manager struct {
	Context  *broker.Context
	Resource string
	Params   specs.Header
	Keys     map[string]struct{}
}

Manager represents a metadata manager for a given resource

func NewManager

func NewManager(ctx *broker.Context, resource string, params specs.Header) *Manager

NewManager constructs a new metadata manager for the given resource.

func (*Manager) Marshal

func (manager *Manager) Marshal(store references.Store) MD

Marshal attempts to marshal the given metadata specs from the given refs store

func (*Manager) Unmarshal

func (manager *Manager) Unmarshal(metadata MD, store references.Store)

Unmarshal unmarshals the given transport metadata into the given reference store

Jump to

Keyboard shortcuts

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