Documentation ¶
Index ¶
- Variables
- type TipSetCache
- func (c *TipSetCache) Add(ts *types.TipSet) (*types.TipSet, error)
- func (c *TipSetCache) Confidence() int
- 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) Size() int
- func (c *TipSetCache) Tail() (*types.TipSet, error)
- func (c *TipSetCache) TailHeight() abi.ChainEpoch
- func (c *TipSetCache) Warm(ctx context.Context, head *types.TipSet, ...) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
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) Confidence ¶
func (c *TipSetCache) Confidence() int
Confidence returns the number of tipset that the cache must hold before tipsets are evicted on Add.
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) Size ¶
func (c *TipSetCache) Size() int
Size returns the maximum number of tipsets that may be present in the cache.
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.