message

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: 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.Parcel, error)

Deserialize returns decoded message.

func DeserializeParcel added in v0.6.3

func DeserializeParcel(buff io.Reader) (core.Parcel, error)

DeserializeParcel returns decoded signed message.

func ExtractAllowedSenderObjectAndRole added in v0.6.3

func ExtractAllowedSenderObjectAndRole(msg core.Message) (*core.RecordRef, core.DynamicRole)

ExtractAllowedSenderObjectAndRole extracts information from message verify sender required to 's "caller" for sender verification purpose. If nil then check of sender's role is not provided by the message bus

func ExtractRole added in v0.6.3

func ExtractRole(msg core.Message) core.DynamicRole

func ExtractTarget added in v0.6.3

func ExtractTarget(msg core.Message) core.RecordRef

func MustSerializeBytes added in v0.5.0

func MustSerializeBytes(msg core.Message) []byte

MustSerializeBytes returns encoded core.Message, panics on error.

func ParcelToBytes added in v0.6.3

func ParcelToBytes(msg core.Parcel) []byte

ParcelToBytes deserialize a core.Parcel to bytes.

func Serialize

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

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

func SerializeParcel added in v0.6.3

func SerializeParcel(parcel core.Parcel) (io.Reader, error)

SerializeParcel returns io.Reader on buffer with encoded core.Parcel.

func ToBytes added in v0.6.0

func ToBytes(msg core.Message) []byte

ToBytes deserialize a core.Message to bytes.

Types

type BaseLogicMessage added in v0.5.0

type BaseLogicMessage struct {
	Caller          core.RecordRef
	Request         core.RecordRef
	CallerPrototype 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) GetCallerPrototype added in v0.6.3

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

func (*BaseLogicMessage) GetRequest added in v0.6.1

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

GetRequest returns DynamicRoleVirtualExecutor as routing target role.

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) 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) 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
	CaseBind  core.CaseBind
}

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) Type added in v0.6.0

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

type GenesisRequest added in v0.6.3

type GenesisRequest struct {
	// Name should be unique for each genesis record.
	Name string
}

GenesisRequest is used for genesis records generation.

func (*GenesisRequest) GetCaller added in v0.6.3

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

GetCaller implementation for genesis request.

func (*GenesisRequest) Type added in v0.6.3

Type implementation for genesis request.

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

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

Type implementation of Message interface.

type GetObjectIndex added in v0.6.3

type GetObjectIndex struct {
	Object core.RecordRef
	// contains filtered or unexported fields
}

GetObjectIndex fetches objects index.

func (GetObjectIndex) GetCaller added in v0.6.3

func (GetObjectIndex) GetCaller() *core.RecordRef

GetCaller implementation of Message interface.

func (*GetObjectIndex) Type added in v0.6.3

Type implementation of Message interface.

type HeavyPayload added in v0.6.3

type HeavyPayload struct {
	PulseNum core.PulseNumber
	Records  []core.KV
}

HeavyPayload carries Key/Value records and pulse number that replicates to Heavy Material node.

func (HeavyPayload) GetCaller added in v0.6.3

func (HeavyPayload) GetCaller() *core.RecordRef

GetCaller implementation of Message interface.

func (*HeavyPayload) Type added in v0.6.3

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

Type implementation of Message interface.

type HeavyStartStop added in v0.6.3

type HeavyStartStop struct {
	PulseNum core.PulseNumber
	Finished bool
}

HeavyStartStop carries heavy replication start/stop signal with pulse range.

func (HeavyStartStop) GetCaller added in v0.6.3

func (HeavyStartStop) GetCaller() *core.RecordRef

GetCaller implementation of Message interface.

func (*HeavyStartStop) Type added in v0.6.3

func (e *HeavyStartStop) 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
	GetCallerPrototype() *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) 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 Parcel added in v0.6.3

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

Parcel is a message signed by senders private key.

func (*Parcel) AddDelegationToken added in v0.6.3

func (sm *Parcel) AddDelegationToken(token core.DelegationToken)

func (*Parcel) Context added in v0.6.3

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

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

func (*Parcel) DelegationToken added in v0.6.3

func (sm *Parcel) DelegationToken() core.DelegationToken

func (*Parcel) GetCaller added in v0.6.3

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

GetCaller returns initiator of this event.

func (*Parcel) GetSender added in v0.6.3

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

func (*Parcel) GetSign added in v0.6.3

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

func (*Parcel) Message added in v0.6.3

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

Message returns current instance's message

func (*Parcel) Type added in v0.6.3

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

Type returns message type.

type ParcelFactory added in v0.6.3

type ParcelFactory interface {
	Create(context.Context, core.Message, core.RecordRef, core.DelegationToken) (core.Parcel, error)
	Validate(crypto.PublicKey, core.Parcel) error
}

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

func (e *RegisterChild) 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) 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) Type added in v0.6.1

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

Type implementation of Message interface.

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) 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
	CaseBind  core.CaseBind
	Pulse     core.Pulse
}

func (*ValidateCaseBind) GetCaller added in v0.6.0

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

TODO change after changing pulsar

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) 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) 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) Type added in v0.6.0

Jump to

Keyboard shortcuts

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