payload

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_payload_payload_proto protoreflect.FileDescriptor

Functions

func CalculateUnpaddedSize

func CalculateUnpaddedSize(p *Payload) (int, error)

CalculateUnpaddedSize calculates the size of the passed in payload for the purpose of determining how much padding to add to add to reach the target size. CalculateUnpaddedSize returns an error if the payload Padding field is longer than 1.

func MaxUnpaddedSize

func MaxUnpaddedSize() (int, error)

MaxUnpaddedSize returns the maximum size that a payload may be if no padding is included.

func NewBytes

func NewBytes(p *Payload) ([]byte, error)

NewBytes generates a new payload and returns the encoded representation of the payload as a slice of bytes. NewBytes uses the fields on the Options to create the payload.

Types

type Payload

type Payload struct {
	Connections uint64                 `protobuf:"varint,1,opt,name=connections,proto3" json:"connections,omitempty"`
	Rate        uint64                 `protobuf:"varint,2,opt,name=rate,proto3" json:"rate,omitempty"`
	Size        uint64                 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"`
	Time        *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=time,proto3" json:"time,omitempty"`
	Id          []byte                 `protobuf:"bytes,5,opt,name=id,proto3" json:"id,omitempty"`
	Padding     []byte                 `protobuf:"bytes,6,opt,name=padding,proto3" json:"padding,omitempty"`
	// contains filtered or unexported fields
}

Payload is the structure of the loadtime transaction. Proto has a compact encoded representation, making it ideal for the loadtime usecase which aims to keep the generated transactions small.

func FromBytes

func FromBytes(b []byte) (*Payload, error)

FromBytes extracts a paylod from the byte representation of the payload. FromBytes leaves the padding untouched, returning it to the caller to handle or discard per their preference.

func (*Payload) Descriptor deprecated

func (*Payload) Descriptor() ([]byte, []int)

Deprecated: Use Payload.ProtoReflect.Descriptor instead.

func (*Payload) GetConnections

func (x *Payload) GetConnections() uint64

func (*Payload) GetId

func (x *Payload) GetId() []byte

func (*Payload) GetPadding

func (x *Payload) GetPadding() []byte

func (*Payload) GetRate

func (x *Payload) GetRate() uint64

func (*Payload) GetSize

func (x *Payload) GetSize() uint64

func (*Payload) GetTime

func (x *Payload) GetTime() *timestamppb.Timestamp

func (*Payload) ProtoMessage

func (*Payload) ProtoMessage()

func (*Payload) ProtoReflect

func (x *Payload) ProtoReflect() protoreflect.Message

func (*Payload) Reset

func (x *Payload) Reset()

func (*Payload) String

func (x *Payload) String() string

Jump to

Keyboard shortcuts

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