messaging

package
v1.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2023 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EqualMessage

func EqualMessage(a, b Message) bool

EqualMessage is used to compare the values of the union

Types

type Envelope

type Envelope struct {
	Signatures  []protocol.Signature    `json:"signatures,omitempty" form:"signatures" query:"signatures" validate:"required"`
	TxHash      []byte                  `json:"txHash,omitempty" form:"txHash" query:"txHash"`
	Transaction []*protocol.Transaction `json:"transaction,omitempty" form:"transaction" query:"transaction"`
	Messages    []Message               `json:"messages,omitempty" form:"messages" query:"messages"`
	// contains filtered or unexported fields
}

func (*Envelope) Copy

func (v *Envelope) Copy() *Envelope

func (*Envelope) CopyAsInterface

func (v *Envelope) CopyAsInterface() interface{}

func (*Envelope) Equal

func (v *Envelope) Equal(u *Envelope) bool

func (*Envelope) IsValid

func (v *Envelope) IsValid() error

func (*Envelope) MarshalBinary

func (v *Envelope) MarshalBinary() ([]byte, error)

func (*Envelope) MarshalJSON

func (v *Envelope) MarshalJSON() ([]byte, error)

func (*Envelope) Normalize

func (e *Envelope) Normalize() ([]Message, error)

func (*Envelope) UnmarshalBinary

func (v *Envelope) UnmarshalBinary(data []byte) error

func (*Envelope) UnmarshalBinaryFrom

func (v *Envelope) UnmarshalBinaryFrom(rd io.Reader) error

func (*Envelope) UnmarshalJSON

func (v *Envelope) UnmarshalJSON(data []byte) error

type Message

type Message interface {
	encoding.UnionValue

	// ID is the ID of the message.
	ID() *url.TxID

	// Type is the type of the message.
	Type() MessageType

	// Hash returns the hash of the message.
	Hash() [32]byte
}

A Message is signature, transaction, or other message that may be sent to Accumulate to be processed.

func CopyMessage

func CopyMessage(v Message) Message

CopyMessage copies a Message.

func NewMessage

func NewMessage(typ MessageType) (Message, error)

NewMessage creates a new Message for the specified MessageType.

func UnmarshalMessage

func UnmarshalMessage(data []byte) (Message, error)

UnmarshalMessage unmarshals a Message.

func UnmarshalMessageFrom

func UnmarshalMessageFrom(rd io.Reader) (Message, error)

UnmarshalMessageFrom unmarshals a Message.

func UnmarshalMessageJSON

func UnmarshalMessageJSON(data []byte) (Message, error)

UnmarshalMessageJson unmarshals a Message.

type MessageType

type MessageType int

MessageType is the type of a Message.

const MessageTypeSequenced MessageType = 5

MessageTypeSequenced is a message that is part of a sequence.

const MessageTypeSynthetic MessageType = 3

MessageTypeSynthetic is a message produced by the protocol, requiring proof.

const MessageTypeUserSignature MessageType = 2

MessageTypeUserSignature is a key signature from a user.

const MessageTypeUserTransaction MessageType = 1

MessageTypeUserTransaction is a transaction from a user.

const MessageTypeValidatorSignature MessageType = 4

MessageTypeValidatorSignature is a key signature from a validator.

func MessageTypeByName

func MessageTypeByName(name string) (MessageType, bool)

MessageTypeByName returns the named Message Type.

func (MessageType) GetEnumValue

func (v MessageType) GetEnumValue() uint64

GetEnumValue returns the value of the Message Type

func (MessageType) MarshalJSON

func (v MessageType) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Message Type to JSON as a string.

func (*MessageType) SetEnumValue

func (v *MessageType) SetEnumValue(id uint64) bool

SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.

func (MessageType) String

func (v MessageType) String() string

String returns the name of the Message Type.

func (*MessageType) UnmarshalJSON

func (v *MessageType) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Message Type from JSON as a string.

type MessageWithSignature

type MessageWithSignature interface {
	Message
	GetSignature() protocol.Signature
	GetTxID() *url.TxID
}

type MessageWithTransaction

type MessageWithTransaction interface {
	Message
	GetTransaction() *protocol.Transaction
}

type SequencedMessage

type SequencedMessage struct {
	Message Message `json:"message,omitempty" form:"message" query:"message" validate:"required"`
	// Source is the source that produced the transaction.
	Source *url.URL `json:"source,omitempty" form:"source" query:"source"`
	// Destination is the destination that the transaction is sent to.
	Destination *url.URL `json:"destination,omitempty" form:"destination" query:"destination"`
	// Number is the sequence number of the transaction.
	Number uint64 `json:"number,omitempty" form:"number" query:"number"`
	// contains filtered or unexported fields
}

func (*SequencedMessage) Copy

func (*SequencedMessage) CopyAsInterface

func (v *SequencedMessage) CopyAsInterface() interface{}

func (*SequencedMessage) Equal

func (v *SequencedMessage) Equal(u *SequencedMessage) bool

func (*SequencedMessage) Hash

func (m *SequencedMessage) Hash() [32]byte

func (*SequencedMessage) ID

func (m *SequencedMessage) ID() *url.TxID

func (*SequencedMessage) IsValid

func (v *SequencedMessage) IsValid() error

func (*SequencedMessage) MarshalBinary

func (v *SequencedMessage) MarshalBinary() ([]byte, error)

func (*SequencedMessage) MarshalJSON

func (v *SequencedMessage) MarshalJSON() ([]byte, error)

func (*SequencedMessage) Type

func (*SequencedMessage) Type() MessageType

func (*SequencedMessage) UnmarshalBinary

func (v *SequencedMessage) UnmarshalBinary(data []byte) error

func (*SequencedMessage) UnmarshalBinaryFrom

func (v *SequencedMessage) UnmarshalBinaryFrom(rd io.Reader) error

func (*SequencedMessage) UnmarshalFieldsFrom

func (v *SequencedMessage) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*SequencedMessage) UnmarshalJSON

func (v *SequencedMessage) UnmarshalJSON(data []byte) error

func (*SequencedMessage) Unwrap

func (m *SequencedMessage) Unwrap() Message

type SyntheticMessage

type SyntheticMessage struct {
	Message Message                    `json:"message,omitempty" form:"message" query:"message" validate:"required"`
	Proof   *protocol.AnnotatedReceipt `json:"proof,omitempty" form:"proof" query:"proof" validate:"required"`
	// contains filtered or unexported fields
}

func (*SyntheticMessage) Copy

func (*SyntheticMessage) CopyAsInterface

func (v *SyntheticMessage) CopyAsInterface() interface{}

func (*SyntheticMessage) Equal

func (v *SyntheticMessage) Equal(u *SyntheticMessage) bool

func (*SyntheticMessage) Hash

func (m *SyntheticMessage) Hash() [32]byte

func (*SyntheticMessage) ID

func (m *SyntheticMessage) ID() *url.TxID

func (*SyntheticMessage) IsValid

func (v *SyntheticMessage) IsValid() error

func (*SyntheticMessage) MarshalBinary

func (v *SyntheticMessage) MarshalBinary() ([]byte, error)

func (*SyntheticMessage) MarshalJSON

func (v *SyntheticMessage) MarshalJSON() ([]byte, error)

func (*SyntheticMessage) Type

func (*SyntheticMessage) Type() MessageType

func (*SyntheticMessage) UnmarshalBinary

func (v *SyntheticMessage) UnmarshalBinary(data []byte) error

func (*SyntheticMessage) UnmarshalBinaryFrom

func (v *SyntheticMessage) UnmarshalBinaryFrom(rd io.Reader) error

func (*SyntheticMessage) UnmarshalFieldsFrom

func (v *SyntheticMessage) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*SyntheticMessage) UnmarshalJSON

func (v *SyntheticMessage) UnmarshalJSON(data []byte) error

func (*SyntheticMessage) Unwrap

func (m *SyntheticMessage) Unwrap() Message

type UserSignature

type UserSignature struct {
	Signature protocol.Signature `json:"signature,omitempty" form:"signature" query:"signature" validate:"required"`
	TxID      *url.TxID          `json:"txID,omitempty" form:"txID" query:"txID" validate:"required"`
	// contains filtered or unexported fields
}

func (*UserSignature) Copy

func (v *UserSignature) Copy() *UserSignature

func (*UserSignature) CopyAsInterface

func (v *UserSignature) CopyAsInterface() interface{}

func (*UserSignature) Equal

func (v *UserSignature) Equal(u *UserSignature) bool

func (*UserSignature) GetSignature

func (m *UserSignature) GetSignature() protocol.Signature

func (*UserSignature) GetTxID

func (m *UserSignature) GetTxID() *url.TxID

func (*UserSignature) Hash

func (m *UserSignature) Hash() [32]byte

func (*UserSignature) ID

func (m *UserSignature) ID() *url.TxID

func (*UserSignature) IsValid

func (v *UserSignature) IsValid() error

func (*UserSignature) MarshalBinary

func (v *UserSignature) MarshalBinary() ([]byte, error)

func (*UserSignature) MarshalJSON

func (v *UserSignature) MarshalJSON() ([]byte, error)

func (*UserSignature) Type

func (*UserSignature) Type() MessageType

func (*UserSignature) UnmarshalBinary

func (v *UserSignature) UnmarshalBinary(data []byte) error

func (*UserSignature) UnmarshalBinaryFrom

func (v *UserSignature) UnmarshalBinaryFrom(rd io.Reader) error

func (*UserSignature) UnmarshalFieldsFrom

func (v *UserSignature) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*UserSignature) UnmarshalJSON

func (v *UserSignature) UnmarshalJSON(data []byte) error

type UserTransaction

type UserTransaction struct {
	Transaction *protocol.Transaction `json:"transaction,omitempty" form:"transaction" query:"transaction" validate:"required"`
	// contains filtered or unexported fields
}

func (*UserTransaction) Copy

func (v *UserTransaction) Copy() *UserTransaction

func (*UserTransaction) CopyAsInterface

func (v *UserTransaction) CopyAsInterface() interface{}

func (*UserTransaction) Equal

func (v *UserTransaction) Equal(u *UserTransaction) bool

func (*UserTransaction) GetTransaction

func (m *UserTransaction) GetTransaction() *protocol.Transaction

func (*UserTransaction) Hash

func (m *UserTransaction) Hash() [32]byte

func (*UserTransaction) ID

func (m *UserTransaction) ID() *url.TxID

func (*UserTransaction) IsValid

func (v *UserTransaction) IsValid() error

func (*UserTransaction) MarshalBinary

func (v *UserTransaction) MarshalBinary() ([]byte, error)

func (*UserTransaction) MarshalJSON

func (v *UserTransaction) MarshalJSON() ([]byte, error)

func (*UserTransaction) Type

func (*UserTransaction) Type() MessageType

func (*UserTransaction) UnmarshalBinary

func (v *UserTransaction) UnmarshalBinary(data []byte) error

func (*UserTransaction) UnmarshalBinaryFrom

func (v *UserTransaction) UnmarshalBinaryFrom(rd io.Reader) error

func (*UserTransaction) UnmarshalFieldsFrom

func (v *UserTransaction) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*UserTransaction) UnmarshalJSON

func (v *UserTransaction) UnmarshalJSON(data []byte) error

type ValidatorSignature

type ValidatorSignature struct {
	Signature protocol.KeySignature `json:"signature,omitempty" form:"signature" query:"signature" validate:"required"`
	Source    *url.URL              `json:"source,omitempty" form:"source" query:"source" validate:"required"`
	// contains filtered or unexported fields
}

func (*ValidatorSignature) Copy

func (*ValidatorSignature) CopyAsInterface

func (v *ValidatorSignature) CopyAsInterface() interface{}

func (*ValidatorSignature) Equal

func (*ValidatorSignature) GetSignature

func (m *ValidatorSignature) GetSignature() protocol.Signature

func (*ValidatorSignature) GetTxID

func (m *ValidatorSignature) GetTxID() *url.TxID

func (*ValidatorSignature) Hash

func (m *ValidatorSignature) Hash() [32]byte

func (*ValidatorSignature) ID

func (m *ValidatorSignature) ID() *url.TxID

func (*ValidatorSignature) IsValid

func (v *ValidatorSignature) IsValid() error

func (*ValidatorSignature) MarshalBinary

func (v *ValidatorSignature) MarshalBinary() ([]byte, error)

func (*ValidatorSignature) MarshalJSON

func (v *ValidatorSignature) MarshalJSON() ([]byte, error)

func (*ValidatorSignature) Type

func (*ValidatorSignature) UnmarshalBinary

func (v *ValidatorSignature) UnmarshalBinary(data []byte) error

func (*ValidatorSignature) UnmarshalBinaryFrom

func (v *ValidatorSignature) UnmarshalBinaryFrom(rd io.Reader) error

func (*ValidatorSignature) UnmarshalFieldsFrom

func (v *ValidatorSignature) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*ValidatorSignature) UnmarshalJSON

func (v *ValidatorSignature) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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