Documentation ¶
Index ¶
- Constants
- Variables
- type BadgerMarkSet
- func (s *BadgerMarkSet) BeginCriticalSection() error
- func (s *BadgerMarkSet) Close() error
- func (s *BadgerMarkSet) EndCriticalSection()
- func (s *BadgerMarkSet) Has(c cid.Cid) (bool, error)
- func (s *BadgerMarkSet) Mark(c cid.Cid) error
- func (s *BadgerMarkSet) MarkMany(batch []cid.Cid) error
- func (s *BadgerMarkSet) Visit(c cid.Cid) (bool, error)
- type BadgerMarkSetEnv
- type ChainAccessor
- type Checkpoint
- type ColdSetReader
- type ColdSetWriter
- type CompactType
- type Config
- type MapMarkSet
- func (s *MapMarkSet) BeginCriticalSection() error
- func (s *MapMarkSet) Close() error
- func (s *MapMarkSet) EndCriticalSection()
- func (s *MapMarkSet) Has(cid cid.Cid) (bool, error)
- func (s *MapMarkSet) Mark(c cid.Cid) error
- func (s *MapMarkSet) MarkMany(batch []cid.Cid) error
- func (s *MapMarkSet) Visit(c cid.Cid) (bool, error)
- type MapMarkSetEnv
- type MarkSet
- type MarkSetEnv
- type ObjectVisitor
- type SplitStore
- func (s *SplitStore) AddProtector(protector func(func(cid.Cid) error) error)
- func (s *SplitStore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
- func (s *SplitStore) Check() error
- func (s *SplitStore) Close() error
- func (s *SplitStore) DeleteBlock(_ context.Context, _ cid.Cid) error
- func (s *SplitStore) DeleteMany(_ context.Context, _ []cid.Cid) error
- func (s *SplitStore) Expose() bstore.Blockstore
- func (s *SplitStore) Flush(ctx context.Context) error
- func (s *SplitStore) GCHotStore(opts api.HotGCOpts) error
- func (s *SplitStore) Get(ctx context.Context, cid cid.Cid) (blocks.Block, error)
- func (s *SplitStore) GetSize(ctx context.Context, cid cid.Cid) (int, error)
- func (s *SplitStore) Has(ctx context.Context, cid cid.Cid) (bool, error)
- func (s *SplitStore) HashOnRead(enabled bool)
- func (s *SplitStore) HeadChange(_, apply []*types.TipSet) error
- func (s *SplitStore) Info() map[string]interface{}
- func (s *SplitStore) PruneChain(opts api.PruneOpts) error
- func (s *SplitStore) Put(ctx context.Context, blk blocks.Block) error
- func (s *SplitStore) PutMany(ctx context.Context, blks []blocks.Block) error
- func (s *SplitStore) Start(chain ChainAccessor, us stmgr.UpgradeSchedule) error
- func (s *SplitStore) View(ctx context.Context, cid cid.Cid, cb func([]byte) error) error
Constants ¶
const (
// Fraction of garbage in badger vlog for online GC traversal to collect garbage
AggressiveOnlineGCThreshold = 0.0001
)
Variables ¶
var ( // CompactionThreshold is the number of epochs that need to have elapsed // from the previously compacted epoch to trigger a new compaction. // // |················· CompactionThreshold ··················| // | | // =======‖≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡‖------------------------» // | | chain --> ↑__ current epoch // | archived epochs ___↑ // ↑________ CompactionBoundary // // === :: cold (already archived) // ≡≡≡ :: to be archived in this compaction // --- :: hot CompactionThreshold = 5 * build.Finality // CompactionBoundary is the number of epochs from the current epoch at which // we will walk the chain for live objects. CompactionBoundary = 4 * build.Finality // SyncGapTime is the time delay from a tipset's min timestamp before we decide // there is a sync gap SyncGapTime = time.Minute // SyncWaitTime is the time delay from a tipset's min timestamp before we decide // we have synced. SyncWaitTime = 30 * time.Second // This is a testing flag that should always be true when running a node. itests rely on the rough hack // of starting genesis so far in the past that they exercise catchup mining to mine // blocks quickly and so disabling syncgap checking is necessary to test compaction // without a deep structural improvement of itests. CheckSyncGap = true )
var ( // PruneOnline is a prune option that instructs PruneChain to use online gc for reclaiming space; // there is no value associated with this option. PruneOnlineGC = "splitstore.PruneOnlineGC" // PruneMoving is a prune option that instructs PruneChain to use moving gc for reclaiming space; // the value associated with this option is the path of the new coldstore. PruneMovingGC = "splitstore.PruneMovingGC" // PruneRetainState is a prune option that instructs PruneChain as to how many finalities worth // of state to retain in the coldstore. // The value is an integer: // - if it is -1 then all state objects reachable from the chain will be retained in the coldstore. // this is useful for garbage collecting side-chains and other garbage in archival nodes. // This is the (safe) default. // - if it is 0 then no state objects that are unreachable within the compaction boundary will // be retained in the coldstore. // - if it is a positive integer, then it's the number of finalities past the compaction boundary // for which chain-reachable state objects are retained. PruneRetainState = "splitstore.PruneRetainState" // PruneThreshold is the number of epochs that need to have elapsed // from the previously pruned epoch to trigger a new prune PruneThreshold = 7 * build.Finality )
var (
ReifyLimit = 16384
)
var ( // WarmupBoundary is the number of epochs to load state during warmup. WarmupBoundary = build.Finality )
Functions ¶
This section is empty.
Types ¶
type BadgerMarkSet ¶ added in v1.11.1
type BadgerMarkSet struct {
// contains filtered or unexported fields
}
func (*BadgerMarkSet) BeginCriticalSection ¶ added in v1.14.0
func (s *BadgerMarkSet) BeginCriticalSection() error
func (*BadgerMarkSet) Close ¶ added in v1.11.1
func (s *BadgerMarkSet) Close() error
func (*BadgerMarkSet) EndCriticalSection ¶ added in v1.14.0
func (s *BadgerMarkSet) EndCriticalSection()
func (*BadgerMarkSet) Has ¶ added in v1.11.1
func (s *BadgerMarkSet) Has(c cid.Cid) (bool, error)
func (*BadgerMarkSet) Mark ¶ added in v1.11.1
func (s *BadgerMarkSet) Mark(c cid.Cid) error
func (*BadgerMarkSet) MarkMany ¶ added in v1.14.0
func (s *BadgerMarkSet) MarkMany(batch []cid.Cid) error
func (*BadgerMarkSet) Visit ¶ added in v1.11.2
func (s *BadgerMarkSet) Visit(c cid.Cid) (bool, error)
type BadgerMarkSetEnv ¶ added in v1.11.1
type BadgerMarkSetEnv struct {
// contains filtered or unexported fields
}
func (*BadgerMarkSetEnv) Close ¶ added in v1.11.1
func (e *BadgerMarkSetEnv) Close() error
type ChainAccessor ¶
type ChainAccessor interface { GetTipsetByHeight(context.Context, abi.ChainEpoch, *types.TipSet, bool) (*types.TipSet, error) GetHeaviestTipSet() *types.TipSet SubscribeHeadChanges(change func(revert []*types.TipSet, apply []*types.TipSet) error) }
ChainAccessor allows the Splitstore to access the chain. It will most likely be a ChainStore at runtime.
type Checkpoint ¶ added in v1.14.0
type Checkpoint struct {
// contains filtered or unexported fields
}
func NewCheckpoint ¶ added in v1.14.0
func NewCheckpoint(path string) (*Checkpoint, error)
func OpenCheckpoint ¶ added in v1.14.0
func OpenCheckpoint(path string) (*Checkpoint, cid.Cid, error)
func (*Checkpoint) Close ¶ added in v1.14.0
func (cp *Checkpoint) Close() error
func (*Checkpoint) Set ¶ added in v1.14.0
func (cp *Checkpoint) Set(c cid.Cid) error
type ColdSetReader ¶ added in v1.14.0
type ColdSetReader struct {
// contains filtered or unexported fields
}
func NewColdSetReader ¶ added in v1.14.0
func NewColdSetReader(path string) (*ColdSetReader, error)
func (*ColdSetReader) Close ¶ added in v1.14.0
func (s *ColdSetReader) Close() error
func (*ColdSetReader) ForEach ¶ added in v1.14.0
func (s *ColdSetReader) ForEach(f func(cid.Cid) error) error
func (*ColdSetReader) Reset ¶ added in v1.14.0
func (s *ColdSetReader) Reset() error
type ColdSetWriter ¶ added in v1.14.0
type ColdSetWriter struct {
// contains filtered or unexported fields
}
func NewColdSetWriter ¶ added in v1.14.0
func NewColdSetWriter(path string) (*ColdSetWriter, error)
func (*ColdSetWriter) Close ¶ added in v1.14.0
func (s *ColdSetWriter) Close() error
func (*ColdSetWriter) Write ¶ added in v1.14.0
func (s *ColdSetWriter) Write(c cid.Cid) error
type CompactType ¶ added in v1.17.1
type CompactType int
type Config ¶
type Config struct { // MarkSetType is the type of mark set to use. // // The default value is "map", which uses an in-memory map-backed markset. // If you are constrained in memory (i.e. compaction runs out of memory), you // can use "badger", which will use a disk-backed markset using badger. // Note that compaction will take quite a bit longer when using the "badger" option, // but that shouldn't really matter (as long as it is under 7.5hrs). MarkSetType string // DiscardColdBlocks indicates whether to skip moving cold blocks to the coldstore. // If the splitstore is running with a noop coldstore then this option is set to true // which skips moving (as it is a noop, but still takes time to read all the cold objects) // and directly purges cold blocks. DiscardColdBlocks bool // UniversalColdBlocks indicates whether all blocks being garbage collected and purged // from the hotstore should be written to the cold store UniversalColdBlocks bool // HotstoreMessageRetention indicates the hotstore retention policy for messages. // It has the following semantics: // - a value of 0 will only retain messages within the compaction boundary (4 finalities) // - a positive integer indicates the number of finalities, outside the compaction boundary, // for which messages will be retained in the hotstore. HotStoreMessageRetention uint64 // HotstoreFullGCFrequency indicates how frequently (in terms of compactions) to garbage collect // the hotstore using full (moving) GC if supported by the hotstore. // A value of 0 disables full GC entirely. // A positive value is the number of compactions before a full GC is performed; // a value of 1 will perform full GC in every compaction. HotStoreFullGCFrequency uint64 // HotstoreMaxSpaceTarget suggests the max allowed space the hotstore can take. // This is not a hard limit, it is possible for the hotstore to exceed the target // for example if state grows massively between compactions. The splitstore // will make a best effort to avoid overflowing the target and in practice should // never overflow. This field is used when doing GC at the end of a compaction to // adaptively choose moving GC HotstoreMaxSpaceTarget uint64 // Moving GC will be triggered when total moving size exceeds // HotstoreMaxSpaceTarget - HotstoreMaxSpaceThreshold HotstoreMaxSpaceThreshold uint64 // Safety buffer to prevent moving GC from overflowing disk. // Moving GC will not occur when total moving size exceeds // HotstoreMaxSpaceTarget - HotstoreMaxSpaceSafetyBuffer HotstoreMaxSpaceSafetyBuffer uint64 }
type MapMarkSet ¶ added in v1.11.1
type MapMarkSet struct {
// contains filtered or unexported fields
}
func (*MapMarkSet) BeginCriticalSection ¶ added in v1.14.0
func (s *MapMarkSet) BeginCriticalSection() error
func (*MapMarkSet) Close ¶ added in v1.11.1
func (s *MapMarkSet) Close() error
func (*MapMarkSet) EndCriticalSection ¶ added in v1.14.0
func (s *MapMarkSet) EndCriticalSection()
func (*MapMarkSet) Has ¶ added in v1.11.1
func (s *MapMarkSet) Has(cid cid.Cid) (bool, error)
func (*MapMarkSet) Mark ¶ added in v1.11.1
func (s *MapMarkSet) Mark(c cid.Cid) error
func (*MapMarkSet) MarkMany ¶ added in v1.14.0
func (s *MapMarkSet) MarkMany(batch []cid.Cid) error
func (*MapMarkSet) Visit ¶ added in v1.11.2
func (s *MapMarkSet) Visit(c cid.Cid) (bool, error)
type MapMarkSetEnv ¶ added in v1.11.1
type MapMarkSetEnv struct {
// contains filtered or unexported fields
}
func NewMapMarkSetEnv ¶ added in v1.11.1
func NewMapMarkSetEnv(path string) (*MapMarkSetEnv, error)
func (*MapMarkSetEnv) Close ¶ added in v1.11.1
func (e *MapMarkSetEnv) Close() error
type MarkSet ¶
type MarkSet interface { ObjectVisitor Mark(cid.Cid) error MarkMany([]cid.Cid) error Has(cid.Cid) (bool, error) Close() error // BeginCriticalSection ensures that the markset is persisted to disk for recovery in case // of abnormal termination during the critical section span. BeginCriticalSection() error // EndCriticalSection ends the critical section span. EndCriticalSection() }
MarkSet is an interface for tracking CIDs during chain and object walks
type MarkSetEnv ¶
type MarkSetEnv interface { // New creates a new markset within the environment. // name is a unique name for this markset, mapped to the filesystem for on-disk persistence. // sizeHint is a hint about the expected size of the markset New(name string, sizeHint int64) (MarkSet, error) // Recover recovers an existing markset persisted on-disk. Recover(name string) (MarkSet, error) // Close closes the markset Close() error }
func NewBadgerMarkSetEnv ¶ added in v1.11.1
func NewBadgerMarkSetEnv(path string) (MarkSetEnv, error)
func OpenMarkSetEnv ¶
func OpenMarkSetEnv(path string, mtype string) (MarkSetEnv, error)
type ObjectVisitor ¶ added in v1.11.2
ObjectVisitor is an interface for deduplicating objects during walks
type SplitStore ¶
type SplitStore struct {
// contains filtered or unexported fields
}
func Open ¶
func Open(path string, ds dstore.Datastore, hot, cold bstore.Blockstore, cfg *Config) (*SplitStore, error)
Open opens an existing splistore, or creates a new splitstore. The splitstore is backed by the provided hot and cold stores. The returned SplitStore MUST be attached to the ChainStore with Start in order to trigger compaction.
func (*SplitStore) AddProtector ¶ added in v1.11.1
func (s *SplitStore) AddProtector(protector func(func(cid.Cid) error) error)
func (*SplitStore) AllKeysChan ¶
func (s *SplitStore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
func (*SplitStore) Check ¶ added in v1.11.1
func (s *SplitStore) Check() error
performs an asynchronous health-check on the splitstore; results are appended to <splitstore-path>/check.txt
func (*SplitStore) Close ¶
func (s *SplitStore) Close() error
func (*SplitStore) DeleteBlock ¶
func (s *SplitStore) DeleteBlock(_ context.Context, _ cid.Cid) error
Blockstore interface
func (*SplitStore) DeleteMany ¶
func (s *SplitStore) DeleteMany(_ context.Context, _ []cid.Cid) error
func (*SplitStore) Expose ¶ added in v1.11.1
func (s *SplitStore) Expose() bstore.Blockstore
func (*SplitStore) GCHotStore ¶ added in v1.23.0
func (s *SplitStore) GCHotStore(opts api.HotGCOpts) error
GCHotstore runs online GC on the chain state in the hotstore according the to options specified
func (*SplitStore) GetSize ¶
func (s *SplitStore) GetSize(ctx context.Context, cid cid.Cid) (int, error)
func (*SplitStore) HashOnRead ¶
func (s *SplitStore) HashOnRead(enabled bool)
func (*SplitStore) HeadChange ¶
func (s *SplitStore) HeadChange(_, apply []*types.TipSet) error
func (*SplitStore) Info ¶ added in v1.11.1
func (s *SplitStore) Info() map[string]interface{}
provides some basic information about the splitstore
func (*SplitStore) PruneChain ¶ added in v1.17.1
func (s *SplitStore) PruneChain(opts api.PruneOpts) error
PruneChain instructs the SplitStore to prune chain state in the coldstore, according to the options specified.
func (*SplitStore) Start ¶
func (s *SplitStore) Start(chain ChainAccessor, us stmgr.UpgradeSchedule) error
State tracking