Documentation ¶
Overview ¶
blockstore contains all the basic blockstore constructors used by lotus. Any blockstores not ultimately constructed out of the building blocks in this package may not work properly.
- This package correctly wraps blockstores with the IdBlockstore. This blockstore:
- Filters out all puts for blocks with CIDs using the "identity" hash function.
- Extracts inlined blocks from CIDs using the identity hash function and returns them on get/has, ignoring the contents of the blockstore.
- In the future, this package may enforce additional restrictions on block sizes, CID validity, etc.
To make auditing for misuse of blockstores tractable, this package re-exports parts of the go-ipfs-blockstore package such that no other package needs to import it directly.
Index ¶
- Variables
- func NewBlockstore(dstore ds.Batching) blockstore.Blockstore
- func WrapIDStore(bstore blockstore.Blockstore) blockstore.Blockstore
- type Blockstore
- type CacheOpts
- type GCBlockstore
- type GCLocker
- type MemStore
- func (m MemStore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
- func (m MemStore) DeleteBlock(k cid.Cid) error
- func (m MemStore) Get(k cid.Cid) (blocks.Block, error)
- func (m MemStore) GetSize(k cid.Cid) (int, error)
- func (m MemStore) Has(k cid.Cid) (bool, error)
- func (m MemStore) HashOnRead(enabled bool)
- func (m MemStore) Put(b blocks.Block) error
- func (m MemStore) PutMany(bs []blocks.Block) error
- type SyncStore
- func (m *SyncStore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
- func (m *SyncStore) DeleteBlock(k cid.Cid) error
- func (m *SyncStore) Get(k cid.Cid) (blocks.Block, error)
- func (m *SyncStore) GetSize(k cid.Cid) (int, error)
- func (m *SyncStore) Has(k cid.Cid) (bool, error)
- func (m *SyncStore) HashOnRead(enabled bool)
- func (m *SyncStore) Put(b blocks.Block) error
- func (m *SyncStore) PutMany(bs []blocks.Block) error
Constants ¶
This section is empty.
Variables ¶
var DefaultCacheOpts = blockstore.DefaultCacheOpts
var ErrNotFound = blockstore.ErrNotFound
var NewGCBlockstore = blockstore.NewGCBlockstore
var NewGCLocker = blockstore.NewGCLocker
Functions ¶
func NewBlockstore ¶
func NewBlockstore(dstore ds.Batching) blockstore.Blockstore
NewBlockstore creates a new blockstore wrapped by the given datastore.
func WrapIDStore ¶
func WrapIDStore(bstore blockstore.Blockstore) blockstore.Blockstore
WrapIDStore wraps the underlying blockstore in an "identity" blockstore.
Types ¶
type Blockstore ¶
type Blockstore = blockstore.Blockstore
Alias so other packages don't have to import go-ipfs-blockstore
func CachedBlockstore ¶
func CachedBlockstore(ctx context.Context, bs Blockstore, opts CacheOpts) (Blockstore, error)
type CacheOpts ¶
type CacheOpts = blockstore.CacheOpts
type GCBlockstore ¶
type GCBlockstore = blockstore.GCBlockstore
type GCLocker ¶
type GCLocker = blockstore.GCLocker
type MemStore ¶ added in v0.10.2
func (MemStore) AllKeysChan ¶ added in v0.10.2
AllKeysChan returns a channel from which the CIDs in the Blockstore can be read. It should respect the given context, closing the channel if it becomes Done.
func (MemStore) DeleteBlock ¶ added in v0.10.2
func (MemStore) HashOnRead ¶ added in v0.10.2
HashOnRead specifies if every read block should be rehashed to make sure it matches its CID.
type SyncStore ¶ added in v0.10.2
type SyncStore struct {
// contains filtered or unexported fields
}
func NewTemporarySync ¶
func NewTemporarySync() *SyncStore
NewTemporarySync returns a thread-safe temporary blockstore.
func (*SyncStore) AllKeysChan ¶ added in v0.10.2
AllKeysChan returns a channel from which the CIDs in the Blockstore can be read. It should respect the given context, closing the channel if it becomes Done.
func (*SyncStore) DeleteBlock ¶ added in v0.10.2
func (*SyncStore) HashOnRead ¶ added in v0.10.2
HashOnRead specifies if every read block should be rehashed to make sure it matches its CID.