Documentation ¶
Index ¶
- Constants
- func BoundedReceive(stream io.Reader, rr VTMarshaler, max uint32) error
- func DeserializeContextHeader(ctx context.Context, r http.Header) (context.Context, bool)
- func DisablePooling(baseCtx context.Context) context.Context
- func DynamicTunnelClient(baseContext context.Context, tunnelTransport transport.Transport) protocol.TunnelService
- func ExtractContext(base http.Handler) http.Handler
- func GetContext(ctx context.Context) *protocol.Context
- func GetDelegation(ctx context.Context) *transport.StreamDelegate
- func GetErrorMeta(err twirp.Error) (cause, kv string)
- func GetNode(ctx context.Context) *protocol.Node
- func Receive(stream io.Reader, rr VTMarshaler) error
- func Send(stream io.Writer, rr VTMarshaler) error
- func SerializeContextHeader(ctx context.Context, r http.Header)
- func WithContext(ctx context.Context, rpcCtx *protocol.Context) context.Context
- func WithDelegation(ctx context.Context, delegate *transport.StreamDelegate) context.Context
- func WithNode(ctx context.Context, node *protocol.Node) context.Context
- func WrapError(err error) error
- func WrapErrorKV(key string, err error) error
- type ChordClient
- type VTMarshaler
Constants ¶
const (
HeaderRPCContext = "x-rpc-context"
)
const (
// uint32
LengthSize = 4
)
Variables ¶
This section is empty.
Functions ¶
func BoundedReceive ¶
func BoundedReceive(stream io.Reader, rr VTMarshaler, max uint32) error
func DeserializeContextHeader ¶
Deserialize RPC context from http headers. The RPC context can be retrieved with GetContext()
func DisablePooling ¶
Disable HTTP client pool for this client
func DynamicTunnelClient ¶
func DynamicTunnelClient(baseContext context.Context, tunnelTransport transport.Transport) protocol.TunnelService
DynamicTunnelClient returns a rpc client suitable for TunnelService, with the destination set per call dynamically according to the destination in context. Use WithNode(ctx, node) at call site to dynamically dispatch. Optionally, use WithClientToken(ctx, token) to include client token.
func ExtractContext ¶
Middleware to attach the deserialized RPC context to the current request
func GetContext ¶
Retrieve the RPC context of this request
func GetDelegation ¶
func GetDelegation(ctx context.Context) *transport.StreamDelegate
Retrieve the delegation of this request
func GetErrorMeta ¶
func SerializeContextHeader ¶
Serialize RPC context as http headers
func WithContext ¶
Send RPC context for this request
func WithDelegation ¶
Attach the delegation triggering the request
func WrapErrorKV ¶
Types ¶
type ChordClient ¶
type ChordClient interface { protocol.VNodeService protocol.KVService RatePer(interval time.Duration) float64 }
func DynamicChordClient ¶
func DynamicChordClient(baseContext context.Context, chordTransport transport.Transport) ChordClient
DynamicChordClient returns a rpc client suitable for both VNodeService and KVService, with the destination set per call dynamically according to the destination in context. Use WithNode(ctx, node) at call site to dynamically dispatch.