transport

package
v0.0.0-...-fb0cfa2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToContext

func ToContext(ctx context.Context, tr ITransport) context.Context

ToContext returns a new Context that carries value.

Types

type BaseTransport

type BaseTransport struct {
	Endpoint  string
	Operation string
	InHeader  header.IHeader
	OutHeader header.IHeader
}

func (*BaseTransport) GetEndpoint

func (tr *BaseTransport) GetEndpoint() string

func (*BaseTransport) GetInHeader

func (tr *BaseTransport) GetInHeader() header.IHeader

func (*BaseTransport) GetOperation

func (tr *BaseTransport) GetOperation() string

func (*BaseTransport) GetOutHeader

func (tr *BaseTransport) GetOutHeader() header.IHeader

type ITransport

type ITransport interface {
	GetKind() Kind
	// GetEndpoint return server or client endpoint
	// Server Transport: grpc://127.0.0.1:9000
	// Client Transport: discovery:///provider-demo
	GetEndpoint() string
	// GetOperation Service full method selector generated by protobuf
	// example: /helloworld.Greeter/SayHello
	GetOperation() string
	// GetInHeader return transport request header
	// http: http.Header
	// grpc: metadata.MD
	GetInHeader() header.IHeader
	// GetOutHeader return transport reply/response header
	// only valid for server transport
	// http: http.Header
	// grpc: metadata.MD
	GetOutHeader() header.IHeader
}

ITransport is transport context value interface.

func FromContext

func FromContext(ctx context.Context) (tr ITransport, ok bool)

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

type Kind

type Kind uint8
const (
	KindGRPC Kind = 1
	KindHTTP Kind = 2
)

Defines a set of transport Type

func (Kind) String

func (k Kind) String() string

type Server

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

Directories

Path Synopsis
coder/proto
Package proto defines the protobuf Coder.
Package proto defines the protobuf Coder.

Jump to

Keyboard shortcuts

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