rpcx: github.com/smallnest/rpcx/share Index | Files

package share

import "github.com/smallnest/rpcx/share"


Package Files

context.go share.go


const (
    // DefaultRPCPath is used by ServeHTTP.
    DefaultRPCPath = "/_rpcx_"

    // AuthKey is used in metadata.
    AuthKey = "__AUTH"

    // 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 file transfer service.
    SendFileServiceName = "_filetransfer"


var (
    // Codecs are codecs supported by rpcx. You can add customized codecs in Codecs.
    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{},
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.

func GetOpencensusSpanContextFromContext Uses

func GetOpencensusSpanContextFromContext(ctx context.Context) (*trace.SpanContext, error)

GetOpencensusSpanContextFromContext get opencensus.trace.SpanContext from context.Context.

func GetSpanContextFromContext Uses

func GetSpanContextFromContext(ctx context.Context) (opentracing.SpanContext, error)

GetSpanContextFromContext get opentracing.SpanContext from context.Context.

func RegisterCodec Uses

func RegisterCodec(t protocol.SerializeType, c codec.Codec)

RegisterCodec register customized codec.

type Context Uses

type Context struct {
    // contains filtered or unexported fields

Context is a rpcx customized Context that can contains multiple values.

func NewContext Uses

func NewContext(ctx context.Context) *Context

func WithLocalValue Uses

func WithLocalValue(ctx *Context, key, val interface{}) *Context

func WithValue Uses

func WithValue(parent context.Context, key, val interface{}) *Context

func (*Context) SetValue Uses

func (c *Context) SetValue(key, val interface{})

func (*Context) String Uses

func (c *Context) String() string

func (*Context) Value Uses

func (c *Context) Value(key interface{}) interface{}

type ContextKey Uses

type ContextKey string

ContextKey defines key type in context.

type DownloadFileArgs Uses

type DownloadFileArgs struct {
    FileName string `json:"file_name,omitempty"`

DownloadFileArgs args from clients.

type FileTransferArgs Uses

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 Uses

type FileTransferReply struct {
    Token []byte `json:"token,omitempty"`
    Addr  string `json:"addr,omitempty"`

FileTransferReply response to token and addr to clients.

Package share imports 8 packages (graph) and is imported by 28 packages. Updated 2021-01-04. Refresh now. Tools for package owners.