logicrunner

package
v0.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package logicrunner - infrastructure for executing smartcontracts

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashInterface added in v0.4.0

func HashInterface(scheme core.PlatformCryptographyScheme, in interface{}) []byte

func MakeBaseMessage added in v0.5.0

func MakeBaseMessage(req rpctypes.UpBaseReq) message.BaseLogicMessage

MakeBaseMessage makes base of logicrunner event from base of up request

Types

type Consensus added in v0.6.1

type Consensus struct {
	sync.Mutex

	Have     int
	Need     int
	Total    int
	Results  map[Ref]ConsensusRecord
	CaseBind core.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 (c *Consensus) AddExecutor(ctx context.Context, sm core.Parcel, msg *message.ExecutorResults)

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 (c *Consensus) CheckReady(ctx context.Context)

func (*Consensus) FindRequestBefore added in v0.6.2

func (c *Consensus) FindRequestBefore(steps int) *core.RecordID

FindRequestBefore returns request placed before step (last valid request)

func (*Consensus) GetReference added in v0.6.2

func (c *Consensus) GetReference() Ref

func (*Consensus) GetValidatorSignatures added in v0.6.2

func (c *Consensus) GetValidatorSignatures() (messages []core.Message)

type ConsensusRecord added in v0.6.1

type ConsensusRecord struct {
	Steps   int
	Error   string
	Message core.Parcel
}

type Error added in v0.6.3

type Error struct {
	Err      error
	Request  *Ref
	Contract *Ref
	Method   string
}

func (Error) Error added in v0.6.3

func (lre Error) Error() string

type ExecutionState added in v0.6.1

type ExecutionState struct {
	sync.Mutex
	Ref    *Ref
	Method string
	// contains filtered or unexported fields
}

Context of one contract execution

func (*ExecutionState) AddCaseRecord added in v0.6.3

func (es *ExecutionState) AddCaseRecord(record core.CaseRecord)

func (*ExecutionState) AddCaseRequest added in v0.6.3

func (es *ExecutionState) AddCaseRequest(record core.CaseRecord)

func (*ExecutionState) ErrorWrap added in v0.6.3

func (es *ExecutionState) ErrorWrap(err error, message string) error

func (*ExecutionState) Lock added in v0.6.3

func (es *ExecutionState) Lock()

func (*ExecutionState) ReleaseQueue added in v0.6.3

func (es *ExecutionState) ReleaseQueue()

func (*ExecutionState) Unlock added in v0.6.3

func (es *ExecutionState) Unlock()

type LogicRunner

type LogicRunner struct {
	// FIXME: Ledger component is deprecated. Inject required sub-components.
	MessageBus                 core.MessageBus                 `inject:""`
	Ledger                     core.Ledger                     `inject:""`
	Network                    core.Network                    `inject:""`
	PlatformCryptographyScheme core.PlatformCryptographyScheme `inject:""`
	ParcelFactory              message.ParcelFactory           `inject:""`
	PulseManager               core.PulseManager               `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) 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

func (lr *LogicRunner) Execute(ctx context.Context, parcel core.Parcel) (core.Reply, error)

Execute runs a method on an object, ATM just thin proxy to `GoPlugin.Exec`

func (*LogicRunner) ExecutorResults added in v0.6.0

func (lr *LogicRunner) ExecutorResults(ctx context.Context, inmsg core.Parcel) (core.Reply, error)

func (*LogicRunner) GetConsensus added in v0.6.1

func (lr *LogicRunner) GetConsensus(ctx context.Context, r Ref) (*Consensus, bool)

func (*LogicRunner) GetExecution added in v0.6.2

func (lr *LogicRunner) GetExecution(ref Ref) *ExecutionState

func (*LogicRunner) GetExecutor added in v0.0.3

GetExecutor returns an executor for the `MachineType` if it was registered (`RegisterExecutor`), returns error otherwise

func (*LogicRunner) MustExecutionState added in v0.6.3

func (lr *LogicRunner) MustExecutionState(ref Ref) *ExecutionState

func (*LogicRunner) OnPulse added in v0.4.0

func (lr *LogicRunner) OnPulse(ctx context.Context, pulse core.Pulse) error

func (*LogicRunner) ProcessValidationResults added in v0.6.0

func (lr *LogicRunner) ProcessValidationResults(ctx context.Context, inmsg core.Parcel) (core.Reply, error)

func (*LogicRunner) RefreshConsensus added in v0.6.2

func (lr *LogicRunner) RefreshConsensus()

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) Start

func (lr *LogicRunner) Start(ctx context.Context) error

Start starts logic runner component

func (*LogicRunner) Stop

func (lr *LogicRunner) Stop(ctx context.Context) error

Stop stops logic runner component and its executors

func (*LogicRunner) UpsertExecution added in v0.6.1

func (lr *LogicRunner) UpsertExecution(ref Ref) *ExecutionState

func (*LogicRunner) Validate added in v0.5.0

func (lr *LogicRunner) Validate(ctx context.Context, ref Ref, p core.Pulse, cb core.CaseBind) (int, error)

func (*LogicRunner) ValidateCaseBind added in v0.6.0

func (lr *LogicRunner) ValidateCaseBind(ctx context.Context, inmsg core.Parcel) (core.Reply, error)

type ObjectBody added in v0.6.2

type ObjectBody struct {
	Object          []byte
	ClassHeadRef    *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 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) *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) 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) 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) error

GetDelegate is an RPC saving data as memory of a contract as child a parent

func (*RPC) GetObjChildren added in v0.4.0

func (gpr *RPC) GetObjChildren(req rpctypes.UpGetObjChildrenReq, rep *rpctypes.UpGetObjChildrenResp) error

GetObjChildren is an RPC returns set of object children

func (*RPC) RouteCall added in v0.4.0

func (gpr *RPC) RouteCall(req rpctypes.UpRouteReq, rep *rpctypes.UpRouteResp) 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) 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) error

SaveAsDelegate is an RPC saving data as memory of a contract as child a parent

type Ref added in v0.6.0

type Ref = core.RecordRef

type ValidationBehaviour added in v0.5.0

type ValidationBehaviour interface {
	Begin(refs Ref, record core.CaseRecord)
	End(refs Ref, record core.CaseRecord)
	GetRole() core.DynamicRole
	ModifyContext(ctx *core.LogicCallContext)
	NeedSave() bool
	RegisterRequest(p core.Parcel) (*Ref, error)
}

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) Begin added in v0.5.0

func (vb ValidationChecker) Begin(refs Ref, record core.CaseRecord)

func (ValidationChecker) End added in v0.5.0

func (vb ValidationChecker) End(refs Ref, record core.CaseRecord)

func (ValidationChecker) GetRole added in v0.6.2

func (vb ValidationChecker) GetRole() core.DynamicRole

func (ValidationChecker) ModifyContext added in v0.5.0

func (vb ValidationChecker) ModifyContext(ctx *core.LogicCallContext)

func (ValidationChecker) NeedSave added in v0.5.0

func (vb ValidationChecker) NeedSave() bool

func (ValidationChecker) RegisterRequest added in v0.6.1

func (vb ValidationChecker) RegisterRequest(p core.Parcel) (*Ref, error)

type ValidationSaver added in v0.5.0

type ValidationSaver struct {
	// contains filtered or unexported fields
}

func (ValidationSaver) Begin added in v0.5.0

func (vb ValidationSaver) Begin(refs Ref, record core.CaseRecord)

func (ValidationSaver) End added in v0.5.0

func (vb ValidationSaver) End(refs Ref, record core.CaseRecord)

func (ValidationSaver) GetRole added in v0.6.2

func (vb ValidationSaver) GetRole() core.DynamicRole

func (ValidationSaver) ModifyContext added in v0.5.0

func (vb ValidationSaver) ModifyContext(ctx *core.LogicCallContext)

func (ValidationSaver) NeedSave added in v0.5.0

func (vb ValidationSaver) NeedSave() bool

func (ValidationSaver) RegisterRequest added in v0.6.1

func (vb ValidationSaver) RegisterRequest(p core.Parcel) (*Ref, error)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL