payload

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: Apache-2.0, BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const MaxSize = 65536 - 1172

MaxSize = MaxBlockSize -

                   (version(1) + parentsBlocksCount(1) + 3 * (parentsType(1) + parentsCount(1) + 8 * reference(40)) +
		      issuerPK(32) + issuanceTime(8) + seqNum(8) + payloadLength(4) +
		  + EI(8) + ECR(32) + PrevEC(32) + LatestConfirmedEpoch(8)
		  + nonce(8) + signature(64)
		      = MaxBlockSize - 1172 bytes = 64364

Variables

View Source
var GenericDataPayloadType = NewType(0, "GenericDataPayloadType")

GenericDataPayloadType is the Type of a generic GenericDataPayload.

Functions

This section is empty.

Types

type GenericDataPayload

type GenericDataPayload struct {
	model.Immutable[GenericDataPayload, *GenericDataPayload, genericDataPayloadInner] `serix:"0"`
}

GenericDataPayload represents a payload which just contains a blob of data.

func NewGenericDataPayload

func NewGenericDataPayload(data []byte) *GenericDataPayload

NewGenericDataPayload creates new GenericDataPayload.

func (*GenericDataPayload) Blob

func (g *GenericDataPayload) Blob() []byte

Blob returns the contained data of the GenericDataPayload (without its type and size headers).

func (*GenericDataPayload) Type

func (g *GenericDataPayload) Type() Type

Type returns the Type of the Payload.

type Payload

type Payload interface {
	// Type returns the Type of the Payload.
	Type() Type

	// Bytes returns a marshaled version of the Payload.
	Bytes() ([]byte, error)

	// String returns a human readable version of the Payload.
	String() string
}

Payload represents the generic interface for an object that can be embedded in Blocks of the Tangle.

func FromBytes

func FromBytes(data []byte) (payloadDecoded Payload, consumedBytes int, err error)

FromBytes unmarshals a Payload from a sequence of bytes.

type Type

type Type uint32

Type represents the Type of a payload.

func NewType

func NewType(typeNumber uint32, typeName string) (payloadType Type)

NewType creates and registers a new payload Type.

func (Type) Bytes

func (t Type) Bytes() (bytes []byte)

Bytes returns a marshaled version of the Type.

func (Type) String

func (t Type) String() string

String returns a human-readable version of the Type for debug purposes.

Jump to

Keyboard shortcuts

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