Documentation ¶
Index ¶
- Variables
- type BlockCache
- func (bc BlockCache) Get(bid ids.BlockId) (block.Block, bool)
- func (bc BlockCache) GetTxn(tid ids.TransactionId) (transaction.Transaction, bool)
- func (bc BlockCache) Has(bid ids.BlockId) bool
- func (bc BlockCache) Load(bid ids.BlockId) (block.Block, error)
- func (bc BlockCache) LoadBlock(bid ids.BlockId) (block.Block, error)
- func (bc BlockCache) LoadParents(bid ids.BlockId) (block.Heights, error)
- func (bc BlockCache) Range(vid uint16, f func(block.Block) bool)
- func (bc BlockCache) Save(blk block.Block) error
- func (bc BlockCache) Seen(bid ids.BlockId) bool
- func (bc BlockCache) Set(bid ids.BlockId, blk block.Block)
- func (bc BlockCache) Size() uint64
- func (bc BlockCache) Tip(vid uint16) block.Block
- type Dag
- type LinearHashTable
- func (tbl *LinearHashTable) Get(key uint64) transaction.Transaction
- func (tbl *LinearHashTable) GetDups(txn transaction.Transaction) ([]transaction.Transaction, error)
- func (tbl *LinearHashTable) GetTxn(value uint64, hash transaction.TransactionHash) (transaction.Transaction, bool)
- func (tbl *LinearHashTable) Insert(txn transaction.Transaction) (bool, error)
- func (tbl *LinearHashTable) Key(value uint64) uint64
- func (tbl LinearHashTable) Print()
- func (tbl *LinearHashTable) Reset()
- type SilvermintDag
- func (dag *SilvermintDag) Add(blk block.Block) bool
- func (dag *SilvermintDag) Blocks() *BlockCache
- func (dag *SilvermintDag) CatchUpChannel() chan block.Block
- func (dag *SilvermintDag) Get(bid ids.BlockId) (block.Block, bool)
- func (dag *SilvermintDag) GetDot() string
- func (dag *SilvermintDag) Has(bid ids.BlockId) bool
- func (dag *SilvermintDag) InterpretDeltas(blk block.Block) bool
- func (dag *SilvermintDag) LeastUndeletableHeights(regs map[validator.Validator]bool) block.Heights
- func (dag *SilvermintDag) Pending() *pendingQueue
- func (dag *SilvermintDag) PrintChildMap(indent int)
- func (dag *SilvermintDag) PrintChildren(indent int, bid ids.BlockId)
- func (dag *SilvermintDag) PrintDag()
- func (dag *SilvermintDag) PrintTips()
- func (dag *SilvermintDag) Roots() block.Heights
- func (dag *SilvermintDag) Size() uint64
- func (dag *SilvermintDag) Tip(vid uint16) ids.BlockId
Constants ¶
This section is empty.
Variables ¶
var ( DagBlocksRejected = prometheus.NewCounter(prometheus.CounterOpts{ Name: "casanova_dag_blocks_rejected_total", Help: "Number of blocks rejected.", }) DagMicroVec = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "dag_usec_total", Help: "Total microseconds spent in DAG subprocesses.", }, []string{"function"}, ) TotalBytesWritten = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "consensus_bytes_total", Help: "Total bytes written to disk for various objects.", }, []string{"object"}, ) )
var ( SaveMicroVec = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "save_usec_total", Help: "Total microseconds spent writing to disk for various objects.", }, []string{"object"}, ) )
Functions ¶
This section is empty.
Types ¶
type BlockCache ¶
type BlockCache struct {
// contains filtered or unexported fields
}
func LoadBlockCache ¶
func LoadBlockCache() (*BlockCache, error)
func NewBlockCache ¶
func NewBlockCache(genesis block.Block) (*BlockCache, error)
func (BlockCache) Get ¶
TODO(chuck): We'll probably want separate functions for loading Blocks/Parents. There will be distinct instances where we'll want the parent info (e.g. a validator came back online and is talking about a block we haven't needed in a while) and when we won't need parent info (e.g. when someone requests an old block for catchup). For now, always loading both is the more comprehensive but inefficient choice
func (BlockCache) GetTxn ¶
func (bc BlockCache) GetTxn(tid ids.TransactionId) (transaction.Transaction, bool)
func (BlockCache) LoadParents ¶
func (BlockCache) Size ¶
func (bc BlockCache) Size() uint64
type LinearHashTable ¶
type LinearHashTable struct {
// contains filtered or unexported fields
}
func NewLHT ¶
func NewLHT(keybits uint16) (*LinearHashTable, error)
func (*LinearHashTable) Get ¶
func (tbl *LinearHashTable) Get(key uint64) transaction.Transaction
func (*LinearHashTable) GetDups ¶
func (tbl *LinearHashTable) GetDups(txn transaction.Transaction, ) ([]transaction.Transaction, error)
Gets all dups of txn
func (*LinearHashTable) GetTxn ¶
func (tbl *LinearHashTable) GetTxn(value uint64, hash transaction.TransactionHash, ) (transaction.Transaction, bool)
func (*LinearHashTable) Insert ¶
func (tbl *LinearHashTable) Insert(txn transaction.Transaction) (bool, error)
Inserts the value into the table. Returns a bool indicating whether there was another (duplicate) element with the same value. If successfully inserted, error is nil.
func (*LinearHashTable) Key ¶
func (tbl *LinearHashTable) Key(value uint64) uint64
func (LinearHashTable) Print ¶
func (tbl LinearHashTable) Print()
func (*LinearHashTable) Reset ¶
func (tbl *LinearHashTable) Reset()
type SilvermintDag ¶
type SilvermintDag struct {
// contains filtered or unexported fields
}
func Build ¶
func Build(genesis block.Block, roots [validator.N_MAX_VALIDATORS]block.Block, bcache *BlockCache) *SilvermintDag
func Load ¶
func Load(genesis block.Block, roots [validator.N_MAX_VALIDATORS]block.Block, blks [validator.N_MAX_VALIDATORS][]block.Block, bcache *BlockCache, ) (*SilvermintDag, error)
func (*SilvermintDag) Add ¶
func (dag *SilvermintDag) Add(blk block.Block) bool
Adds a block to this dag, mutating it. Adds each transaction to the given map from hashes to transactions Returns true if the block is no longer pending (added or duplicate), false otherwise.
func (*SilvermintDag) Blocks ¶
func (dag *SilvermintDag) Blocks() *BlockCache
func (*SilvermintDag) CatchUpChannel ¶
func (dag *SilvermintDag) CatchUpChannel() chan block.Block
func (*SilvermintDag) GetDot ¶
func (dag *SilvermintDag) GetDot() string
func (*SilvermintDag) InterpretDeltas ¶
func (dag *SilvermintDag) InterpretDeltas(blk block.Block) bool
Interprets and assigns block Parents from block's HeightDeltas, mutating it. Returns true if successful or false if there were missing parents.
func (*SilvermintDag) LeastUndeletableHeights ¶
func (dag *SilvermintDag) LeastUndeletableHeights( regs map[validator.Validator]bool, ) block.Heights
TODO(chuck): This function isn't being used currently, but it can be used for getting the blocks needed for a snapshot to send to another validator. Determines the minimum, non-deletable height for each validator. The parents of tips can be built on still, so they aren't deletable.
func (*SilvermintDag) Pending ¶
func (dag *SilvermintDag) Pending() *pendingQueue
func (*SilvermintDag) PrintChildMap ¶
func (dag *SilvermintDag) PrintChildMap(indent int)
func (*SilvermintDag) PrintChildren ¶
func (dag *SilvermintDag) PrintChildren(indent int, bid ids.BlockId)
func (*SilvermintDag) PrintDag ¶
func (dag *SilvermintDag) PrintDag()
func (*SilvermintDag) PrintTips ¶
func (dag *SilvermintDag) PrintTips()
func (*SilvermintDag) Roots ¶
func (dag *SilvermintDag) Roots() block.Heights
func (*SilvermintDag) Size ¶
func (dag *SilvermintDag) Size() uint64