Documentation ¶
Index ¶
- Constants
- func ProtoJSONMarshal(val interface{}) ([]byte, error)
- func ProtoJSONMarshalSlice(vals []interface{}) ([]byte, error)
- func SetActionHeaderFromContext(ctx sdk.Context, actionType string, ah *ActionHeader)
- type Action
- type ActionHeader
- type ActionPusher
- type AgdServer
- func (s *AgdServer) GetPort(name string) int
- func (s *AgdServer) MustRegisterPortHandler(name string, portHandler PortHandler) int
- func (s *AgdServer) ReceiveMessage(msg *Message, reply *string) error
- func (s *AgdServer) RegisterPortHandler(name string, portHandler PortHandler) (int, error)
- func (s *AgdServer) SetControllerContext(ctx sdk.Context) func()
- func (s *AgdServer) UnregisterPortHandler(portNum int) error
- type ArbitraryCoreProposal
- type ClientCodec
- func (cc *ClientCodec) Close() error
- func (cc *ClientCodec) ReadResponseBody(body interface{}) error
- func (cc *ClientCodec) ReadResponseHeader(r *rpc.Response) error
- func (cc *ClientCodec) Receive(rPort int, isError bool, data string) error
- func (cc *ClientCodec) WriteRequest(r *rpc.Request, body interface{}) error
- type ControllerAdmissionMsg
- type CoreProposalStep
- type CoreProposals
- type Jsonable
- type Message
- type PortHandler
- type Sender
Constants ¶
const ReceiveMessageMethod = "agvm.ReceiveMessage"
ReceiveMessageMethod is the name of the method we call in order to have the VM receive a Message.
Variables ¶
This section is empty.
Functions ¶
func ProtoJSONMarshal ¶
func ProtoJSONMarshalSlice ¶
ProtoJSONMarshalSlice marshals a slice of proto messages and non-proto values to a single JSON byte slice.
func SetActionHeaderFromContext ¶
func SetActionHeaderFromContext(ctx sdk.Context, actionType string, ah *ActionHeader)
SetActionHeaderFromContext provides defaults to an ActionHeader.
Types ¶
type Action ¶
type Action interface {
GetActionHeader() *ActionHeader
}
func PopulateAction ¶
PopulateAction returns a clone of action in which empty/zero-valued fields in its embedded ActionHeader have been populated using the corresponding `actionType:"..."` tag and the provided ctx, and its own empty/zero-valued fields have been populated as specified by their `default:"..."` tags.
type ActionHeader ¶
type ActionHeader struct { // Type defaults to the `actionType:"..."` tag of the embedder's ActionHeader field. Type string `json:"type,omitempty"` // BlockHeight defaults to sdk.Context.BlockHeight(). BlockHeight int64 `json:"blockHeight,omitempty"` // BlockTime defaults to sdk.Context.BlockTime().Unix(). BlockTime int64 `json:"blockTime,omitempty"` }
ActionHeader should be embedded in all actions. It is populated by PopulateAction.
func (*ActionHeader) GetActionHeader ¶
func (ah *ActionHeader) GetActionHeader() *ActionHeader
type ActionPusher ¶
ActionPusher enqueues data for later consumption by the controller.
type AgdServer ¶
type AgdServer struct {
// contains filtered or unexported fields
}
AgdServer manages communication from the VM to the ABCI app. The structure is mutable and the mutex must be held to read or write any field.
func NewAgdServer ¶
func NewAgdServer() *AgdServer
NewAgdServer returns a pointer to a new AgdServer with empty context and port mappings.
func (*AgdServer) GetPort ¶
GetPort returns the port number for the given port name, or 0 if the name is not registered.
func (*AgdServer) MustRegisterPortHandler ¶
func (s *AgdServer) MustRegisterPortHandler(name string, portHandler PortHandler) int
MustRegisterPortHandler attempts to RegisterPortHandler, panicing on error.
func (*AgdServer) ReceiveMessage ¶
ReceiveMessage is the method the VM calls in order to have agd receive a Message.
func (*AgdServer) RegisterPortHandler ¶
func (s *AgdServer) RegisterPortHandler(name string, portHandler PortHandler) (int, error)
RegisterPortHandler registers the handler to a new port number, then maps the name to it, returning the port number. If the name was previously in use, an error is returned.
func (*AgdServer) SetControllerContext ¶
SetControllerContext sets the context to the given argument and returns a function which will reset the context to an empty context (not the old context).
func (*AgdServer) UnregisterPortHandler ¶
UnregisterPortHandler unregisters the handler and name mappings for this port number, and the reverse mapping for its name, if any of these exist. If portNum is not registered, return an error.
type ArbitraryCoreProposal ¶
type ArbitraryCoreProposal struct {
Json json.RawMessage
}
func NewArbitraryCoreProposal ¶
func NewArbitraryCoreProposal(jsonStr string) *ArbitraryCoreProposal
type ClientCodec ¶
type ClientCodec struct {
// contains filtered or unexported fields
}
ClientCodec implements a net/rpc ClientCodec for the "bridge" between the Go runtime and the VM in the single-process dual-runtime configuration.
We expect to call it via the legacy API with signature:
sendToController func(needsReply bool, msg string) (string, error)
where msg and the returned string are JSON-encoded values.
Note that the net/rpc framework cannot express a call that does not expect a response, so we'll note such calls by sending with a reply port of 0 and having the WriteRequest() method fabricate a Receive() call to clear the rpc state.
func NewClientCodec ¶
NewClientCodec creates a new ClientCodec.
func (*ClientCodec) Close ¶
func (cc *ClientCodec) Close() error
func (*ClientCodec) ReadResponseBody ¶
func (cc *ClientCodec) ReadResponseBody(body interface{}) error
ReadResponseBody decodes a response body (currently just string) from the VM.
func (*ClientCodec) ReadResponseHeader ¶
func (cc *ClientCodec) ReadResponseHeader(r *rpc.Response) error
ReadResponseHeader decodes a response header from the VM.
func (*ClientCodec) Receive ¶
func (cc *ClientCodec) Receive(rPort int, isError bool, data string) error
Receive is called by the VM to send a response to the client.
func (*ClientCodec) WriteRequest ¶
func (cc *ClientCodec) WriteRequest(r *rpc.Request, body interface{}) error
WriteRequest sends a request to the VM.
type ControllerAdmissionMsg ¶
type ControllerAdmissionMsg interface { sdk.Msg CheckAdmissibility(sdk.Context, interface{}) error // GetInboundMsgCount returns the number of Swingset messages which will // be added to the inboundQueue. GetInboundMsgCount() int32 // IsHighPriority returns whether the message should be considered for // high priority processing, including bypass of some inbound checks // and queueing on higher priority queues. IsHighPriority(sdk.Context, interface{}) (bool, error) }
type CoreProposalStep ¶
type CoreProposalStep []Jsonable
CoreProposalStep is a set of core proposal configs which are executed concurrently
func CoreProposalStepForModules ¶
func CoreProposalStepForModules(modules ...Jsonable) CoreProposalStep
CoreProposalStepForModules generates a single core proposal step from the given modules, which will be executed concurrently during that step
type CoreProposals ¶
type CoreProposals struct {
Steps []CoreProposalStep `json:"steps"`
}
CoreProposals is one possible shape for core proposals expressed as a series of sequential steps see SequentialCoreProposals in packages/deploy-script-support/src/extract-proposal.js
func CoreProposalsFromSteps ¶
func CoreProposalsFromSteps(steps ...CoreProposalStep) *CoreProposals
CoreProposalsFromSteps returns a CoreProposals from the given steps
type Jsonable ¶
type Jsonable interface{}
Jsonable is a value, j, that can be passed through json.Marshal(j).
type PortHandler ¶
func NewProtectedPortHandler ¶
func NewProtectedPortHandler(inner PortHandler) PortHandler
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package jsonrpcconn provides a way to multiplex an io stream into two streams where incoming JSON-RPC requests go to one stream and incoming JSON-RPC responses go to another.
|
Package jsonrpcconn provides a way to multiplex an io stream into two streams where incoming JSON-RPC requests go to one stream and incoming JSON-RPC responses go to another. |