transport

package
v2.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: MIT Imports: 7 Imported by: 468

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Metadata

func Metadata(ctx context.Context) metadata.Metadata

Metadata returns incoming metadata from server transport.

func Method

func Method(ctx context.Context) string

Method returns the Transport method from server context.

func NewClientContext

func NewClientContext(ctx context.Context, tr Transporter) context.Context

NewClientContext returns a new Context that carries value.

func NewServerContext

func NewServerContext(ctx context.Context, tr Transporter) context.Context

NewServerContext returns a new Context that carries value.

func SetMetadata

func SetMetadata(ctx context.Context, md metadata.Metadata)

SetMetadata sets outgoing metadata into client transport.

func SetMethod

func SetMethod(ctx context.Context, method string)

SetMethod set serviceMethod into context transport.

Types

type Endpointer

type Endpointer interface {
	Endpoint() (*url.URL, error)
}

Endpointer is registry endpoint.

type Server

type Server interface {
	Start(context.Context) error
	Stop(context.Context) error
}

Server is transport server.

type Transporter

type Transporter interface {
	Kind() string
	Endpoint() string

	Method() string
	SetMethod(string)

	Metadata() metadata.Metadata
	// WithMetadata merge new metadata into transport,
	// it will override old metadata key value if key exists
	WithMetadata(metadata.Metadata)
}

Transporter is transport context value interface.

func FromClientContext

func FromClientContext(ctx context.Context) (tr Transporter, ok bool)

FromClientContext returns the Transport value stored in ctx, if any.

func FromServerContext

func FromServerContext(ctx context.Context) (tr Transporter, ok bool)

FromServerContext returns the Transport value stored in ctx, if any.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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