shred

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LegacyHeaderSize  = 88
	LegacyPayloadSize = 1228
)
View Source
const (
	LegacyCodeID = uint8(0b0101_1010)
	LegacyDataID = uint8(0b1010_0101)
	MerkleMask   = uint8(0xF0)
	MerkleCodeID = uint8(0x40)
	MerkleDataID = uint8(0x80)
)
View Source
const (
	FlagShredTickReferenceMask = uint8(0b0011_1111)
	FlagDataCompleteShred      = uint8(0b0100_0000)
	FlagLastShredInSlot        = uint8(0b1100_0000)
)

Variables

View Source
var ErrTooFewDataShreds = errors.New("too few data shreds")

Functions

func Deshred

func Deshred(shreds []Shred) ([]byte, error)

Types

type CommonHeader

type CommonHeader struct {
	Signature   solana.Signature
	Variant     uint8
	Slot        uint64
	Index       uint32
	Version     uint16
	FECSetIndex uint32
}

type DataHeader

type DataHeader struct {
	ParentOffset uint16
	Flags        uint8
	Size         uint16
}

func (*DataHeader) LastInSlot

func (d *DataHeader) LastInSlot() bool

type LegacyCode

type LegacyCode struct {
	Common  CommonHeader
	Payload []byte
}

func LegacyCodeFromPayload

func LegacyCodeFromPayload(shred []byte) *LegacyCode

func (*LegacyCode) CommonHeader

func (s *LegacyCode) CommonHeader() *CommonHeader

func (*LegacyCode) Data

func (s *LegacyCode) Data() ([]byte, bool)

func (*LegacyCode) DataComplete

func (s *LegacyCode) DataComplete() bool

func (*LegacyCode) DataHeader

func (s *LegacyCode) DataHeader() *DataHeader

type LegacyData

type LegacyData struct {
	Common  CommonHeader
	Header  DataHeader
	Payload []byte
}

func LegacyDataFromPayload

func LegacyDataFromPayload(shred []byte) *LegacyData

func (*LegacyData) CommonHeader

func (s *LegacyData) CommonHeader() *CommonHeader

func (*LegacyData) Data

func (s *LegacyData) Data() ([]byte, bool)

func (*LegacyData) DataComplete

func (s *LegacyData) DataComplete() bool

func (*LegacyData) DataHeader

func (s *LegacyData) DataHeader() *DataHeader

func (*LegacyData) ReferenceTick

func (s *LegacyData) ReferenceTick() uint8

type MerkleCode

type MerkleCode struct {
	Common CommonHeader
}

func MerkleCodeFromPayload

func MerkleCodeFromPayload(shred []byte) *MerkleCode

func (*MerkleCode) CommonHeader

func (s *MerkleCode) CommonHeader() *CommonHeader

func (*MerkleCode) Data

func (s *MerkleCode) Data() ([]byte, bool)

func (*MerkleCode) DataComplete

func (s *MerkleCode) DataComplete() bool

func (*MerkleCode) DataHeader

func (s *MerkleCode) DataHeader() *DataHeader

type MerkleData

type MerkleData struct {
	Common CommonHeader
	Header DataHeader
}

func MerkleDataFromPayload

func MerkleDataFromPayload(shred []byte) *MerkleData

func (*MerkleData) CommonHeader

func (s *MerkleData) CommonHeader() *CommonHeader

func (*MerkleData) Data

func (s *MerkleData) Data() ([]byte, bool)

func (*MerkleData) DataComplete

func (s *MerkleData) DataComplete() bool

func (*MerkleData) DataHeader

func (s *MerkleData) DataHeader() *DataHeader

type Shred

type Shred interface {
	CommonHeader() *CommonHeader
	DataHeader() *DataHeader
	Data() ([]byte, bool)
	DataComplete() bool
}

func NewShredFromSerialized

func NewShredFromSerialized(shred []byte) Shred

Jump to

Keyboard shortcuts

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