turbine

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicateShred = errors.New("duplicate data shred")
	ErrSlotIncomplete = errors.New("slot incomplete")
	ErrSlotOverflow   = errors.New("slot has too many data shreds")
)
View Source
var (
	ErrShortShred         = errors.New("short shred packet")
	ErrUnsupportedShred   = errors.New("unsupported shred variant")
	ErrInvalidDataShred   = errors.New("invalid data shred")
	ErrCodingShredIgnored = errors.New("coding shred ignored")
	ErrInvalidSignature   = errors.New("invalid shred signature")
)

Functions

func BlockFromEntries

func BlockFromEntries(slot uint64, parentSlot uint64, entries []Entry) *block.Block

Types

type Entry

type Entry struct {
	NumHashes uint64
	Hash      solana.Hash
	Txns      []solana.Transaction
}

func DecodeEntriesFromDataShreds

func DecodeEntriesFromDataShreds(shreds []*Shred) ([]Entry, error)

func (*Entry) UnmarshalWithDecoder

func (e *Entry) UnmarshalWithDecoder(decoder *bin.Decoder) error

type LeaderForSlotFunc

type LeaderForSlotFunc func(slot uint64) (solana.PublicKey, bool)

type ReceiverStats

type ReceiverStats struct {
	Packets          uint64
	DataShreds       uint64
	CodingShreds     uint64
	ParseErrors      uint64
	SignatureErrors  uint64
	MissingLeaders   uint64
	AssemblyErrors   uint64
	BlocksEmitted    uint64
	RecoveredData    uint64
	EvictedSlots     uint64
	IgnoredOldShreds uint64
	Repair           RepairStats
	LastPacketUnix   int64
	LastDataSlot     uint64
	LastBlockSlot    uint64
	ActiveSlots      int
}

type RepairPeerSource

type RepairPeerSource func() []gossip.RepairPeer

type RepairStats

type RepairStats struct {
	Requests    uint64
	Responses   uint64
	Timeouts    uint64
	Pings       uint64
	Pongs       uint64
	Errors      uint64
	Outstanding int
	Peers       int
}

type Shred

type Shred struct {
	Signature   solana.Signature
	Variant     byte
	Type        ShredType
	Slot        uint64
	Index       uint32
	Version     uint16
	FECSetIndex uint32

	ParentOffset uint16
	Flags        byte
	Data         []byte
	Payload      []byte

	NumDataShreds   uint16
	NumCodingShreds uint16
	Position        uint16
	Recovered       bool
}

func ParseShred

func ParseShred(packet []byte) (*Shred, error)

func (*Shred) DataComplete

func (s *Shred) DataComplete() bool

func (*Shred) LastInSlot

func (s *Shred) LastInSlot() bool

func (*Shred) MerkleRoot

func (s *Shred) MerkleRoot() (solana.Hash, error)

func (*Shred) ParentSlot

func (s *Shred) ParentSlot() uint64

func (*Shred) ReferenceTick

func (s *Shred) ReferenceTick() byte

func (*Shred) VerifySignature

func (s *Shred) VerifySignature(leader solana.PublicKey) error

type ShredType

type ShredType uint8
const (
	ShredTypeData ShredType = iota
	ShredTypeCode
)

type SlotAssembler

type SlotAssembler struct {
	// contains filtered or unexported fields
}

func NewSlotAssembler

func NewSlotAssembler() *SlotAssembler

func (*SlotAssembler) ActiveSlots

func (a *SlotAssembler) ActiveSlots() int

func (*SlotAssembler) AddPacket

func (a *SlotAssembler) AddPacket(packet []byte) (*block.Block, error)

func (*SlotAssembler) AddShred

func (a *SlotAssembler) AddShred(shred *Shred) (*block.Block, error)

func (*SlotAssembler) CompleteSlot

func (a *SlotAssembler) CompleteSlot(slot uint64) (*block.Block, error)

func (*SlotAssembler) EvictedSlots

func (a *SlotAssembler) EvictedSlots() uint64

func (*SlotAssembler) IgnoredOldShreds

func (a *SlotAssembler) IgnoredOldShreds() uint64

func (*SlotAssembler) RecoveredDataShreds

func (a *SlotAssembler) RecoveredDataShreds() uint64

func (*SlotAssembler) RepairRequests

func (a *SlotAssembler) RepairRequests(maxSlots int, maxMissingPerSlot int) []SlotRepairRequest

type SlotRepairRequest

type SlotRepairRequest struct {
	Slot                  uint64
	MissingDataShreds     []uint32
	NeedHighestDataShred  bool
	HighestDataShredIndex uint32
}

type UDPReceiver

type UDPReceiver struct {
	Addr string
	// contains filtered or unexported fields
}

func NewUDPReceiver

func NewUDPReceiver(addr string) *UDPReceiver

func (*UDPReceiver) Blocks

func (r *UDPReceiver) Blocks() <-chan *block.Block

func (*UDPReceiver) Errors

func (r *UDPReceiver) Errors() <-chan error

func (*UDPReceiver) Ready

func (r *UDPReceiver) Ready() <-chan error

func (*UDPReceiver) Run

func (r *UDPReceiver) Run(ctx context.Context) error

func (*UDPReceiver) SetLeaderForSlot

func (r *UDPReceiver) SetLeaderForSlot(fn LeaderForSlotFunc)

func (*UDPReceiver) SetRepairPeerSource

func (r *UDPReceiver) SetRepairPeerSource(identity ed25519.PrivateKey, source func() []gossip.RepairPeer) error

func (*UDPReceiver) Stats

func (r *UDPReceiver) Stats() ReceiverStats

Jump to

Keyboard shortcuts

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