Documentation
¶
Overview ¶
Package transport is an interface for synchronous connection based communication
Index ¶
- Constants
- func ContextDelete(ctx context.Context, k string) context.Context
- func ContextGet(ctx context.Context, key string) (string, bool)
- func ContextSet(ctx context.Context, k, v string) context.Context
- func CopyFromContext(ctx context.Context) map[string]string
- func MergeContext(ctx context.Context, patchMd Metadata, overwrite bool) context.Context
- func NewContext(ctx context.Context, md Metadata) context.Context
- type Client
- type Conn
- type Message
- type Metadata
- type Pool
- type Socket
- type Transport
Constants ¶
const ( // Topic call/stream Topic = "Micro-Topic" // Service call/stream Service = "Micro-Service" // Error header contains an error message. Error = "Micro-Error" // Endpoint header. Endpoint = "Micro-Endpoint" // Method header. Method = "Micro-Method" // ID header. ID = "Micro-ID" // Prefix used to prefix headers. Prefix = "Micro-" // Namespace header. Namespace = "Micro-Namespace" // Protocol header. Protocol = "Micro-Protocol" // Target header. Target = "Micro-Target" // SpanID header. SpanID = "Micro-Span-ID" // TraceIDKey header. TraceIDKey = "Micro-Trace-ID" // Stream header. Stream = "Micro-Stream" )
const (
DefaultDialTimeout = time.Second * 3
)
Variables ¶
This section is empty.
Functions ¶
func ContextDelete ¶
ContextDelete key from metadata.
func ContextGet ¶
ContextGet returns a single value from metadata in the context.
func ContextSet ¶
ContextSet add key with val to metadata.
func MergeContext ¶
MergeContext merges metadata to existing metadata, overwriting if specified.
Types ¶
type Message ¶
type Message struct { Header map[string]string `msgpack:"headers,omitempty"` Query url.Values `msgpack:"query,omitempty"` Body []byte `msgpack:"body,omitempty"` }
Message is a broker message.
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 ¶
FromContext returns metadata from the given context.
func MetadataCopy ¶
MetadataCopy makes a copy of the metadata.
type Transport ¶
type Transport interface { Dial(addr string, timeout time.Duration, stream bool) (Client, error) String() string }
Transport is an interface which is used for communication between services. It uses connection based socket send/recv semantics and has various implementations; http, grpc, quic.