ipldgen

package
v0.0.0-...-3423c7d Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package ipldgen transforms Solana ledger data into IPLD DAGs.

Index

Constants

View Source
const (
	// SolanaTx is canonical serialization (ledger/wire-format) of a versioned transaction.
	// Stable and upgradable format, unlikely to change soon.
	SolanaTx = 0xc00001

	// RadianceTxList is a list of transactions.
	// DAG-CBOR, non-standard.
	RadianceTxList = 0xc00102

	// RadianceEntry is a representation of a Solana entry, with extra data.
	// DAG-CBOR, non-standard.
	RadianceEntry = 0xc00103

	// RadianceBlock describes a slot and points to entries.
	// DAG-CBOR, non-standard.
	RadianceBlock = 0xc00104
)

Multicodec IDs of Solana-related IPLD blocks.

View Source
const CIDLen = 39

CIDLen is the serialized size in bytes of a Solana/Radiance CID.

View Source
const TargetBlockSize = 1 << 19

TargetBlockSize is the target size of variable-length IPLD blocks (e.g. link lists). Don't set this to the IPFS max block size, as we might overrun by a few kB.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockAssembler

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

func NewBlockAssembler

func NewBlockAssembler(writer car.OutStream, slot uint64) *BlockAssembler

func (*BlockAssembler) Finish

func (b *BlockAssembler) Finish() (link cidlink.Link, err error)

Finish appends block metadata to the CAR and returns the root CID.

func (*BlockAssembler) WriteEntry

func (b *BlockAssembler) WriteEntry(entry shred.Entry, pos EntryPos) error

WriteEntry appends a ledger entry to the CAR.

type EntryPos

type EntryPos struct {
	Slot       uint64
	EntryIndex int
	Batch      int
	BatchIndex int
	LastShred  int
}

type TxListAssembler

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

TxListAssembler produces a Merkle tree of transactions with wide branches.

func NewTxListAssembler

func NewTxListAssembler(writer car.OutStream) TxListAssembler

func (TxListAssembler) Assemble

func (t TxListAssembler) Assemble(txs []solana.Transaction) (datamodel.Node, error)

Assemble produces a transaction list DAG and returns the root node.

Jump to

Keyboard shortcuts

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