Documentation
¶
Index ¶
- Variables
- type ChainHeadIndexer
- type ChainHistoryIndexer
- type TipSetCache
- func (c *TipSetCache) Add(ts *types.TipSet) (*types.TipSet, error)
- func (c *TipSetCache) Head() (*types.TipSet, error)
- func (c *TipSetCache) Height() abi.ChainEpoch
- func (c *TipSetCache) Len() int
- func (c *TipSetCache) Reset()
- func (c *TipSetCache) Revert(ts *types.TipSet) error
- func (c *TipSetCache) SetCurrent(ts *types.TipSet) error
- func (c *TipSetCache) Tail() (*types.TipSet, error)
- func (c *TipSetCache) TailHeight() abi.ChainEpoch
- type UnindexedBlockData
- func (u *UnindexedBlockData) AddBlock(bh *types.BlockHeader)
- func (u *UnindexedBlockData) AddTipSet(ts *types.TipSet)
- func (u *UnindexedBlockData) Height() abi.ChainEpoch
- func (u *UnindexedBlockData) MarkSeen(tsk types.TipSetKey)
- func (u *UnindexedBlockData) Persist(ctx context.Context, db *pg.DB) error
- func (u *UnindexedBlockData) Reset()
- func (u *UnindexedBlockData) Seen(tsk types.TipSetKey) bool
- func (u *UnindexedBlockData) Size() int
Constants ¶
This section is empty.
Variables ¶
var ErrAddOutOfOrder = errors.New("added tipset height lower than current head")
var ErrCacheEmpty = errors.New("cache empty")
var ErrRevertOutOfOrder = errors.New("reverted tipset does not match current head")
Functions ¶
This section is empty.
Types ¶
type ChainHeadIndexer ¶
type ChainHeadIndexer struct {
// contains filtered or unexported fields
}
ChainHeadIndexer is a task that indexes blocks by following the chain head.
func NewChainHeadIndexer ¶
NewChainHeadIndexer creates a new ChainHeadIndexer. confidence sets the number of tipsets that will be held in a cache awaiting possible reversion. Tipsets will be written to the database when they are evicted from the cache due to incoming later tipsets.
type ChainHistoryIndexer ¶
type ChainHistoryIndexer struct {
// contains filtered or unexported fields
}
ChainHistoryIndexer is a task that indexes blocks by following the chain history.
func NewChainHistoryIndexer ¶
func NewChainHistoryIndexer(d *storage.Database, node lens.API) *ChainHistoryIndexer
type TipSetCache ¶
type TipSetCache struct {
// contains filtered or unexported fields
}
TipSetCache is a cache of recent tipsets that can keep track of reversions. Inspired by tipSetCache in Lotus chain/events package.
func NewTipSetCache ¶
func NewTipSetCache(size int) *TipSetCache
func (*TipSetCache) Add ¶
Add adds a new tipset which becomes the new head of the cache. If the buffer is full, the tail being evicted is also returned.
func (*TipSetCache) Head ¶
func (c *TipSetCache) Head() (*types.TipSet, error)
Head returns the tipset at the head of the cache.
func (*TipSetCache) Height ¶
func (c *TipSetCache) Height() abi.ChainEpoch
Height returns the height of the current head or zero if the cache is empty.
func (*TipSetCache) Len ¶
func (c *TipSetCache) Len() int
Len returns the number of tipsets in the cache. This will never exceed the size of the cache.
func (*TipSetCache) Revert ¶
func (c *TipSetCache) Revert(ts *types.TipSet) error
Revert removes the head tipset
func (*TipSetCache) SetCurrent ¶
func (c *TipSetCache) SetCurrent(ts *types.TipSet) error
SetCurrent replaces the current head
func (*TipSetCache) Tail ¶
func (c *TipSetCache) Tail() (*types.TipSet, error)
Tail returns the tipset at the tail of the cache.
func (*TipSetCache) TailHeight ¶
func (c *TipSetCache) TailHeight() abi.ChainEpoch
TailHeight returns the height of the current tail or zero if the cache is empty.
type UnindexedBlockData ¶
type UnindexedBlockData struct {
// contains filtered or unexported fields
}
func NewUnindexedBlockData ¶
func NewUnindexedBlockData() *UnindexedBlockData
func (*UnindexedBlockData) AddBlock ¶
func (u *UnindexedBlockData) AddBlock(bh *types.BlockHeader)
func (*UnindexedBlockData) AddTipSet ¶
func (u *UnindexedBlockData) AddTipSet(ts *types.TipSet)
func (*UnindexedBlockData) Height ¶
func (u *UnindexedBlockData) Height() abi.ChainEpoch
func (*UnindexedBlockData) MarkSeen ¶
func (u *UnindexedBlockData) MarkSeen(tsk types.TipSetKey)
func (*UnindexedBlockData) Persist ¶
func (u *UnindexedBlockData) Persist(ctx context.Context, db *pg.DB) error
func (*UnindexedBlockData) Reset ¶
func (u *UnindexedBlockData) Reset()
Reset clears the unindexed data but keeps the history of which cids have been seen.
func (*UnindexedBlockData) Size ¶
func (u *UnindexedBlockData) Size() int