Documentation ¶
Overview ¶
Package indexdb provides a Rosetta-specific index of the Flow chain data.
Index ¶
- Variables
- type AccountInfo
- type BalanceData
- type BlockData
- type Store
- func (s *Store) Accounts() (map[[8]byte]bool, error)
- func (s *Store) AccountsInfo() (map[string]*AccountInfo, error)
- func (s *Store) BalanceByHash(acct []byte, hash []byte) (*BalanceData, error)
- func (s *Store) BalanceByHeight(acct []byte, height uint64) (*BalanceData, error)
- func (s *Store) BlockByHash(hash []byte) (*BlockData, error)
- func (s *Store) BlockByHeight(height uint64) (*BlockData, error)
- func (s *Store) ExportAccounts(filename string)
- func (s *Store) Genesis() *model.BlockMeta
- func (s *Store) HasBalance(acct []byte, height uint64) (bool, error)
- func (s *Store) HashForHeight(height uint64) ([]byte, error)
- func (s *Store) HeightForHash(hash []byte) (uint64, error)
- func (s *Store) Index(ctx context.Context, height uint64, hash []byte, block *model.IndexedBlock) error
- func (s *Store) Latest() *model.BlockMeta
- func (s *Store) PurgeProxyAccounts()
- func (s *Store) ResetTo(base uint64) error
- func (s *Store) SetGenesis(val *model.BlockMeta) error
Constants ¶
This section is empty.
Variables ¶
var (
ErrBlockNotIndexed = errors.New("indexdb: block not indexed")
)
Functions ¶
This section is empty.
Types ¶
type AccountInfo ¶
type AccountInfo struct { Changes [][2]uint64 `json:"changes"` Proxy bool `json:"proxy,omitempty"` }
AccountInfo represents all the balance changes (block height, balance) for an account and whether it's a proxy account or not.
type BalanceData ¶
BalanceData represents the indexed balance of an account.
type BlockData ¶
type BlockData struct { Block *model.IndexedBlock Hash []byte Height uint64 ParentHash []byte ParentHeight uint64 }
BlockData represents the indexed data for a block.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store aggregates the blockchain data for Rosetta API calls.
func (*Store) Accounts ¶
Accounts returns the addresses of all our indexed accounts, and whether the account is a proxy account or not.
func (*Store) AccountsInfo ¶
func (s *Store) AccountsInfo() (map[string]*AccountInfo, error)
AccountsInfo will return a map of the indexed accounts and their corresponding account info.
func (*Store) BalanceByHash ¶
func (s *Store) BalanceByHash(acct []byte, hash []byte) (*BalanceData, error)
BalanceByHash returns the account balance at the given hash.
func (*Store) BalanceByHeight ¶
func (s *Store) BalanceByHeight(acct []byte, height uint64) (*BalanceData, error)
BalanceByHeight returns the account balance at the given height.
func (*Store) BlockByHash ¶
BlockByHash returns the block data for the given hash.
func (*Store) BlockByHeight ¶
BlockByHeight returns the block data for the given height.
func (*Store) ExportAccounts ¶
ExportAccounts will export a map of the indexed accounts and their corresponding account info.
func (*Store) HasBalance ¶
HasBalance returns whether the given account has an indexed balance at the given height.
func (*Store) HashForHeight ¶
HashForHeight returns the block hash at the given height.
func (*Store) HeightForHash ¶
HeightForHash returns the block height for the given hash.
func (*Store) Index ¶
func (s *Store) Index(ctx context.Context, height uint64, hash []byte, block *model.IndexedBlock) error
Index indexes the given block data.
func (*Store) PurgeProxyAccounts ¶
func (s *Store) PurgeProxyAccounts()
PurgeProxyAccounts removes any indexed account balances or proxy account creation heights from the index database.