Versions in this module Expand all Collapse all v0 v0.4.1 Aug 10, 2020 Changes in this version + const ActiveReconciliationCounter + const AddressesCreatedCounter + const BlockCounter + const DefaultBfCacheSize + const DefaultCacheSize + const DefaultValueLogFileSize + const FailedBroadcastsCounter + const InactiveReconciliationCounter + const OperationCounter + const OrphanCounter + const StaleBroadcastsCounter + const TransactionCounter + const TransactionsConfirmedCounter + const TransactionsCreatedCounter + var ErrAccountNotFound = errors.New("account not found") + var ErrBlockNotFound = errors.New("block not found") + var ErrDuplicateKey = errors.New("duplicate key") + var ErrDuplicateTransactionHash = errors.New("duplicate transaction hash") + var ErrHeadBlockNotFound = errors.New("head block not found") + var ErrNegativeBalance = errors.New("negative balance") + func GetBalanceKey(account *types.AccountIdentifier, currency *types.Currency) []byte + type BadgerStorage struct + func (b *BadgerStorage) Close(ctx context.Context) error + func (b *BadgerStorage) Get(ctx context.Context, key []byte) (bool, []byte, error) + func (b *BadgerStorage) NewDatabaseTransaction(ctx context.Context, write bool) DatabaseTransaction + func (b *BadgerStorage) Scan(ctx context.Context, prefix []byte) ([][]byte, error) + func (b *BadgerStorage) Set(ctx context.Context, key []byte, value []byte) error + type BadgerTransaction struct + func (b *BadgerTransaction) Commit(context.Context) error + func (b *BadgerTransaction) Delete(ctx context.Context, key []byte) error + func (b *BadgerTransaction) Discard(context.Context) + func (b *BadgerTransaction) Get(ctx context.Context, key []byte) (bool, []byte, error) + func (b *BadgerTransaction) Set(ctx context.Context, key []byte, value []byte) error + type BalanceStorage struct + func NewBalanceStorage(db Database) *BalanceStorage + func (b *BalanceStorage) AddingBlock(ctx context.Context, block *types.Block, transaction DatabaseTransaction) (CommitWorker, error) + func (b *BalanceStorage) BootstrapBalances(ctx context.Context, bootstrapBalancesFile string, ...) error + func (b *BalanceStorage) GetAllAccountCurrency(ctx context.Context) ([]*reconciler.AccountCurrency, error) + func (b *BalanceStorage) GetBalance(ctx context.Context, account *types.AccountIdentifier, ...) (*types.Amount, *types.BlockIdentifier, error) + func (b *BalanceStorage) Initialize(helper BalanceStorageHelper, handler BalanceStorageHandler) + func (b *BalanceStorage) RemovingBlock(ctx context.Context, block *types.Block, transaction DatabaseTransaction) (CommitWorker, error) + func (b *BalanceStorage) SetBalance(ctx context.Context, dbTransaction DatabaseTransaction, ...) error + func (b *BalanceStorage) UpdateBalance(ctx context.Context, dbTransaction DatabaseTransaction, ...) error + type BalanceStorageHandler interface + BlockAdded func(ctx context.Context, block *types.Block, changes []*parser.BalanceChange) error + BlockRemoved func(ctx context.Context, block *types.Block, changes []*parser.BalanceChange) error + type BalanceStorageHelper interface + AccountBalance func(ctx context.Context, account *types.AccountIdentifier, ...) (*types.Amount, error) + Asserter func() *asserter.Asserter + ExemptFunc func() parser.ExemptOperation + type BlockStorage struct + func NewBlockStorage(db Database) *BlockStorage + func (b *BlockStorage) AddBlock(ctx context.Context, block *types.Block) error + func (b *BlockStorage) AtTip(ctx context.Context, tipDelay int64) (bool, error) + func (b *BlockStorage) CreateBlockCache(ctx context.Context) []*types.BlockIdentifier + func (b *BlockStorage) FindTransaction(ctx context.Context, transactionIdentifier *types.TransactionIdentifier, ...) (*types.BlockIdentifier, *types.Transaction, error) + func (b *BlockStorage) GetBlock(ctx context.Context, blockIdentifier *types.PartialBlockIdentifier) (*types.Block, error) + func (b *BlockStorage) GetHeadBlockIdentifier(ctx context.Context) (*types.BlockIdentifier, error) + func (b *BlockStorage) GetHeadBlockIdentifierTransactional(ctx context.Context, transaction DatabaseTransaction) (*types.BlockIdentifier, error) + func (b *BlockStorage) Initialize(workers []BlockWorker) + func (b *BlockStorage) RemoveBlock(ctx context.Context, blockIdentifier *types.BlockIdentifier) error + func (b *BlockStorage) SetNewStartIndex(ctx context.Context, startIndex int64) error + func (b *BlockStorage) StoreHeadBlockIdentifier(ctx context.Context, transaction DatabaseTransaction, ...) error + type BlockWorker interface + AddingBlock func(context.Context, *types.Block, DatabaseTransaction) (CommitWorker, error) + RemovingBlock func(context.Context, *types.Block, DatabaseTransaction) (CommitWorker, error) + type BootstrapBalance struct + Account *types.AccountIdentifier + Currency *types.Currency + Value string + type Broadcast struct + Broadcasts int + Identifier *types.TransactionIdentifier + Intent []*types.Operation + LastBroadcast *types.BlockIdentifier + Payload string + Sender string + type BroadcastStorage struct + func NewBroadcastStorage(db Database, confirmationDepth int64, staleDepth int64, broadcastLimit int, ...) *BroadcastStorage + func (b *BroadcastStorage) AddingBlock(ctx context.Context, block *types.Block, transaction DatabaseTransaction) (CommitWorker, error) + func (b *BroadcastStorage) Broadcast(ctx context.Context, sender string, intent []*types.Operation, ...) error + func (b *BroadcastStorage) BroadcastAll(ctx context.Context, onlyEligible bool) error + func (b *BroadcastStorage) ClearBroadcasts(ctx context.Context) ([]*Broadcast, error) + func (b *BroadcastStorage) GetAllBroadcasts(ctx context.Context) ([]*Broadcast, error) + func (b *BroadcastStorage) Initialize(helper BroadcastStorageHelper, handler BroadcastStorageHandler) + func (b *BroadcastStorage) LockedAddresses(ctx context.Context) ([]string, error) + func (b *BroadcastStorage) RemovingBlock(ctx context.Context, block *types.Block, transaction DatabaseTransaction) (CommitWorker, error) + type BroadcastStorageHandler interface + BroadcastFailed func(context.Context, *types.TransactionIdentifier, []*types.Operation) error + TransactionConfirmed func(context.Context, *types.BlockIdentifier, *types.Transaction, ...) error + TransactionStale func(context.Context, *types.TransactionIdentifier) error + type BroadcastStorageHelper interface + AtTip func(context.Context, int64) (bool, error) + BroadcastTransaction func(context.Context, string) (*types.TransactionIdentifier, error) + CurrentBlockIdentifier func(context.Context) (*types.BlockIdentifier, error) + FindTransaction func(context.Context, *types.TransactionIdentifier, DatabaseTransaction) (*types.BlockIdentifier, *types.Transaction, error) + type Coin struct + Identifier *types.CoinIdentifier + Operation *types.Operation + Transaction *types.Transaction + type CoinStorage struct + func NewCoinStorage(db Database, helper CoinStorageHelper, asserter *asserter.Asserter) *CoinStorage + func (c *CoinStorage) AddingBlock(ctx context.Context, block *types.Block, transaction DatabaseTransaction) (CommitWorker, error) + func (c *CoinStorage) GetCoins(ctx context.Context, accountIdentifier *types.AccountIdentifier) ([]*Coin, *types.BlockIdentifier, error) + func (c *CoinStorage) GetLargestCoin(ctx context.Context, accountIdentifier *types.AccountIdentifier, ...) (*big.Int, *types.CoinIdentifier, *types.BlockIdentifier, error) + func (c *CoinStorage) RemovingBlock(ctx context.Context, block *types.Block, transaction DatabaseTransaction) (CommitWorker, error) + type CoinStorageHelper interface + CurrentBlockIdentifier func(context.Context, DatabaseTransaction) (*types.BlockIdentifier, error) + type CommitWorker func(context.Context) error + type CounterStorage struct + func NewCounterStorage(db Database) *CounterStorage + func (c *CounterStorage) Get(ctx context.Context, counter string) (*big.Int, error) + func (c *CounterStorage) Update(ctx context.Context, counter string, amount *big.Int) (*big.Int, error) + type Database interface + Close func(context.Context) error + Get func(context.Context, []byte) (bool, []byte, error) + NewDatabaseTransaction func(context.Context, bool) DatabaseTransaction + Scan func(ctx context.Context, prefix []byte) ([][]byte, error) + Set func(context.Context, []byte, []byte) error + func NewBadgerStorage(ctx context.Context, dir string, disableMemoryLimit bool) (Database, error) + type DatabaseTransaction interface + Commit func(context.Context) error + Delete func(context.Context, []byte) error + Discard func(context.Context) + Get func(context.Context, []byte) (bool, []byte, error) + Set func(context.Context, []byte, []byte) error + type KeyStorage struct + func NewKeyStorage(db Database) *KeyStorage + func (k *KeyStorage) Get(ctx context.Context, address string) (*keys.KeyPair, error) + func (k *KeyStorage) GetAllAddresses(ctx context.Context) ([]string, error) + func (k *KeyStorage) RandomAddress(ctx context.Context) (string, error) + func (k *KeyStorage) Sign(ctx context.Context, payloads []*types.SigningPayload) ([]*types.Signature, error) + func (k *KeyStorage) Store(ctx context.Context, address string, keyPair *keys.KeyPair) error