Documentation ¶
Index ¶
- type Bigtable
- type Block
- type BlockChangefeed
- type BlockChangefeedRes
- type BlockchainDB
- type Cell
- type ColIdAlreadyExists
- type Database
- type GetOp
- type Input
- type InputRes
- type MemoryBigtable
- type MemoryBlockchainDB
- func (db *MemoryBlockchainDB) DeleteTransactions(txs []*Transaction) error
- func (db *MemoryBlockchainDB) GetAssignedTransactionChangefeed(pubKey []byte) (TransactionChangefeed, error)
- func (db *MemoryBlockchainDB) GetAssignedTransactions(pubKey []byte) ([]*Transaction, error)
- func (db *MemoryBlockchainDB) GetBlockChangefeed() (BlockChangefeed, error)
- func (db *MemoryBlockchainDB) GetBlocks(blockIds [][]byte) ([]*Block, error)
- func (db *MemoryBlockchainDB) GetInputsByOutput(outputIds [][]byte) ([]*InputRes, error)
- func (db *MemoryBlockchainDB) GetOldestBlocks(start int64, limit int) ([]*Block, error)
- func (db *MemoryBlockchainDB) GetOutputs(outputIds [][]byte) ([]*OutputRes, error)
- func (db *MemoryBlockchainDB) GetRecentVotes(pubKey []byte, limit int) ([]*Vote, error)
- func (db *MemoryBlockchainDB) GetStaleTransactions(before int64) ([]*Transaction, error)
- func (db *MemoryBlockchainDB) GetVoteChangefeed() (VoteChangefeed, error)
- func (db *MemoryBlockchainDB) GetVotes(pubKey []byte, votedAt int64) ([]*Vote, error)
- func (db *MemoryBlockchainDB) SetupTables() error
- func (db *MemoryBlockchainDB) WriteBlock(b *Block) error
- func (db *MemoryBlockchainDB) WriteTransaction(tx *Transaction) error
- func (db *MemoryBlockchainDB) WriteVote(v *Vote) error
- type MemoryDatabase
- type NotFoundError
- type Output
- type OutputRes
- type PutOp
- type RethinkBigtable
- type RethinkBlockChangefeed
- type RethinkBlockchainDB
- func (db *RethinkBlockchainDB) DeleteTransactions(txs []*Transaction) error
- func (db *RethinkBlockchainDB) GetAssignedTransactionChangefeed(pubKey []byte) (TransactionChangefeed, error)
- func (db *RethinkBlockchainDB) GetAssignedTransactions(pubKey []byte) ([]*Transaction, error)
- func (db *RethinkBlockchainDB) GetBlockChangefeed() (BlockChangefeed, error)
- func (db *RethinkBlockchainDB) GetBlocks(blockIds [][]byte) ([]*Block, error)
- func (db *RethinkBlockchainDB) GetInputsByOutput(outputIds [][]byte) ([]*InputRes, error)
- func (db *RethinkBlockchainDB) GetOldestBlocks(start int64, limit int) ([]*Block, error)
- func (db *RethinkBlockchainDB) GetOutputs(outputIds [][]byte) ([]*OutputRes, error)
- func (db *RethinkBlockchainDB) GetRecentVotes(pubKey []byte, limit int) ([]*Vote, error)
- func (db *RethinkBlockchainDB) GetStaleTransactions(before int64) ([]*Transaction, error)
- func (db *RethinkBlockchainDB) GetVoteChangefeed() (VoteChangefeed, error)
- func (db *RethinkBlockchainDB) GetVotes(pubKey []byte, votedAt int64) ([]*Vote, error)
- func (db *RethinkBlockchainDB) SetupTables() error
- func (db *RethinkBlockchainDB) WriteBlock(b *Block) error
- func (db *RethinkBlockchainDB) WriteTransaction(tx *Transaction) error
- func (db *RethinkBlockchainDB) WriteVote(v *Vote) error
- type RethinkTransactionChangefeed
- type RethinkVoteChangefeed
- type RowNotFoundError
- type TableAlreadyExists
- type TableNotFoundError
- type Transaction
- type TransactionChangefeed
- type TransactionChangefeedRes
- type VerIdAlreadyExists
- type Vote
- type VoteChangefeed
- type VoteChangefeedRes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type BlockChangefeed ¶
type BlockChangefeed interface {
Next(*BlockChangefeedRes) bool
}
type BlockChangefeedRes ¶
type BlockchainDB ¶
type BlockchainDB interface { // First time setup to create required tables and indices SetupTables() error // Writes transaction to backlog table WriteTransaction(*Transaction) error // Returns transactions currently assigned to given node from backlog table GetAssignedTransactions([]byte) ([]*Transaction, error) // Returns transactions older than given time (no order) from backlog table GetStaleTransactions(int64) ([]*Transaction, error) // Deletes given transactions from backlog table DeleteTransactions([]*Transaction) error // Writes block to block table WriteBlock(*Block) error // Returns blocks from block table by block ids GetBlocks([][]byte) ([]*Block, error) // Returns k oldest blocks from block table starting at given timestamp sorted by increasing // CreatedAt timestamp. GetOldestBlocks(int64, int) ([]*Block, error) // Returns outputs for given output ids GetOutputs([][]byte) ([]*OutputRes, error) // Returns inputs for given output ids GetInputsByOutput([][]byte) ([]*InputRes, error) // Writes vote to vote table WriteVote(*Vote) error // Returns all votes for given public key from votes table with the given VotedAt GetVotes([]byte, int64) ([]*Vote, error) // Returns k most recent votes for given public key from votes table sorted by decreasing // VotedAt timestamp. GetRecentVotes([]byte, int) ([]*Vote, error) // Returns changefeed for all transactions assigned to the given public key GetAssignedTransactionChangefeed([]byte) (TransactionChangefeed, error) // Returns changefeed for all blocks GetBlockChangefeed() (BlockChangefeed, error) // Returns changefeed for all votes GetVoteChangefeed() (VoteChangefeed, error) }
type Cell ¶
func NewCellVer ¶
type ColIdAlreadyExists ¶
type ColIdAlreadyExists struct {
ColId []byte
}
func (*ColIdAlreadyExists) Error ¶
func (e *ColIdAlreadyExists) Error() string
type MemoryBigtable ¶
type MemoryBigtable struct {
// contains filtered or unexported fields
}
In memory bigtable db mainly meant for testing
func NewMemoryBigtable ¶
func NewMemoryBigtable() (*MemoryBigtable, error)
func (*MemoryBigtable) CreateTable ¶
func (bt *MemoryBigtable) CreateTable(tableName []byte) error
type MemoryBlockchainDB ¶
type MemoryBlockchainDB struct {
// contains filtered or unexported fields
}
In-memory blockchain db mainly meant for testing
func NewMemoryBlockchainDB ¶
func NewMemoryBlockchainDB() (*MemoryBlockchainDB, error)
func (*MemoryBlockchainDB) DeleteTransactions ¶
func (db *MemoryBlockchainDB) DeleteTransactions(txs []*Transaction) error
func (*MemoryBlockchainDB) GetAssignedTransactionChangefeed ¶
func (db *MemoryBlockchainDB) GetAssignedTransactionChangefeed( pubKey []byte) (TransactionChangefeed, error)
func (*MemoryBlockchainDB) GetAssignedTransactions ¶
func (db *MemoryBlockchainDB) GetAssignedTransactions(pubKey []byte) ([]*Transaction, error)
Note: This is not performant, do not use in prod
func (*MemoryBlockchainDB) GetBlockChangefeed ¶
func (db *MemoryBlockchainDB) GetBlockChangefeed() (BlockChangefeed, error)
func (*MemoryBlockchainDB) GetBlocks ¶
func (db *MemoryBlockchainDB) GetBlocks(blockIds [][]byte) ([]*Block, error)
func (*MemoryBlockchainDB) GetInputsByOutput ¶
func (db *MemoryBlockchainDB) GetInputsByOutput(outputIds [][]byte) ([]*InputRes, error)
func (*MemoryBlockchainDB) GetOldestBlocks ¶
func (db *MemoryBlockchainDB) GetOldestBlocks(start int64, limit int) ([]*Block, error)
func (*MemoryBlockchainDB) GetOutputs ¶
func (db *MemoryBlockchainDB) GetOutputs(outputIds [][]byte) ([]*OutputRes, error)
func (*MemoryBlockchainDB) GetRecentVotes ¶
func (db *MemoryBlockchainDB) GetRecentVotes(pubKey []byte, limit int) ([]*Vote, error)
func (*MemoryBlockchainDB) GetStaleTransactions ¶
func (db *MemoryBlockchainDB) GetStaleTransactions(before int64) ([]*Transaction, error)
Note: This is not performant, do not use in prod
func (*MemoryBlockchainDB) GetVoteChangefeed ¶
func (db *MemoryBlockchainDB) GetVoteChangefeed() (VoteChangefeed, error)
func (*MemoryBlockchainDB) GetVotes ¶
func (db *MemoryBlockchainDB) GetVotes(pubKey []byte, votedAt int64) ([]*Vote, error)
func (*MemoryBlockchainDB) SetupTables ¶
func (db *MemoryBlockchainDB) SetupTables() error
func (*MemoryBlockchainDB) WriteBlock ¶
func (db *MemoryBlockchainDB) WriteBlock(b *Block) error
func (*MemoryBlockchainDB) WriteTransaction ¶
func (db *MemoryBlockchainDB) WriteTransaction(tx *Transaction) error
func (*MemoryBlockchainDB) WriteVote ¶
func (db *MemoryBlockchainDB) WriteVote(v *Vote) error
type MemoryDatabase ¶
type MemoryDatabase struct {
// contains filtered or unexported fields
}
func NewMemoryDatabase ¶
func NewMemoryDatabase() (*MemoryDatabase, error)
func (*MemoryDatabase) Commit ¶
func (db *MemoryDatabase) Commit() error
func (*MemoryDatabase) Contains ¶
func (db *MemoryDatabase) Contains(key []byte) (bool, error)
Returns whether the database contains the key
func (*MemoryDatabase) Delete ¶
func (db *MemoryDatabase) Delete(key []byte) error
Delete the key from the database. Returns NotFoundError if the key does not exist.
type NotFoundError ¶
type NotFoundError struct {
Key []byte
}
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
type OutputRes ¶
type OutputRes struct { Block *Block Transaction *Transaction Output *Output }
Structure used to return the result of the GetOutputs endpoint.
type RethinkBigtable ¶
type RethinkBigtable struct {
// contains filtered or unexported fields
}
func NewRethinkBigtable ¶
func NewRethinkBigtable(addresses []string, database string) (*RethinkBigtable, error)
func (*RethinkBigtable) CreateTable ¶
func (bt *RethinkBigtable) CreateTable(tableName []byte) error
type RethinkBlockChangefeed ¶
type RethinkBlockChangefeed struct {
// contains filtered or unexported fields
}
func (*RethinkBlockChangefeed) Next ¶
func (cf *RethinkBlockChangefeed) Next(res *BlockChangefeedRes) bool
type RethinkBlockchainDB ¶
type RethinkBlockchainDB struct {
// contains filtered or unexported fields
}
func NewRethinkBlockchainDB ¶
func NewRethinkBlockchainDB(addresses []string, database string) (*RethinkBlockchainDB, error)
func (*RethinkBlockchainDB) DeleteTransactions ¶
func (db *RethinkBlockchainDB) DeleteTransactions(txs []*Transaction) error
func (*RethinkBlockchainDB) GetAssignedTransactionChangefeed ¶
func (db *RethinkBlockchainDB) GetAssignedTransactionChangefeed( pubKey []byte) (TransactionChangefeed, error)
func (*RethinkBlockchainDB) GetAssignedTransactions ¶
func (db *RethinkBlockchainDB) GetAssignedTransactions(pubKey []byte) ([]*Transaction, error)
func (*RethinkBlockchainDB) GetBlockChangefeed ¶
func (db *RethinkBlockchainDB) GetBlockChangefeed() (BlockChangefeed, error)
func (*RethinkBlockchainDB) GetBlocks ¶
func (db *RethinkBlockchainDB) GetBlocks(blockIds [][]byte) ([]*Block, error)
func (*RethinkBlockchainDB) GetInputsByOutput ¶
func (db *RethinkBlockchainDB) GetInputsByOutput(outputIds [][]byte) ([]*InputRes, error)
func (*RethinkBlockchainDB) GetOldestBlocks ¶
func (db *RethinkBlockchainDB) GetOldestBlocks(start int64, limit int) ([]*Block, error)
func (*RethinkBlockchainDB) GetOutputs ¶
func (db *RethinkBlockchainDB) GetOutputs(outputIds [][]byte) ([]*OutputRes, error)
func (*RethinkBlockchainDB) GetRecentVotes ¶
func (db *RethinkBlockchainDB) GetRecentVotes(pubKey []byte, limit int) ([]*Vote, error)
func (*RethinkBlockchainDB) GetStaleTransactions ¶
func (db *RethinkBlockchainDB) GetStaleTransactions(before int64) ([]*Transaction, error)
func (*RethinkBlockchainDB) GetVoteChangefeed ¶
func (db *RethinkBlockchainDB) GetVoteChangefeed() (VoteChangefeed, error)
func (*RethinkBlockchainDB) GetVotes ¶
func (db *RethinkBlockchainDB) GetVotes(pubKey []byte, votedAt int64) ([]*Vote, error)
func (*RethinkBlockchainDB) SetupTables ¶
func (db *RethinkBlockchainDB) SetupTables() error
func (*RethinkBlockchainDB) WriteBlock ¶
func (db *RethinkBlockchainDB) WriteBlock(b *Block) error
func (*RethinkBlockchainDB) WriteTransaction ¶
func (db *RethinkBlockchainDB) WriteTransaction(tx *Transaction) error
func (*RethinkBlockchainDB) WriteVote ¶
func (db *RethinkBlockchainDB) WriteVote(v *Vote) error
type RethinkTransactionChangefeed ¶
type RethinkTransactionChangefeed struct {
// contains filtered or unexported fields
}
func (*RethinkTransactionChangefeed) Next ¶
func (cf *RethinkTransactionChangefeed) Next(res *TransactionChangefeedRes) bool
type RethinkVoteChangefeed ¶
type RethinkVoteChangefeed struct {
// contains filtered or unexported fields
}
func (*RethinkVoteChangefeed) Next ¶
func (cf *RethinkVoteChangefeed) Next(res *VoteChangefeedRes) bool
type RowNotFoundError ¶
type RowNotFoundError struct {
RowId []byte
}
func (*RowNotFoundError) Error ¶
func (e *RowNotFoundError) Error() string
type TableAlreadyExists ¶
type TableAlreadyExists struct {
TableName []byte
}
func (*TableAlreadyExists) Error ¶
func (e *TableAlreadyExists) Error() string
type TableNotFoundError ¶
type TableNotFoundError struct {
TableName []byte
}
func (*TableNotFoundError) Error ¶
func (e *TableNotFoundError) Error() string
type Transaction ¶
type Transaction struct { Hash []byte AssignedTo []byte // Public key of node this transaction is assigned to AssignedAt *big.Int Type int TableName []byte RowId []byte Cols map[string]*Cell Outputs []*Output Inputs []*Input }
func (*Transaction) Clone ¶
func (tx *Transaction) Clone() *Transaction
type TransactionChangefeed ¶
type TransactionChangefeed interface {
Next(*TransactionChangefeedRes) bool
}
type TransactionChangefeedRes ¶
type TransactionChangefeedRes struct { OldVal *Transaction NewVal *Transaction }
type VerIdAlreadyExists ¶
func (*VerIdAlreadyExists) Error ¶
func (e *VerIdAlreadyExists) Error() string
type Vote ¶
type VoteChangefeed ¶
type VoteChangefeed interface {
Next(*VoteChangefeedRes) bool
}
type VoteChangefeedRes ¶
Click to show internal directories.
Click to hide internal directories.