Documentation ¶
Index ¶
- func EOSNameColumnItem(row bigtable.Row, familyColumn string) (eos.Name, error)
- func New(dsnString string, opts ...eosdb.Option) (eosdb.Driver, error)
- type AccountCreator
- type AccountResponse
- type AccountsTable
- func (tbl *AccountsTable) ParallelStreamRows(ctx context.Context, rowRanges []bigtable.RowSet, concurrentReadCount uint32, ...) error
- func (tbl *AccountsTable) PutCreator(key string, name string, data json.RawMessage)
- func (tbl *AccountsTable) PutMetaExists(key string)
- func (tbl *AccountsTable) PutPermissionLinks(key string, data json.RawMessage)
- func (tbl *AccountsTable) PutVerification(key string, property string, data json.RawMessage)
- func (tbl *AccountsTable) StreamRows(ctx context.Context, rowRange bigtable.RowSet, ...) error
- type BlocksTable
- func (tbl *BlocksTable) ParseRowAs(row bigtable.Row) (*pbcodec.BlockWithRefs, error)
- func (tbl *BlocksTable) PutBlock(key string, block *pbcodec.Block)
- func (tbl *BlocksTable) PutMetaIrreversible(key string, irreversible bool)
- func (tbl *BlocksTable) PutMetaWritten(key string)
- func (tbl *BlocksTable) PutTransactionRefs(key string, refs *pbcodec.TransactionRefs)
- func (tbl *BlocksTable) PutTransactionTraceRefs(key string, refs *pbcodec.TransactionRefs)
- func (tbl *BlocksTable) ReadIrrCell(ctx context.Context, rowRange bigtable.RowSet, opts ...bigtable.ReadOption) (out []*pbcodec.BlockWithRefs, err error)
- func (tbl *BlocksTable) ReadRows(ctx context.Context, rowRange bigtable.RowSet, opts ...bigtable.ReadOption) (out []*pbcodec.BlockWithRefs, err error)
- type EOSDatabase
- func (b *EOSDatabase) BlockIDAfter(ctx context.Context, blockTime time.Time, inclusive bool) (id string, foundTime time.Time, err error)
- func (b *EOSDatabase) BlockIDAt(ctx context.Context, blockTime time.Time) (id string, err error)
- func (b *EOSDatabase) BlockIDBefore(ctx context.Context, blockTime time.Time, inclusive bool) (id string, foundTime time.Time, err error)
- func (b *EOSDatabase) GetAccount(ctx context.Context, accountName string) (*pbcodec.AccountCreationRef, error)
- func (b *EOSDatabase) GetBlock(ctx context.Context, blockID string) (*pbcodec.BlockWithRefs, error)
- func (b *EOSDatabase) GetBlockByNum(ctx context.Context, blockNum uint32) ([]*pbcodec.BlockWithRefs, error)
- func (b *EOSDatabase) GetClosestIrreversibleIDAtBlockNum(ctx context.Context, blockNum uint32) (bstream.BlockRef, error)
- func (b *EOSDatabase) GetIrreversibleIDAtBlockID(ctx context.Context, ID string) (bstream.BlockRef, error)
- func (b *EOSDatabase) GetLastWrittenBlockID(ctx context.Context) (out string, err error)
- func (db *EOSDatabase) GetLastWrittenIrreversibleBlockRef(ctx context.Context) (ref bstream.BlockRef, err error)
- func (b *EOSDatabase) GetTransactionEvents(ctx context.Context, idPrefix string) ([]*pbcodec.TransactionEvent, error)
- func (b *EOSDatabase) GetTransactionEventsBatch(ctx context.Context, idPrefixes []string) ([][]*pbcodec.TransactionEvent, error)
- func (b *EOSDatabase) GetTransactionRow(ctx context.Context, idPrefix string) (*TransactionRow, error)
- func (b *EOSDatabase) GetTransactionTraces(ctx context.Context, idPrefix string) (out []*pbcodec.TransactionEvent, err error)
- func (b *EOSDatabase) GetTransactionTracesBatch(ctx context.Context, idPrefixes []string) (out [][]*pbcodec.TransactionEvent, err error)
- func (b *EOSDatabase) GetTransactions(ctx context.Context, ids []string, chainDiscriminator eosdb.ChainDiscriminator) (out []*pbcodec.TransactionLifecycle, err error)
- func (b *EOSDatabase) ListAccountNames(ctx context.Context, concurrentReadCount uint32) ([]string, error)
- func (b *EOSDatabase) ListBlocks(ctx context.Context, startBlockNum uint32, limit int) ([]*pbcodec.BlockWithRefs, error)
- func (b *EOSDatabase) ListBlocksRange(ctx context.Context, blockNumStart uint32, blockNumEnd uint32) ([]*pbcodec.BlockWithRefs, error)
- func (b *EOSDatabase) ListSiblingBlocks(ctx context.Context, blockNum uint32, spread uint32) ([]*pbcodec.BlockWithRefs, error)
- func (b *EOSDatabase) ListTransactionsForBlockID(ctx context.Context, blockID string, startKey string, limit int) (out *mdl.TransactionList, err error)
- func (db *EOSDatabase) PutBlock(ctx context.Context, blk *pbcodec.Block) error
- func (b *EOSDatabase) SetWriterChainID(chainID []byte)
- func (b *EOSDatabase) StartSpan(ctx context.Context, name string, attributes ...trace.Attribute) (context.Context, *trace.Span)
- func (db *EOSDatabase) UpdateNowIrreversibleBlock(ctx context.Context, blk *pbcodec.Block) error
- type Keyer
- func (Keyer) Account(account uint64) string
- func (Keyer) AccountLink(creator, created uint64) string
- func (Keyer) Block(blockID string) string
- func (Keyer) ReadAccount(key string) (account uint64, err error)
- func (Keyer) ReadAccountLink(key string) (creator, created uint64, err error)
- func (Keyer) ReadBlock(key string) (blockID string)
- func (Keyer) ReadTimelineBlock(key string, reversed bool) (blockTime time.Time, blockID string, err error)
- func (Keyer) ReadTimelineBlockForward(key string) (blockTime time.Time, blockID string, err error)
- func (Keyer) ReadTimelineBlockReverse(key string) (blockTime time.Time, blockID string, err error)
- func (Keyer) ReadTransaction(key string) (transactionID, blockID string, err error)
- func (Keyer) TimelineBlockForward(blockTime time.Time, blockID string) string
- func (Keyer) TimelineBlockReverse(blockTime time.Time, blockID string) string
- func (Keyer) Transaction(transactionID, blockID string) string
- func (Keyer) TransactionPrefix(transactionID string) string
- type TimelineTable
- type TransactionRow
- type TransactionsTable
- func (tbl *TransactionsTable) ParseRowAs(row bigtable.Row) (*TransactionRow, error)
- func (tbl *TransactionsTable) PutBlockHeader(key string, header *pbcodec.BlockHeader)
- func (tbl *TransactionsTable) PutDTrxCanceledBy(key string, extDTrxOp *pbcodec.ExtDTrxOp)
- func (tbl *TransactionsTable) PutDTrxCreatedBy(key string, extDTrxOp *pbcodec.ExtDTrxOp)
- func (tbl *TransactionsTable) PutMetaIrreversible(key string, irreversible bool)
- func (tbl *TransactionsTable) PutMetaWritten(key string, written bool)
- func (tbl *TransactionsTable) PutPublicKeys(key string, publicKeys []string)
- func (tbl *TransactionsTable) PutTrace(key string, trace *pbcodec.TransactionTrace)
- func (tbl *TransactionsTable) PutTrx(key string, trx *pbcodec.SignedTransaction)
- func (tbl *TransactionsTable) ReadEvents(ctx context.Context, rowRange bigtable.RowSet, opts ...bigtable.ReadOption) (out []*pbcodec.TransactionEvent, err error)
- func (tbl *TransactionsTable) ReadRows(ctx context.Context, rowRange bigtable.RowSet, opts ...bigtable.ReadOption) (out []*TransactionRow, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EOSNameColumnItem ¶
Types ¶
type AccountCreator ¶
type AccountResponse ¶
type AccountResponse struct { Name eos.Name CreatorName eos.Name Creator *AccountCreator }
type AccountsTable ¶
type AccountsTable struct { *basebigt.BaseTable ColMetaExists string ColCreatorName string ColCreatorJSON string ColPermissionLinks string FamilyVerification string }
func NewAccountsTable ¶
func NewAccountsTable(name string, client *bigtable.Client) *AccountsTable
func (*AccountsTable) ParallelStreamRows ¶
func (tbl *AccountsTable) ParallelStreamRows( ctx context.Context, rowRanges []bigtable.RowSet, concurrentReadCount uint32, processor func(row *AccountResponse) bool, opts ...bigtable.ReadOption, ) error
func (*AccountsTable) PutCreator ¶
func (tbl *AccountsTable) PutCreator(key string, name string, data json.RawMessage)
func (*AccountsTable) PutMetaExists ¶
func (tbl *AccountsTable) PutMetaExists(key string)
func (*AccountsTable) PutPermissionLinks ¶
func (tbl *AccountsTable) PutPermissionLinks(key string, data json.RawMessage)
func (*AccountsTable) PutVerification ¶
func (tbl *AccountsTable) PutVerification(key string, property string, data json.RawMessage)
func (*AccountsTable) StreamRows ¶
func (tbl *AccountsTable) StreamRows( ctx context.Context, rowRange bigtable.RowSet, processor func(row *AccountResponse) bool, opts ...bigtable.ReadOption, ) error
type BlocksTable ¶
type BlocksTable struct { *basebigt.BaseTable ColBlock string ColMetaWritten string ColMetaIrreversible string ColTransactionRefs string ColTransactionTraceRefs string }
func NewBlocksTable ¶
func NewBlocksTable(name string, client *bigtable.Client) *BlocksTable
func (*BlocksTable) ParseRowAs ¶
func (tbl *BlocksTable) ParseRowAs(row bigtable.Row) (*pbcodec.BlockWithRefs, error)
func (*BlocksTable) PutBlock ¶
func (tbl *BlocksTable) PutBlock(key string, block *pbcodec.Block)
PutBlock will strip the Header, Transactions and TransactionTraces from the block so you should put them separately.
**Warning** This method is not concurrent safe! While in the method, we assume full
control of the passed `block` instance. You are responsible for ensuring this preconditions holds.
func (*BlocksTable) PutMetaIrreversible ¶
func (tbl *BlocksTable) PutMetaIrreversible(key string, irreversible bool)
func (*BlocksTable) PutMetaWritten ¶
func (tbl *BlocksTable) PutMetaWritten(key string)
func (*BlocksTable) PutTransactionRefs ¶
func (tbl *BlocksTable) PutTransactionRefs(key string, refs *pbcodec.TransactionRefs)
func (*BlocksTable) PutTransactionTraceRefs ¶
func (tbl *BlocksTable) PutTransactionTraceRefs(key string, refs *pbcodec.TransactionRefs)
func (*BlocksTable) ReadIrrCell ¶
func (tbl *BlocksTable) ReadIrrCell(ctx context.Context, rowRange bigtable.RowSet, opts ...bigtable.ReadOption) (out []*pbcodec.BlockWithRefs, err error)
func (*BlocksTable) ReadRows ¶
func (tbl *BlocksTable) ReadRows(ctx context.Context, rowRange bigtable.RowSet, opts ...bigtable.ReadOption) (out []*pbcodec.BlockWithRefs, err error)
type EOSDatabase ¶
type EOSDatabase struct { *basebigt.Bigtable Accounts *AccountsTable Transactions *TransactionsTable Blocks *BlocksTable BlocksLast *BlocksTable // Flushed last, w/ "written" marker for write completion. Timeline *TimelineTable // contains filtered or unexported fields }
func NewDriver ¶
func NewDriver(tablePrefix, project, instance string, createTables bool, maxDurationBeforeFlush time.Duration, maxBlocksBeforeFlush uint64, opts ...option.ClientOption) (*EOSDatabase, error)
func NewWithClient ¶
func NewWithClient(tablePrefix string, client *bigtable.Client) *EOSDatabase
func (*EOSDatabase) BlockIDAfter ¶
func (*EOSDatabase) BlockIDBefore ¶
func (*EOSDatabase) GetAccount ¶
func (b *EOSDatabase) GetAccount(ctx context.Context, accountName string) (*pbcodec.AccountCreationRef, error)
func (*EOSDatabase) GetBlock ¶
func (b *EOSDatabase) GetBlock(ctx context.Context, blockID string) (*pbcodec.BlockWithRefs, error)
func (*EOSDatabase) GetBlockByNum ¶
func (b *EOSDatabase) GetBlockByNum(ctx context.Context, blockNum uint32) ([]*pbcodec.BlockWithRefs, error)
func (*EOSDatabase) GetClosestIrreversibleIDAtBlockNum ¶
func (b *EOSDatabase) GetClosestIrreversibleIDAtBlockNum(ctx context.Context, blockNum uint32) (bstream.BlockRef, error)
GetClosestIrreversibleIDAtBlockNum retrieves the CLOSEST irreversible block from that block num, INCLUSIVELY.
WARN: a previous version of this function was EXCLUSIVE (GetIrreversibleIDAtBlockNum), make sure the caller does `blockNum-1` if it wants to keep that behavior.
func (*EOSDatabase) GetIrreversibleIDAtBlockID ¶
func (b *EOSDatabase) GetIrreversibleIDAtBlockID(ctx context.Context, ID string) (bstream.BlockRef, error)
FIXME: Put that in CONSUMING code. It uses only public APIs from this. Belongs elsewhere.
func (*EOSDatabase) GetLastWrittenBlockID ¶
func (b *EOSDatabase) GetLastWrittenBlockID(ctx context.Context) (out string, err error)
func (*EOSDatabase) GetLastWrittenIrreversibleBlockRef ¶
func (*EOSDatabase) GetTransactionEvents ¶
func (b *EOSDatabase) GetTransactionEvents(ctx context.Context, idPrefix string) ([]*pbcodec.TransactionEvent, error)
func (*EOSDatabase) GetTransactionEventsBatch ¶
func (b *EOSDatabase) GetTransactionEventsBatch(ctx context.Context, idPrefixes []string) ([][]*pbcodec.TransactionEvent, error)
GetTransactionEventsBatch retrieves all events for each transaction listed in `idPrefixes`. It is the caller's responsibility to decide whether it wants Irreversible only, by using `pbcodec.MergeTransactionEvents()` for example.
func (*EOSDatabase) GetTransactionRow ¶
func (b *EOSDatabase) GetTransactionRow(ctx context.Context, idPrefix string) (*TransactionRow, error)
FIXME: delete this, no one calls it anymore. The TransactionEvent took prcedence over that.
func (*EOSDatabase) GetTransactionTraces ¶
func (b *EOSDatabase) GetTransactionTraces(ctx context.Context, idPrefix string) (out []*pbcodec.TransactionEvent, err error)
func (*EOSDatabase) GetTransactionTracesBatch ¶
func (b *EOSDatabase) GetTransactionTracesBatch(ctx context.Context, idPrefixes []string) (out [][]*pbcodec.TransactionEvent, err error)
func (*EOSDatabase) GetTransactions ¶
func (b *EOSDatabase) GetTransactions(ctx context.Context, ids []string, chainDiscriminator eosdb.ChainDiscriminator) (out []*pbcodec.TransactionLifecycle, err error)
FIXME: delete this, it's used by `eosws`, but see how it can NOT use it anymore. This should be replaced by `GetTransactionEventsBatch` and Merged like the other ones. Hopefully there's no difference (check in `eosws`).
func (*EOSDatabase) ListAccountNames ¶
func (*EOSDatabase) ListBlocks ¶
func (b *EOSDatabase) ListBlocks(ctx context.Context, startBlockNum uint32, limit int) ([]*pbcodec.BlockWithRefs, error)
func (*EOSDatabase) ListBlocksRange ¶
func (b *EOSDatabase) ListBlocksRange(ctx context.Context, blockNumStart uint32, blockNumEnd uint32) ([]*pbcodec.BlockWithRefs, error)
func (*EOSDatabase) ListSiblingBlocks ¶
func (b *EOSDatabase) ListSiblingBlocks(ctx context.Context, blockNum uint32, spread uint32) ([]*pbcodec.BlockWithRefs, error)
func (*EOSDatabase) ListTransactionsForBlockID ¶
func (b *EOSDatabase) ListTransactionsForBlockID( ctx context.Context, blockID string, startKey string, limit int, ) (out *mdl.TransactionList, err error)
FIXME: this belongs to the caller, not to the KVDB interface. This is client code, using `GetBlock` and `GetTransactionTraces`, outside the app context. The `mdl.TransactionList` belongs to `eosws` and not here.
func (*EOSDatabase) PutBlock ¶
TODO we should lowercase all methods under db.Blocks or itself to prevent people from not getting the autoflush TODO get context right here
func (*EOSDatabase) SetWriterChainID ¶
func (b *EOSDatabase) SetWriterChainID(chainID []byte)
func (*EOSDatabase) UpdateNowIrreversibleBlock ¶
type Keyer ¶
type Keyer struct{}
var Keys Keyer
func (Keyer) AccountLink ¶
func (Keyer) ReadAccountLink ¶
func (Keyer) ReadTimelineBlock ¶
func (Keyer) ReadTimelineBlockForward ¶
func (Keyer) ReadTimelineBlockReverse ¶
func (Keyer) ReadTransaction ¶
func (Keyer) TimelineBlockForward ¶
timeline
func (Keyer) TimelineBlockReverse ¶
func (Keyer) Transaction ¶
func (Keyer) TransactionPrefix ¶
type TimelineTable ¶
func NewTimelineTable ¶
func NewTimelineTable(name string, client *bigtable.Client) *TimelineTable
func (*TimelineTable) PutMetaExists ¶
func (tbl *TimelineTable) PutMetaExists(key string)
type TransactionRow ¶
type TransactionRow struct { // TODO: Replace Key usage by `ID` and `BlockID`.. Key is an intricacy // of Bigtables, shouldn't bubble outside this model. // It contains: `trx_id:block_id` as per `Keyer.ReadTransaction` Key string Transaction *pbcodec.SignedTransaction TransactionTrace *pbcodec.TransactionTrace // really: ExecutionTrace BlockHeader *pbcodec.BlockHeader PublicKeys []string CreatedBy *pbcodec.ExtDTrxOp CanceledBy *pbcodec.ExtDTrxOp Irreversible bool // TODO: phase this out, who relies on this anyway? Written bool }
type TransactionsTable ¶
type TransactionsTable struct { *basebigt.BaseTable ColTrx string ColTrace string ColDTrxCreatedBy string ColDTrxCanceledBy string ColMetaBlockHeader string ColMetaIrreversible string ColMetaPubkeys string ColMetaWritten string }
func NewTransactionsTable ¶
func NewTransactionsTable(name string, client *bigtable.Client) *TransactionsTable
func (*TransactionsTable) ParseRowAs ¶
func (tbl *TransactionsTable) ParseRowAs(row bigtable.Row) (*TransactionRow, error)
func (*TransactionsTable) PutBlockHeader ¶
func (tbl *TransactionsTable) PutBlockHeader(key string, header *pbcodec.BlockHeader)
func (*TransactionsTable) PutDTrxCanceledBy ¶
func (tbl *TransactionsTable) PutDTrxCanceledBy(key string, extDTrxOp *pbcodec.ExtDTrxOp)
func (*TransactionsTable) PutDTrxCreatedBy ¶
func (tbl *TransactionsTable) PutDTrxCreatedBy(key string, extDTrxOp *pbcodec.ExtDTrxOp)
func (*TransactionsTable) PutMetaIrreversible ¶
func (tbl *TransactionsTable) PutMetaIrreversible(key string, irreversible bool)
func (*TransactionsTable) PutMetaWritten ¶
func (tbl *TransactionsTable) PutMetaWritten(key string, written bool)
func (*TransactionsTable) PutPublicKeys ¶
func (tbl *TransactionsTable) PutPublicKeys(key string, publicKeys []string)
func (*TransactionsTable) PutTrace ¶
func (tbl *TransactionsTable) PutTrace(key string, trace *pbcodec.TransactionTrace)
func (*TransactionsTable) PutTrx ¶
func (tbl *TransactionsTable) PutTrx(key string, trx *pbcodec.SignedTransaction)
func (*TransactionsTable) ReadEvents ¶
func (tbl *TransactionsTable) ReadEvents(ctx context.Context, rowRange bigtable.RowSet, opts ...bigtable.ReadOption) (out []*pbcodec.TransactionEvent, err error)
func (*TransactionsTable) ReadRows ¶
func (tbl *TransactionsTable) ReadRows(ctx context.Context, rowRange bigtable.RowSet, opts ...bigtable.ReadOption) (out []*TransactionRow, err error)