message

package
v0.6.2 Latest Latest
Warning

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

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

Documentation

Overview

Package message represents message that messagebus can route

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deserialize

func Deserialize(buff io.Reader) (core.SignedMessage, error)

Deserialize returns decoded message.

func DeserializeSigned added in v0.6.2

func DeserializeSigned(buff io.Reader) (core.SignedMessage, error)

DeserializeSigned returns decoded signed message.

func MustSerializeBytes added in v0.5.0

func MustSerializeBytes(msg core.Message) []byte

MustSerializeBytes returns encoded core.Message, panics on error.

func Serialize

func Serialize(msg core.Message) (io.Reader, error)

Serialize returns io.Reader on buffer with encoded core.Message.

func SerializeSigned added in v0.6.2

func SerializeSigned(msg core.SignedMessage) (io.Reader, error)

SerializeSigned returns io.Reader on buffer with encoded core.SignedMessage.

func SignedToBytes added in v0.6.2

func SignedToBytes(msg core.SignedMessage) ([]byte, error)

SignedToBytes deserialize a core.SignedMessage to bytes.

func ToBytes added in v0.6.0

func ToBytes(msg core.Message) ([]byte, error)

ToBytes deserialize a core.Message to bytes.

Types

type BaseLogicMessage added in v0.5.0

type BaseLogicMessage struct {
	Caller  core.RecordRef
	Request core.RecordRef
	Nonce   uint64
}

BaseLogicMessage base of event class family, do not use it standalone

func (*BaseLogicMessage) GetCaller added in v0.5.0

func (m *BaseLogicMessage) GetCaller() *core.RecordRef

func (*BaseLogicMessage) GetRequest added in v0.6.1

func (m *BaseLogicMessage) GetRequest() core.RecordRef

GetRequest returns RoleVirtualExecutor as routing target role.

func (*BaseLogicMessage) TargetRole added in v0.5.0

func (m *BaseLogicMessage) TargetRole() core.JetRole

TargetRole returns RoleVirtualExecutor as routing target role.

type BootstrapRequest added in v0.6.0

type BootstrapRequest struct {
	// Name should be unique for each bootstrap record.
	Name string
}

BootstrapRequest is used for bootstrap records generation.

func (*BootstrapRequest) GetCaller added in v0.6.0

func (*BootstrapRequest) GetCaller() *core.RecordRef

GetCaller implementation for bootstrap request.

func (*BootstrapRequest) Target added in v0.6.0

func (m *BootstrapRequest) Target() *core.RecordRef

Target implementation for bootstrap request.

func (*BootstrapRequest) TargetRole added in v0.6.0

func (*BootstrapRequest) TargetRole() core.JetRole

TargetRole implementation for bootstrap request.

func (*BootstrapRequest) Type added in v0.6.0

Type implementation for bootstrap request.

type CallConstructor

type CallConstructor struct {
	BaseLogicMessage
	ParentRef    core.RecordRef
	SaveAs       SaveAs
	PrototypeRef core.RecordRef
	Name         string
	Arguments    core.Arguments
	PulseNum     core.PulseNumber
}

CallConstructor is a message for calling constructor and obtain its reply

func (*CallConstructor) GetReference added in v0.5.0

func (m *CallConstructor) GetReference() core.RecordRef

func (*CallConstructor) Target

func (m *CallConstructor) Target() *core.RecordRef

Target returns request ref as routing target.

func (*CallConstructor) Type

func (m *CallConstructor) Type() core.MessageType

Type returns TypeCallConstructor.

type CallMethod

type CallMethod struct {
	BaseLogicMessage
	ReturnMode MethodReturnMode
	ObjectRef  core.RecordRef
	Method     string
	Arguments  core.Arguments
}

CallMethod - Simply call method and return result

func (*CallMethod) GetReference added in v0.5.0

func (m *CallMethod) GetReference() core.RecordRef

func (*CallMethod) Target

func (m *CallMethod) Target() *core.RecordRef

Target returns ObjectRef as routing target.

func (*CallMethod) Type

func (m *CallMethod) Type() core.MessageType

Type returns TypeCallMethod.

type ExecutorResults added in v0.6.0

type ExecutorResults struct {
	Caller      core.RecordRef
	RecordRef   core.RecordRef
	CaseRecords []core.CaseRecord
}

func (*ExecutorResults) GetCaller added in v0.6.0

func (m *ExecutorResults) GetCaller() *core.RecordRef

TODO change after changing pulsar

func (*ExecutorResults) GetReference added in v0.6.0

func (m *ExecutorResults) GetReference() core.RecordRef

func (*ExecutorResults) Target added in v0.6.0

func (m *ExecutorResults) Target() *core.RecordRef

func (*ExecutorResults) TargetRole added in v0.6.0

func (m *ExecutorResults) TargetRole() core.JetRole

func (*ExecutorResults) Type added in v0.6.0

func (m *ExecutorResults) Type() core.MessageType

type GetChildren added in v0.5.0

type GetChildren struct {
	Parent    core.RecordRef
	FromChild *core.RecordID
	FromPulse *core.PulseNumber
	Amount    int
	// contains filtered or unexported fields
}

GetChildren retrieves a chunk of children references.

func (GetChildren) GetCaller added in v0.5.0

func (GetChildren) GetCaller() *core.RecordRef

GetCaller implementation of Message interface.

func (*GetChildren) Target added in v0.5.0

func (e *GetChildren) Target() *core.RecordRef

Target implementation of Message interface.

func (GetChildren) TargetRole added in v0.5.0

func (GetChildren) TargetRole() core.JetRole

TargetRole implementation of Message interface.

func (*GetChildren) Type added in v0.5.0

func (e *GetChildren) Type() core.MessageType

Type implementation of Message interface.

type GetCode

type GetCode struct {
	Code core.RecordRef
	// contains filtered or unexported fields
}

GetCode retrieves code from storage.

func (GetCode) GetCaller

func (GetCode) GetCaller() *core.RecordRef

GetCaller implementation of Message interface.

func (*GetCode) Target

func (e *GetCode) Target() *core.RecordRef

Target implementation of Message interface.

func (GetCode) TargetRole

func (GetCode) TargetRole() core.JetRole

TargetRole implementation of Message interface.

func (*GetCode) Type

func (e *GetCode) Type() core.MessageType

Type implementation of Message interface.

type GetDelegate

type GetDelegate struct {
	Head   core.RecordRef
	AsType core.RecordRef
	// contains filtered or unexported fields
}

GetDelegate retrieves object represented as provided type.

func (GetDelegate) GetCaller

func (GetDelegate) GetCaller() *core.RecordRef

GetCaller implementation of Message interface.

func (*GetDelegate) Target

func (e *GetDelegate) Target() *core.RecordRef

Target implementation of Message interface.

func (GetDelegate) TargetRole

func (GetDelegate) TargetRole() core.JetRole

TargetRole implementation of Message interface.

func (*GetDelegate) Type

func (e *GetDelegate) Type() core.MessageType

Type implementation of Message interface.

type GetObject

type GetObject struct {
	Head     core.RecordRef
	State    *core.RecordID // If nil, will fetch the latest state.
	Approved bool
	// contains filtered or unexported fields
}

GetObject retrieves object from storage.

func (GetObject) GetCaller

func (GetObject) GetCaller() *core.RecordRef

GetCaller implementation of Message interface.

func (*GetObject) Target

func (e *GetObject) Target() *core.RecordRef

Target implementation of Message interface.

func (GetObject) TargetRole

func (GetObject) TargetRole() core.JetRole

TargetRole implementation of Message interface.

func (*GetObject) Type

func (e *GetObject) Type() core.MessageType

Type implementation of Message interface.

type IBaseLogicMessage added in v0.5.0

type IBaseLogicMessage interface {
	core.Message
	GetReference() core.RecordRef
	GetRequest() core.RecordRef
}

type JetDrop added in v0.6.0

type JetDrop struct {
	Jet         core.RecordRef
	Drop        []byte
	Messages    [][]byte
	PulseNumber core.PulseNumber
	// contains filtered or unexported fields
}

JetDrop spreads jet drop

func (JetDrop) GetCaller added in v0.6.0

func (JetDrop) GetCaller() *core.RecordRef

GetCaller implementation of Message interface.

func (*JetDrop) Target added in v0.6.0

func (e *JetDrop) Target() *core.RecordRef

Target implementation of Message interface.

func (JetDrop) TargetRole added in v0.6.0

func (JetDrop) TargetRole() core.JetRole

TargetRole implementation of Message interface.

func (*JetDrop) Type added in v0.6.0

func (e *JetDrop) Type() core.MessageType

Type implementation of Message interface.

type MethodReturnMode

type MethodReturnMode int

MethodReturnMode ENUM to set when method returns its result

const (
	// ReturnResult - return result as soon as it is ready
	ReturnResult MethodReturnMode = iota
	// ReturnNoWait - call method and return without results
	ReturnNoWait
)

type RegisterChild added in v0.5.0

type RegisterChild struct {
	Record []byte
	Parent core.RecordRef
	Child  core.RecordRef
	AsType *core.RecordRef // If not nil, considered as delegate.
	// contains filtered or unexported fields
}

RegisterChild amends object.

func (RegisterChild) GetCaller added in v0.5.0

func (RegisterChild) GetCaller() *core.RecordRef

GetCaller implementation of Message interface.

func (*RegisterChild) Target added in v0.5.0

func (e *RegisterChild) Target() *core.RecordRef

Target implementation of Message interface.

func (RegisterChild) TargetRole added in v0.5.0

func (RegisterChild) TargetRole() core.JetRole

TargetRole implementation of Message interface.

func (*RegisterChild) Type added in v0.5.0

func (e *RegisterChild) Type() core.MessageType

Type implementation of Message interface.

type RequestCall added in v0.5.0

type RequestCall struct {
	core.Message
}

RequestCall is a Ledger's message wrapping logicrunner's Call messages.

func (*RequestCall) TargetRole added in v0.5.0

func (*RequestCall) TargetRole() core.JetRole

TargetRole implementation of Message interface.

func (*RequestCall) Type added in v0.5.0

func (*RequestCall) Type() core.MessageType

Type implementation of Message interface.

type SaveAs added in v0.5.0

type SaveAs int
const (
	Child SaveAs = iota
	Delegate
)

type SetBlob added in v0.6.2

type SetBlob struct {
	TargetRef core.RecordRef
	Memory    []byte
	// contains filtered or unexported fields
}

SetBlob saves blob in storage.

func (SetBlob) GetCaller added in v0.6.2

func (SetBlob) GetCaller() *core.RecordRef

GetCaller implementation of Message interface.

func (*SetBlob) Target added in v0.6.2

func (m *SetBlob) Target() *core.RecordRef

Target implementation of Message interface.

func (SetBlob) TargetRole added in v0.6.2

func (SetBlob) TargetRole() core.JetRole

TargetRole implementation of Message interface.

func (*SetBlob) Type added in v0.6.2

func (*SetBlob) Type() core.MessageType

Type implementation of Message interface.

type SetRecord added in v0.6.1

type SetRecord struct {
	Record    []byte
	TargetRef core.RecordRef
	// contains filtered or unexported fields
}

SetRecord saves record in storage.

func (SetRecord) GetCaller added in v0.6.1

func (SetRecord) GetCaller() *core.RecordRef

GetCaller implementation of Message interface.

func (*SetRecord) Target added in v0.6.1

func (e *SetRecord) Target() *core.RecordRef

Target implementation of Message interface.

func (SetRecord) TargetRole added in v0.6.1

func (SetRecord) TargetRole() core.JetRole

TargetRole implementation of Message interface.

func (*SetRecord) Type added in v0.6.1

func (e *SetRecord) Type() core.MessageType

Type implementation of Message interface.

type SignedMessage added in v0.6.1

type SignedMessage struct {
	Sender        core.RecordRef
	Msg           core.Message
	Signature     []byte
	LogTraceID    string
	TraceSpanData []byte
}

SignedMessage is a message signed by senders private key.

func NewSignedMessage added in v0.6.1

func NewSignedMessage(
	ctx context.Context,
	msg core.Message,
	sender core.RecordRef,
	key *ecdsa.PrivateKey,
) (*SignedMessage, error)

NewSignedMessage creates and return a signed message.

func (*SignedMessage) Context added in v0.6.2

func (sm *SignedMessage) Context(ctx context.Context) context.Context

Context returns initialized context with propagated data with ctx as parent.

func (*SignedMessage) GetCaller added in v0.6.1

func (sm *SignedMessage) GetCaller() *core.RecordRef

GetCaller returns initiator of this event.

func (*SignedMessage) GetSender added in v0.6.1

func (sm *SignedMessage) GetSender() core.RecordRef

func (*SignedMessage) GetSign added in v0.6.1

func (sm *SignedMessage) GetSign() []byte

func (*SignedMessage) IsValid added in v0.6.1

func (sm *SignedMessage) IsValid(key *ecdsa.PublicKey) bool

IsValid checks if a sign is correct.

func (*SignedMessage) Message added in v0.6.1

func (sm *SignedMessage) Message() core.Message

func (*SignedMessage) Target added in v0.6.1

func (sm *SignedMessage) Target() *core.RecordRef

Target returns target for this message. If nil, Message will be sent for all actors for the role returned by Role method.

func (*SignedMessage) TargetRole added in v0.6.1

func (sm *SignedMessage) TargetRole() core.JetRole

TargetRole returns jet role to actors of which Message should be sent.

func (*SignedMessage) Type added in v0.6.1

func (sm *SignedMessage) Type() core.MessageType

Type returns message type.

type UpdateObject

type UpdateObject struct {
	Record []byte
	Object core.RecordRef
	// contains filtered or unexported fields
}

UpdateObject amends object.

func (UpdateObject) GetCaller

func (UpdateObject) GetCaller() *core.RecordRef

GetCaller implementation of Message interface.

func (*UpdateObject) Target

func (e *UpdateObject) Target() *core.RecordRef

Target implementation of Message interface.

func (UpdateObject) TargetRole

func (UpdateObject) TargetRole() core.JetRole

TargetRole implementation of Message interface.

func (*UpdateObject) Type

func (e *UpdateObject) Type() core.MessageType

Type implementation of Message interface.

type ValidateCaseBind added in v0.6.0

type ValidateCaseBind struct {
	Caller      core.RecordRef
	RecordRef   core.RecordRef
	CaseRecords []core.CaseRecord
	Pulse       core.Pulse
}

func (*ValidateCaseBind) GetCaller added in v0.6.0

func (m *ValidateCaseBind) GetCaller() *core.RecordRef

TODO change after changing pulsar

func (*ValidateCaseBind) GetCaseRecords added in v0.6.0

func (m *ValidateCaseBind) GetCaseRecords() []core.CaseRecord

func (*ValidateCaseBind) GetPulse added in v0.6.0

func (m *ValidateCaseBind) GetPulse() core.Pulse

func (*ValidateCaseBind) GetReference added in v0.6.0

func (m *ValidateCaseBind) GetReference() core.RecordRef

func (*ValidateCaseBind) Target added in v0.6.0

func (m *ValidateCaseBind) Target() *core.RecordRef

func (*ValidateCaseBind) TargetRole added in v0.6.0

func (m *ValidateCaseBind) TargetRole() core.JetRole

func (*ValidateCaseBind) Type added in v0.6.0

func (m *ValidateCaseBind) Type() core.MessageType

type ValidateRecord added in v0.6.2

type ValidateRecord struct {
	Object             core.RecordRef
	State              core.RecordID
	IsValid            bool
	ValidationMessages []core.Message
	// contains filtered or unexported fields
}

ValidateRecord creates VM validation for specific object record.

func (ValidateRecord) GetCaller added in v0.6.2

func (ValidateRecord) GetCaller() *core.RecordRef

GetCaller implementation of Message interface.

func (*ValidateRecord) Target added in v0.6.2

func (m *ValidateRecord) Target() *core.RecordRef

Target implementation of Message interface.

func (*ValidateRecord) TargetRole added in v0.6.2

func (*ValidateRecord) TargetRole() core.JetRole

TargetRole implementation of Message interface.

func (*ValidateRecord) Type added in v0.6.2

Type implementation of Message interface.

type ValidationResults added in v0.6.0

type ValidationResults struct {
	Caller           core.RecordRef
	RecordRef        core.RecordRef
	PassedStepsCount int
	Error            string
}

func (*ValidationResults) GetCaller added in v0.6.0

func (m *ValidationResults) GetCaller() *core.RecordRef

TODO change after changing pulsar

func (*ValidationResults) GetReference added in v0.6.0

func (m *ValidationResults) GetReference() core.RecordRef

func (*ValidationResults) Target added in v0.6.0

func (m *ValidationResults) Target() *core.RecordRef

func (ValidationResults) TargetRole added in v0.6.0

func (m ValidationResults) TargetRole() core.JetRole

func (*ValidationResults) Type added in v0.6.0

Jump to

Keyboard shortcuts

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