common

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2019 License: Apache-2.0 Imports: 15 Imported by: 81

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServiceDataFromContext

func ServiceDataFromContext(ctx context.Context) *payload.ServiceData

Types

type CBORSerializer

type CBORSerializer struct{}

func NewCBORSerializer

func NewCBORSerializer() *CBORSerializer

func (*CBORSerializer) Deserialize

func (s *CBORSerializer) Deserialize(from []byte, to interface{}) error

func (*CBORSerializer) Serialize

func (s *CBORSerializer) Serialize(what interface{}, to *[]byte) (err error)

type OutgoingRequest

type OutgoingRequest struct {
	Request  record.IncomingRequest
	Response []byte
	Error    error
}

type ProxyHelper

type ProxyHelper interface {
	SystemError
	Serializer
	RouteCall(
		ref insolar.Reference,
		immutable bool, saga bool,
		method string, args []byte, proxyPrototype insolar.Reference,
	) (result []byte, err error)
	SaveAsChild(
		parentRef, classRef insolar.Reference, constructorName string, argsSerialized []byte,
	) (result []byte, err error)
	DeactivateObject(object insolar.Reference) error
	MakeErrorSerializable(error) error
}

ProxyHelper interface with methods that are needed by contract proxies

var CurrentProxyCtx ProxyHelper

CurrentProxyCtx - hackish way to give proxies access to the current environment. Also, to avoid compiling in whole Insolar platform into every contract based on GoPlugin.

type RPC

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 (*RPC) Start

func (rpc *RPC) Start(ctx context.Context)

StartRPC starts RPC server for isolated executors to use

func (*RPC) Stop

func (rpc *RPC) Stop(_ context.Context) error

type Serializer

type Serializer interface {
	Serialize(interface{}, *[]byte) error
	Deserialize([]byte, interface{}) error
}

type SystemError

type SystemError interface {
	GetSystemError() error
	SetSystemError(err error)
}

type SystemErrorImpl

type SystemErrorImpl struct{}

func NewSystemError

func NewSystemError() *SystemErrorImpl

func (*SystemErrorImpl) GetSystemError

func (h *SystemErrorImpl) GetSystemError() error

func (*SystemErrorImpl) SetSystemError

func (h *SystemErrorImpl) SetSystemError(err error)

type Transcript

type Transcript struct {
	ObjectDescriptor artifacts.ObjectDescriptor
	Context          context.Context
	LogicContext     *insolar.LogicCallContext
	Request          *record.IncomingRequest
	RequestRef       insolar.Reference
	Nonce            uint64
	Deactivate       bool
	OutgoingRequests []OutgoingRequest
}

func NewTranscript

func NewTranscript(
	ctx context.Context,
	requestRef insolar.Reference,
	request record.IncomingRequest,
) *Transcript

func NewTranscriptCloneContext

func NewTranscriptCloneContext(
	ctxSource interface{},
	requestRef insolar.Reference,
	request record.IncomingRequest,
) *Transcript

NewTranscriptCloneContext creates a transcript with fresh context created from contextSource which can be either other Context or ServiceData. In general transcript shouldn't be created with context as execution can take minutes.

func (*Transcript) AddOutgoingRequest

func (t *Transcript) AddOutgoingRequest(
	ctx context.Context, request record.IncomingRequest, result []byte, err error,
)

func (*Transcript) HasOutgoingRequest

func (t *Transcript) HasOutgoingRequest(
	ctx context.Context, request record.IncomingRequest,
) *OutgoingRequest

Jump to

Keyboard shortcuts

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