accountsdb

package
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoAccount = errors.New("ErrNoAccount")
)

Functions

This section is empty.

Types

type AccountIndexEntry

type AccountIndexEntry struct {
	Slot   uint64
	FileId uint64
	Offset uint64
}

func BuildIndexEntriesFromAppendVecs

func BuildIndexEntriesFromAppendVecs(data []byte, fileSize uint64, slot uint64, fileId uint64) ([]solana.PublicKey, []AccountIndexEntry, []solana.PublicKey, error)

BuildIndexEntriesFromAppendVecs parses an appendvec and returns: - pubkeys: all account pubkeys - acctIdxEntries: index entries for each account - stakePubkeys: pubkeys of accounts owned by the stake program

func (AccountIndexEntry) Marshal

func (entry AccountIndexEntry) Marshal(out *[24]byte)

func (*AccountIndexEntry) Unmarshal

func (entry *AccountIndexEntry) Unmarshal(in *[24]byte)

type AccountsDb

type AccountsDb struct {
	Index            *pebble.DB
	BankHashStore    *pebble.DB
	AcctsDir         string
	LargestFileId    atomic.Uint64
	VoteAcctCache    otter.Cache[solana.PublicKey, *accounts.Account]
	CommonAcctsCache otter.Cache[solana.PublicKey, *accounts.Account]
	ProgramCache     otter.Cache[solana.PublicKey, *ProgramCacheEntry]
}

func OpenDb

func OpenDb(accountsDbDir string) (*AccountsDb, error)

func (*AccountsDb) AddProgramToCache

func (accountsDb *AccountsDb) AddProgramToCache(pubkey solana.PublicKey, programEntry *ProgramCacheEntry)

func (*AccountsDb) AllKeys

func (accountsDb *AccountsDb) AllKeys() [][]byte

func (*AccountsDb) CloseDb

func (accountsDb *AccountsDb) CloseDb()

func (*AccountsDb) GetAccount

func (accountsDb *AccountsDb) GetAccount(slot uint64, pubkey solana.PublicKey) (*accounts.Account, error)

func (*AccountsDb) GetAccountsBatch

func (db *AccountsDb) GetAccountsBatch(ctx context.Context, slot uint64, pks []solana.PublicKey) ([]*accounts.Account, error)

func (*AccountsDb) GetBankHashForSlot

func (accountsDb *AccountsDb) GetBankHashForSlot(slot uint64) ([]byte, error)

func (*AccountsDb) InitCaches

func (accountsDb *AccountsDb) InitCaches()

func (*AccountsDb) KeysBetweenPrefixes

func (accountsDb *AccountsDb) KeysBetweenPrefixes(startPrefix uint64, endPrefix uint64) []solana.PublicKey

func (*AccountsDb) MaybeGetProgramFromCache

func (accountsDb *AccountsDb) MaybeGetProgramFromCache(pubkey solana.PublicKey) (*ProgramCacheEntry, bool)

func (*AccountsDb) RemoveProgramFromCache

func (accountsDb *AccountsDb) RemoveProgramFromCache(pubkey solana.PublicKey)

func (*AccountsDb) StoreAccounts

func (accountsDb *AccountsDb) StoreAccounts(accts []*accounts.Account, slot uint64) error

func (*AccountsDb) StoreBankHashForSlot

func (accountsDb *AccountsDb) StoreBankHashForSlot(slot uint64, bankHash []byte) error

type AppendVecAccount

type AppendVecAccount struct {
	WriteVersion uint64
	DataLen      uint64
	Pubkey       solana.PublicKey
	Lamports     uint64
	RentEpoch    uint64
	Owner        solana.PublicKey
	Executable   bool
	Padding      [7]byte
	Hash         [32]byte
	Data         []byte
}

func (*AppendVecAccount) Marshal

func (acct *AppendVecAccount) Marshal(buf io.Writer) error

func (*AppendVecAccount) ToAccount

func (appendVecAcct *AppendVecAccount) ToAccount() *accounts.Account

func (*AppendVecAccount) Unmarshal

func (acct *AppendVecAccount) Unmarshal(buf io.Reader) error

type ProgramCacheEntry

type ProgramCacheEntry struct {
	Program        *sbpf.Program
	DeploymentSlot uint64
}

Jump to

Keyboard shortcuts

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