add options to BlockstoreGC trait

This commit is contained in:
vyzo 2021-07-23 22:30:40 +03:00
parent 94509968a0
commit a843665132
2 changed files with 14 additions and 2 deletions

View File

@ -471,7 +471,7 @@ func (b *Blockstore) deleteDB(path string) {
// CollectGarbage compacts and runs garbage collection on the value log;
// implements the BlockstoreGC trait
func (b *Blockstore) CollectGarbage() error {
func (b *Blockstore) CollectGarbage(options map[interface{}]interface{}) error {
if err := b.access(); err != nil {
return err
}

View File

@ -37,9 +37,21 @@ type BlockstoreIterator interface {
// BlockstoreGC is a trait for blockstores that support online garbage collection
type BlockstoreGC interface {
CollectGarbage() error
CollectGarbage(options map[interface{}]interface{}) error
}
// garbage collection options
type blockstoreMovingGCKey struct{}
type blockstoreMovingGCPath struct{}
// BlockstoreMovingGC is a garbage collection option that instructs the blockstore
// to use moving GC if supported.
var BlockstoreMovingGC = blockstoreMovingGCKey{}
// BlockstoreMovingGCPath is a garbage collection option that specifies an optional
// target path for moving GC.
var BlockstoreMovingGCPath = blockstoreMovingGCPath{}
// BlockstoreSize is a trait for on-disk blockstores that can report their size
type BlockstoreSize interface {
Size() (int64, error)