payload

package
v0.8.13 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: Apache-2.0, BSD-2-Clause Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MaxSize = 64378

MaxPayloadSize = MaxMessageSize -

                   (version(1) + parentsBlocksCount(1) + 4 * (parentsType(1) + parentsCount(1) + 8 * reference(32)) +
		      issuerPK(32) + issuanceTime(8) + seqNum(8) + payloadLength(4) + nonce(8) + signature(64)
		      = MaxMessageSize - 1158 bytes = 64378

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 {
	// contains filtered or unexported fields
}

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

func GenericDataPayloadFromBytes

func GenericDataPayloadFromBytes(bytes []byte) (genericDataPayload *GenericDataPayload, consumedBytes int, err error)

GenericDataPayloadFromBytes unmarshals a GenericDataPayload from a sequence of bytes.

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

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

Bytes returns a marshaled version of the Payload.

func (*GenericDataPayload) String

func (g *GenericDataPayload) String() string

String returns a human readable version of the Payload.

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

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

Payload represents the generic interface for an object that can be embedded in Messages 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