Documentation ¶
Overview ¶
Package logicrunner - infrastructure for executing smartcontracts
Index ¶
- func MakeBaseMessage(req rpctypes.UpBaseReq, es *ExecutionState) message.BaseLogicMessage
- type CaseBind
- type CaseBindReplay
- type CaseRequest
- type Consensus
- func (c *Consensus) AddExecutor(ctx context.Context, sm core.Parcel, msg *message.ExecutorResults)
- func (c *Consensus) AddValidated(ctx context.Context, sm core.Parcel, msg *message.ValidationResults) error
- func (c *Consensus) CheckReady(ctx context.Context)
- func (c *Consensus) FindRequestBefore(steps int) *core.RecordID
- func (c *Consensus) GetReference() Ref
- func (c *Consensus) GetValidatorSignatures() (messages []core.Message)
- type ConsensusRecord
- type CurrentExecution
- type Error
- type ExecutionQueueElement
- type ExecutionQueueResult
- type ExecutionState
- type LogicRunner
- func (lr *LogicRunner) CheckExecutionLoop(ctx context.Context, es *ExecutionState, parcel core.Parcel) bool
- func (lr *LogicRunner) CheckOurRole(ctx context.Context, msg core.Message, role core.DynamicRole) error
- func (lr *LogicRunner) Execute(ctx context.Context, parcel core.Parcel) (core.Reply, error)
- func (lr *LogicRunner) GetConsensus(ctx context.Context, ref Ref) *Consensus
- func (lr *LogicRunner) GetExecutor(t core.MachineType) (core.MachineLogicExecutor, error)
- func (lr *LogicRunner) GetObjectState(ref Ref) *ObjectState
- func (lr *LogicRunner) HandleExecutorResultsMessage(ctx context.Context, inmsg core.Parcel) (core.Reply, error)
- func (lr *LogicRunner) HandlePendingFinishedMessage(ctx context.Context, parcel core.Parcel) (core.Reply, error)
- func (lr *LogicRunner) HandleStillExecutingMessage(ctx context.Context, parcel core.Parcel) (core.Reply, error)
- func (lr *LogicRunner) HandleValidateCaseBindMessage(ctx context.Context, inmsg core.Parcel) (core.Reply, error)
- func (lr *LogicRunner) HandleValidationResultsMessage(ctx context.Context, inmsg core.Parcel) (core.Reply, error)
- func (lr *LogicRunner) MustObjectState(ref Ref) *ObjectState
- func (lr *LogicRunner) OnPulse(ctx context.Context, pulse core.Pulse) error
- func (lr *LogicRunner) ProcessExecutionQueue(ctx context.Context, es *ExecutionState)
- func (lr *LogicRunner) RegisterExecutor(t core.MachineType, e core.MachineLogicExecutor) error
- func (lr *LogicRunner) RegisterHandlers()
- func (lr *LogicRunner) RegisterRequest(ctx context.Context, parcel core.Parcel) (*Ref, error)
- func (lr *LogicRunner) Start(ctx context.Context) error
- func (lr *LogicRunner) StartQueueProcessorIfNeeded(ctx context.Context, es *ExecutionState, msg core.Message) error
- func (lr *LogicRunner) Stop(ctx context.Context) error
- func (lr *LogicRunner) UpsertObjectState(ref Ref) *ObjectState
- func (lr *LogicRunner) Validate(ctx context.Context, ref Ref, p core.Pulse, cb CaseBind) (int, error)
- type ObjectBody
- type ObjectState
- type RPC
- func (gpr *RPC) DeactivateObject(req rpctypes.UpDeactivateObjectReq, rep *rpctypes.UpDeactivateObjectResp) (err error)
- func (gpr *RPC) GetCode(req rpctypes.UpGetCodeReq, reply *rpctypes.UpGetCodeResp) (err error)
- func (gpr *RPC) GetDelegate(req rpctypes.UpGetDelegateReq, rep *rpctypes.UpGetDelegateResp) (err error)
- func (gpr *RPC) GetObjChildrenIterator(req rpctypes.UpGetObjChildrenIteratorReq, ...) (err error)
- func (gpr *RPC) RouteCall(req rpctypes.UpRouteReq, rep *rpctypes.UpRouteResp) (err error)
- func (gpr *RPC) SaveAsChild(req rpctypes.UpSaveAsChildReq, rep *rpctypes.UpSaveAsChildResp) (err error)
- func (gpr *RPC) SaveAsDelegate(req rpctypes.UpSaveAsDelegateReq, rep *rpctypes.UpSaveAsDelegateResp) (err error)
- type Ref
- type ValidationBehaviour
- type ValidationChecker
- type ValidationSaver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeBaseMessage ¶ added in v0.5.0
func MakeBaseMessage(req rpctypes.UpBaseReq, es *ExecutionState) message.BaseLogicMessage
MakeBaseMessage makes base of logicrunner event from base of up request
Types ¶
type CaseBind ¶ added in v0.4.0
type CaseBind struct {
Requests []CaseRequest
}
CaseBinder is a whole result of executor efforts on every object it seen on this pulse
func NewCaseBind ¶ added in v0.7.5
func NewCaseBind() *CaseBind
func NewCaseBindFromExecutorResultsMessage ¶ added in v0.7.5
func NewCaseBindFromExecutorResultsMessage(msg *message.ExecutorResults) *CaseBind
func NewCaseBindFromValidateMessage ¶ added in v0.7.5
func NewCaseBindFromValidateMessage(ctx context.Context, mb core.MessageBus, msg *message.ValidateCaseBind) *CaseBind
func (*CaseBind) NewRequest ¶ added in v0.7.5
func (cb *CaseBind) NewRequest(p core.Parcel, request Ref, mb core.MessageBus) *CaseRequest
func (*CaseBind) ToValidateMessage ¶ added in v0.7.5
type CaseBindReplay ¶ added in v0.7.5
type CaseBindReplay struct { Pulse core.Pulse CaseBind CaseBind Request int Record int Steps int Fail int }
func NewCaseBindReplay ¶ added in v0.7.5
func NewCaseBindReplay(cb CaseBind) *CaseBindReplay
func (*CaseBindReplay) NextRequest ¶ added in v0.7.5
func (r *CaseBindReplay) NextRequest() *CaseRequest
type CaseRequest ¶ added in v0.7.5
type Consensus ¶ added in v0.6.1
type Consensus struct { sync.Mutex Have int Need int Total int Results map[Ref]ConsensusRecord CaseBind CaseBind Message core.Parcel // contains filtered or unexported fields }
Consensus is an object for one validation process where all validated results will be compared.
func (*Consensus) AddExecutor ¶ added in v0.6.1
func (*Consensus) AddValidated ¶ added in v0.6.1
func (c *Consensus) AddValidated(ctx context.Context, sm core.Parcel, msg *message.ValidationResults) error
AddValidated adds results from validators
func (*Consensus) CheckReady ¶ added in v0.6.1
func (*Consensus) FindRequestBefore ¶ added in v0.6.2
FindRequestBefore returns request placed before step (last valid request)
func (*Consensus) GetReference ¶ added in v0.6.2
func (*Consensus) GetValidatorSignatures ¶ added in v0.6.2
type ConsensusRecord ¶ added in v0.6.1
type CurrentExecution ¶ added in v0.7.5
type CurrentExecution struct { Context context.Context LogicContext *core.LogicCallContext Request *Ref Sequence uint64 RequesterNode *Ref ReturnMode message.MethodReturnMode SentResult bool }
type ExecutionQueueElement ¶ added in v0.7.5
type ExecutionQueueElement struct {
// contains filtered or unexported fields
}
type ExecutionQueueResult ¶ added in v0.7.5
type ExecutionQueueResult struct {
// contains filtered or unexported fields
}
type ExecutionState ¶ added in v0.6.1
type ExecutionState struct { sync.Mutex ArtifactManager core.ArtifactManager Behaviour ValidationBehaviour Current *CurrentExecution Queue []ExecutionQueueElement QueueProcessorActive bool PendingConfirmed bool // contains filtered or unexported fields }
func (*ExecutionState) CheckPendingRequests ¶ added in v0.7.5
func (es *ExecutionState) CheckPendingRequests(ctx context.Context, inMsg core.Message) (message.PendingState, error)
type LogicRunner ¶
type LogicRunner struct { // FIXME: Ledger component is deprecated. Inject required sub-components. MessageBus core.MessageBus `inject:""` ContractRequester core.ContractRequester `inject:""` Ledger core.Ledger `inject:""` NodeNetwork core.NodeNetwork `inject:""` PlatformCryptographyScheme core.PlatformCryptographyScheme `inject:""` ParcelFactory message.ParcelFactory `inject:""` PulseStorage core.PulseStorage `inject:""` ArtifactManager core.ArtifactManager `inject:""` JetCoordinator core.JetCoordinator `inject:""` Executors [core.MachineTypesLastID]core.MachineLogicExecutor Cfg *configuration.LogicRunner // contains filtered or unexported fields }
LogicRunner is a general interface of contract executor
func NewLogicRunner ¶ added in v0.0.3
func NewLogicRunner(cfg *configuration.LogicRunner) (*LogicRunner, error)
NewLogicRunner is constructor for LogicRunner
func (*LogicRunner) CheckExecutionLoop ¶ added in v0.7.5
func (lr *LogicRunner) CheckExecutionLoop( ctx context.Context, es *ExecutionState, parcel core.Parcel, ) bool
func (*LogicRunner) CheckOurRole ¶ added in v0.6.3
func (lr *LogicRunner) CheckOurRole(ctx context.Context, msg core.Message, role core.DynamicRole) error
func (*LogicRunner) Execute ¶ added in v0.0.3
Execute runs a method on an object, ATM just thin proxy to `GoPlugin.Exec`
func (*LogicRunner) GetConsensus ¶ added in v0.6.1
func (lr *LogicRunner) GetConsensus(ctx context.Context, ref Ref) *Consensus
func (*LogicRunner) GetExecutor ¶ added in v0.0.3
func (lr *LogicRunner) GetExecutor(t core.MachineType) (core.MachineLogicExecutor, error)
GetExecutor returns an executor for the `MachineType` if it was registered (`RegisterExecutor`), returns error otherwise
func (*LogicRunner) GetObjectState ¶ added in v0.7.5
func (lr *LogicRunner) GetObjectState(ref Ref) *ObjectState
func (*LogicRunner) HandleExecutorResultsMessage ¶ added in v0.7.5
func (*LogicRunner) HandlePendingFinishedMessage ¶ added in v0.7.5
func (*LogicRunner) HandleStillExecutingMessage ¶ added in v0.7.5
func (*LogicRunner) HandleValidateCaseBindMessage ¶ added in v0.7.5
func (*LogicRunner) HandleValidationResultsMessage ¶ added in v0.7.5
func (*LogicRunner) MustObjectState ¶ added in v0.7.5
func (lr *LogicRunner) MustObjectState(ref Ref) *ObjectState
func (*LogicRunner) ProcessExecutionQueue ¶ added in v0.7.5
func (lr *LogicRunner) ProcessExecutionQueue(ctx context.Context, es *ExecutionState)
func (*LogicRunner) RegisterExecutor ¶ added in v0.0.3
func (lr *LogicRunner) RegisterExecutor(t core.MachineType, e core.MachineLogicExecutor) error
RegisterExecutor registers an executor for particular `MachineType`
func (*LogicRunner) RegisterHandlers ¶ added in v0.6.3
func (lr *LogicRunner) RegisterHandlers()
func (*LogicRunner) RegisterRequest ¶ added in v0.7.5
func (*LogicRunner) Start ¶
func (lr *LogicRunner) Start(ctx context.Context) error
Start starts logic runner component
func (*LogicRunner) StartQueueProcessorIfNeeded ¶ added in v0.7.5
func (lr *LogicRunner) StartQueueProcessorIfNeeded( ctx context.Context, es *ExecutionState, msg core.Message, ) error
func (*LogicRunner) Stop ¶
func (lr *LogicRunner) Stop(ctx context.Context) error
Stop stops logic runner component and its executors
func (*LogicRunner) UpsertObjectState ¶ added in v0.7.5
func (lr *LogicRunner) UpsertObjectState(ref Ref) *ObjectState
type ObjectBody ¶ added in v0.6.2
type ObjectBody struct { Object []byte Prototype *Ref CodeMachineType core.MachineType CodeRef *Ref Parent *Ref // contains filtered or unexported fields }
ObjectBody is an inner representation of object and all it accessory make it private again when we start it serialize before sending
type ObjectState ¶ added in v0.7.5
type ObjectState struct { sync.Mutex Ref *Ref ExecutionState *ExecutionState Validation *ExecutionState Consensus *Consensus }
Context of one contract execution
func (*ObjectState) MustModeState ¶ added in v0.7.5
func (st *ObjectState) MustModeState(mode string) (res *ExecutionState)
func (*ObjectState) RefreshConsensus ¶ added in v0.7.5
func (st *ObjectState) RefreshConsensus()
func (*ObjectState) StartValidation ¶ added in v0.7.5
func (st *ObjectState) StartValidation() *ExecutionState
type RPC ¶ added in v0.4.0
type RPC struct {
// contains filtered or unexported fields
}
RPC is a RPC interface for runner to use for various tasks, e.g. code fetching
func StartRPC ¶ added in v0.4.0
func StartRPC(ctx context.Context, lr *LogicRunner, ps core.PulseStorage) *RPC
StartRPC starts RPC server for isolated executors to use
func (*RPC) DeactivateObject ¶ added in v0.6.0
func (gpr *RPC) DeactivateObject(req rpctypes.UpDeactivateObjectReq, rep *rpctypes.UpDeactivateObjectResp) (err error)
DeactivateObject is an RPC saving data as memory of a contract as child a parent
func (*RPC) GetCode ¶ added in v0.4.0
func (gpr *RPC) GetCode(req rpctypes.UpGetCodeReq, reply *rpctypes.UpGetCodeResp) (err error)
GetCode is an RPC retrieving a code by its reference
func (*RPC) GetDelegate ¶ added in v0.4.0
func (gpr *RPC) GetDelegate(req rpctypes.UpGetDelegateReq, rep *rpctypes.UpGetDelegateResp) (err error)
GetDelegate is an RPC saving data as memory of a contract as child a parent
func (*RPC) GetObjChildrenIterator ¶ added in v0.7.5
func (gpr *RPC) GetObjChildrenIterator( req rpctypes.UpGetObjChildrenIteratorReq, rep *rpctypes.UpGetObjChildrenIteratorResp, ) ( err error, )
GetObjChildrenIterator is an RPC returns an iterator over object children with specified prototype
func (*RPC) RouteCall ¶ added in v0.4.0
func (gpr *RPC) RouteCall(req rpctypes.UpRouteReq, rep *rpctypes.UpRouteResp) (err error)
RouteCall routes call from a contract to a contract through event bus.
func (*RPC) SaveAsChild ¶ added in v0.4.0
func (gpr *RPC) SaveAsChild(req rpctypes.UpSaveAsChildReq, rep *rpctypes.UpSaveAsChildResp) (err error)
SaveAsChild is an RPC saving data as memory of a contract as child a parent
func (*RPC) SaveAsDelegate ¶ added in v0.4.0
func (gpr *RPC) SaveAsDelegate(req rpctypes.UpSaveAsDelegateReq, rep *rpctypes.UpSaveAsDelegateResp) (err error)
SaveAsDelegate is an RPC saving data as memory of a contract as child a parent
type ValidationBehaviour ¶ added in v0.5.0
ValidationBehaviour is a special object that responsible for validation behavior of other methods.
type ValidationChecker ¶ added in v0.5.0
type ValidationChecker struct {
// contains filtered or unexported fields
}
func (*ValidationChecker) Mode ¶ added in v0.7.5
func (vb *ValidationChecker) Mode() string
func (*ValidationChecker) NextRequest ¶ added in v0.7.5
func (vb *ValidationChecker) NextRequest() *CaseRequest
type ValidationSaver ¶ added in v0.5.0
type ValidationSaver struct {
// contains filtered or unexported fields
}
func (*ValidationSaver) Mode ¶ added in v0.7.5
func (vb *ValidationSaver) Mode() string
func (*ValidationSaver) NewRequest ¶ added in v0.7.5
func (vb *ValidationSaver) NewRequest(p core.Parcel, request Ref, mb core.MessageBus)
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package builtin is implementation of builtin contracts engine
|
Package builtin is implementation of builtin contracts engine |
Package goplugin - golang plugin in docker runner
|
Package goplugin - golang plugin in docker runner |
foundation
Package foundation server implementation of smartcontract functions
|
Package foundation server implementation of smartcontract functions |