Documentation ¶
Index ¶
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" // SendFileServiceName is name of the file transfer service. SendFileServiceName = "_filetransfer" // StreamServiceName is name of the stream service. StreamServiceName = "_streamservice" // ContextTagsLock is name of the Context TagsLock. ContextTagsLock = "_tagsLock" )
Variables ¶
var Codecs = map[protocol.SerializeType]codec.Codec{ protocol.SerializeNone: &codec.ByteCodec{}, protocol.JSON: &codec.JSONCodec{}, protocol.ProtoBuffer: &codec.PBCodec{}, protocol.MsgPack: &codec.MsgpackCodec{}, protocol.Thrift: &codec.ThriftCodec{}, }
Codecs are codecs supported by rpcx. You can add customized codecs in Codecs.
var ReqMetaDataKey = ContextKey("__req_metadata")
ReqMetaDataKey is used to set metadata in context of requests.
var ResMetaDataKey = ContextKey("__res_metadata")
ResMetaDataKey is used to set metadata in context of responses.
var Trace bool
Trace is a flag to write a trace log or not. You should not enable this flag for product environment and enable it only for test. It writes trace log with logger Debug level.
Functions ¶
func IsShareContext ¶ added in v1.7.5
IsShareContext checks whether a context is share.Context.
func RegisterCodec ¶
func RegisterCodec(t protocol.SerializeType, c codec.Codec)
RegisterCodec register customized codec.
Types ¶
type Context ¶ added in v1.4.1
Context is a rpcx customized Context that can contains multiple values.
func NewContext ¶ added in v1.4.1
func WithLocalValue ¶ added in v1.4.1
type DownloadFileArgs ¶ added in v1.6.2
type DownloadFileArgs struct { FileName string `json:"file_name,omitempty"` Meta map[string]string `json:"meta,omitempty"` }
DownloadFileArgs args from clients.
func (DownloadFileArgs) Clone ¶ added in v1.7.10
func (args DownloadFileArgs) Clone() *DownloadFileArgs
Clone clones this DownloadFileArgs.
type FileTransferArgs ¶ added in v1.6.2
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.
func (FileTransferArgs) Clone ¶ added in v1.7.10
func (args FileTransferArgs) Clone() *FileTransferArgs
Clone clones this DownloadFileArgs.
type FileTransferReply ¶ added in v1.6.2
type FileTransferReply struct { Token []byte `json:"token,omitempty"` Addr string `json:"addr,omitempty"` }
FileTransferReply response to token and addr to clients.
type StreamServiceArgs ¶ added in v1.6.2
StreamServiceArgs is the request type for stream service.
type StreamServiceReply ¶ added in v1.6.2
type StreamServiceReply struct { Token []byte `json:"token,omitempty"` Addr string `json:"addr,omitempty"` }
StreamServiceReply is the reply type for stream service.