Documentation ¶
Index ¶
- type RPCState
- type RequestEntry
- type RequestKey
- type Responder
- type RpcCmd
- type RpcMethodCloseCmd
- type RpcMethodCmd
- type RpcMethodData
- type RpcMethodListenCmd
- type RpcMethodReqCmd
- type RpcMethodReqRawCmd
- type RpcMethodRespChunkCmd
- type RpcMethodRespChunkRawCmd
- type RpcMethodRespCmd
- type RpcMethodRespErrorCmd
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RequestEntry ¶
type RequestEntry struct { From peer.ID Handler reqresp.RequestResponder Cancel func() }
type RequestKey ¶
type RequestKey uint64
type Responder ¶
type Responder struct { // RequestKey -> RequestEntry Requests sync.Map // contains filtered or unexported fields }
func (*Responder) AddRequest ¶
func (r *Responder) AddRequest(req *RequestEntry) RequestKey
func (*Responder) CloseRequest ¶
func (r *Responder) CloseRequest(key RequestKey)
func (*Responder) GetRequest ¶
func (r *Responder) GetRequest(key RequestKey) *RequestEntry
type RpcMethodCloseCmd ¶
type RpcMethodCloseCmd struct { *base.Base *RpcMethodData ReqId string `ask:"<req-id>" help:"the ID of the request to close"` }
func (*RpcMethodCloseCmd) Help ¶
func (c *RpcMethodCloseCmd) Help() string
type RpcMethodCmd ¶
type RpcMethodCmd struct { *base.Base *RpcMethodData }
func (*RpcMethodCmd) Cmd ¶
func (c *RpcMethodCmd) Cmd(route string) (cmd interface{}, err error)
func (*RpcMethodCmd) Help ¶
func (c *RpcMethodCmd) Help() string
func (*RpcMethodCmd) Routes ¶
func (c *RpcMethodCmd) Routes() []string
type RpcMethodData ¶
type RpcMethodListenCmd ¶
type RpcMethodListenCmd struct { *base.Base *RpcMethodData Timeout time.Duration `` /* 127-byte string literal not displayed */ Compression flags.CompressionFlag `ask:"--compression" help:"Compression. 'none' to disable, 'snappy' for streaming-snappy"` Raw bool `ask:"--raw" help:"Do not decode the request, look at raw bytes"` Drop bool `ask:"--drop" help:"Drop the requests, do not queue for a response."` Read bool `ask:"--read" help:"Read the contents of the request."` }
func (*RpcMethodListenCmd) Help ¶
func (c *RpcMethodListenCmd) Help() string
type RpcMethodReqCmd ¶
type RpcMethodReqCmd struct { *base.Base *RpcMethodData }
func (*RpcMethodReqCmd) Cmd ¶
func (c *RpcMethodReqCmd) Cmd(route string) (cmd interface{}, err error)
func (*RpcMethodReqCmd) Help ¶
func (c *RpcMethodReqCmd) Help() string
func (*RpcMethodReqCmd) Routes ¶
func (c *RpcMethodReqCmd) Routes() []string
TODO: it may make sense to just collapse this command route, and only support raw requests.
type RpcMethodReqRawCmd ¶
type RpcMethodReqRawCmd struct { *base.Base *RpcMethodData Timeout time.Duration `ask:"--timeout" help:"Timeout for full request and response. 0 to disable"` Compression flags.CompressionFlag `ask:"--compression" help:"Compression. 'none' to disable, 'snappy' for streaming-snappy"` MaxChunks uint64 `ask:"--max-chunks" help:"Max response chunk count, if 0, do not wait for a response at all."` Raw bool `ask:"--raw" help:"If chunks should be logged as raw hex-encoded byte strings"` PeerID flags.PeerIDFlag `ask:"<peer-id>" help:"libp2p Peer-ID to request"` Data []byte `ask:"<data>" help:"Raw uncompressed hex-encoded request data"` }
func (*RpcMethodReqRawCmd) Help ¶
func (c *RpcMethodReqRawCmd) Help() string
type RpcMethodRespChunkCmd ¶
type RpcMethodRespChunkCmd struct { *base.Base *RpcMethodData }
func (*RpcMethodRespChunkCmd) Cmd ¶
func (c *RpcMethodRespChunkCmd) Cmd(route string) (cmd interface{}, err error)
func (*RpcMethodRespChunkCmd) Help ¶
func (c *RpcMethodRespChunkCmd) Help() string
func (*RpcMethodRespChunkCmd) Routes ¶
func (c *RpcMethodRespChunkCmd) Routes() []string
type RpcMethodRespChunkRawCmd ¶
type RpcMethodRespChunkRawCmd struct { *base.Base *RpcMethodData Done bool `ask:"--done" help:"After writing this chunk, close the response (no more chunks)."` ResultCode reqresp.ResponseCode `ask:"--result-code" help:"Customize the chunk result code. (0 = success, 1 = invalid input, 2 = error, 3+ = undefined)"` ReqId string `ask:"<req-id>" help:"the ID of the request to respond to"` Data []byte `ask:"<data>" help:"chunk bytes (uncompressed, hex-encoded)"` }
func (*RpcMethodRespChunkRawCmd) Help ¶
func (c *RpcMethodRespChunkRawCmd) Help() string
type RpcMethodRespCmd ¶
type RpcMethodRespCmd struct { *base.Base *RpcMethodData }
func (*RpcMethodRespCmd) Cmd ¶
func (c *RpcMethodRespCmd) Cmd(route string) (cmd interface{}, err error)
func (*RpcMethodRespCmd) Help ¶
func (c *RpcMethodRespCmd) Help() string
func (*RpcMethodRespCmd) Routes ¶
func (c *RpcMethodRespCmd) Routes() []string
type RpcMethodRespErrorCmd ¶
type RpcMethodRespErrorCmd struct { *base.Base *RpcMethodData Done bool `ask:"--done" help:"After writing this chunk, close the response (no more chunks)."` ResultCode reqresp.ResponseCode `ask:"--result-code" help:"Customize the chunk result code. (0 = success, 1 = invalid input, 2 = error, 3+ = undefined)"` ReqId string `ask:"<req-id>" help:"the ID of the request to respond to"` Text string `ask:"<text>" help:"error text data"` }
func (*RpcMethodRespErrorCmd) Help ¶
func (c *RpcMethodRespErrorCmd) Help() string
Click to show internal directories.
Click to hide internal directories.