Documentation ¶
Index ¶
- Constants
- Variables
- func GetOpencensusSpanContextFromContext(ctx context.Context) (*trace.SpanContext, error)
- func GetSpanContextFromContext(ctx context.Context) (opentracing.SpanContext, error)
- func RegisterCodec(t protocol.SerializeType, c codec.Codec)
- type Context
- type ContextKey
- type DownloadFileArgs
- type FileTransferArgs
- type FileTransferReply
- type StreamServiceArgs
- type StreamServiceReply
Constants ¶
const ( // DefaultRPCPath is used by ServeHTTP. DefaultRPCPath = "/_rpcx_" // AuthKey is used in metadata. AuthKey = "__AUTH" // ServerAddress is used to get address of the server by client ServerAddress = "__ServerAddress" // ServerTimeout timeout value passed from client to control timeout of server ServerTimeout = "__ServerTimeout" // OpentracingSpanServerKey key in service context OpentracingSpanServerKey = "opentracing_span_server_key" // OpentracingSpanClientKey key in client context OpentracingSpanClientKey = "opentracing_span_client_key" // OpencensusSpanServerKey key in service context OpencensusSpanServerKey = "opencensus_span_server_key" // OpencensusSpanClientKey key in client context OpencensusSpanClientKey = "opencensus_span_client_key" // OpencensusSpanRequestKey span key in request meta OpencensusSpanRequestKey = "opencensus_span_request_key" // SendFileServiceName is name of the file transfer service. SendFileServiceName = "_filetransfer" // StreamServiceName is name of the stream service. StreamServiceName = "_streamservice" )
Variables ¶
var Codecs = map[protocol.SerializeType]codec.Codec{ protocol.SerializeNone: &codec.ByteCodec{}, protocol.JSON: &codec.JSONCodec{}, }
Codecs are codecs supported by rpcx. You can add customized codecs in Codecs.
var ReqMetaDataKey = ContextKey("__req_metadata")
ReqMetaDataKey is used to set metatdata in context of requests.
var ResMetaDataKey = ContextKey("__res_metadata")
ResMetaDataKey is used to set metatdata in context of responses.
var Trace bool
Trace is a flag to write a trace log or not. You should not enable this flag ofr product environment and enable it only for test. It writes trace log with logger Debug level.
Functions ¶
func GetOpencensusSpanContextFromContext ¶
func GetOpencensusSpanContextFromContext(ctx context.Context) (*trace.SpanContext, error)
GetOpencensusSpanContextFromContext get opencensus.trace.SpanContext from context.Context.
func GetSpanContextFromContext ¶
func GetSpanContextFromContext(ctx context.Context) (opentracing.SpanContext, error)
GetSpanContextFromContext get opentracing.SpanContext from context.Context.
func RegisterCodec ¶
func RegisterCodec(t protocol.SerializeType, c codec.Codec)
RegisterCodec register customized codec.
Types ¶
type Context ¶
Context is a rpcx customized Context that can contains multiple values.
func NewContext ¶
func WithLocalValue ¶
type DownloadFileArgs ¶
type DownloadFileArgs struct { FileName string `json:"file_name,omitempty"` Meta map[string]string `json:"meta,omitempty"` }
DownloadFileArgs args from clients.
type FileTransferArgs ¶
type FileTransferArgs struct { FileName string `json:"file_name,omitempty"` FileSize int64 `json:"file_size,omitempty"` Meta map[string]string `json:"meta,omitempty"` }
FileTransferArgs args from clients.
type FileTransferReply ¶
type FileTransferReply struct { Token []byte `json:"token,omitempty"` Addr string `json:"addr,omitempty"` }
FileTransferReply response to token and addr to clients.
type StreamServiceArgs ¶
StreamServiceArgs is the request type for stream service.
type StreamServiceReply ¶
type StreamServiceReply struct { Token []byte `json:"token,omitempty"` Addr string `json:"addr,omitempty"` }
StreamServiceReply is the reply type for stream service.