Documentation ¶
Index ¶
- func VirtualReadOption(ctx context.Context, enabled bool) context.Context
- type BlockDownloader
- type BlockStore
- func (bs *BlockStore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
- func (bs *BlockStore) DeleteBlock(ctx context.Context, c cid.Cid) error
- func (bs *BlockStore) Get(ctx context.Context, c cid.Cid) (blocks.Block, error)
- func (bs *BlockStore) GetSize(ctx context.Context, c cid.Cid) (int, error)
- func (bs *BlockStore) Has(ctx context.Context, c cid.Cid) (bool, error)
- func (bs *BlockStore) HashOnRead(enabled bool)
- func (bs *BlockStore) Put(ctx context.Context, b blocks.Block) error
- func (bs *BlockStore) PutMany(ctx context.Context, blocks []blocks.Block) error
- type ContextKey
- type MetadataStore
- type MetadataStoreDefault
- func (s *MetadataStoreDefault) BlockChildren(c cid.Cid, max *int) (children []cid.Cid, err error)
- func (s *MetadataStoreDefault) BlockExists(c cid.Cid) error
- func (s *MetadataStoreDefault) BlockSiblings(c cid.Cid, max int) (siblings []cid.Cid, err error)
- func (s *MetadataStoreDefault) GetUnixFSMetadata(c cid.Cid) (*pluginDb.UnixFSNode, error)
- func (s *MetadataStoreDefault) MarkBlockReady(c cid.Cid, ready bool) error
- func (s *MetadataStoreDefault) Pin(b PinnedBlock) error
- func (s *MetadataStoreDefault) Pinned(offset, limit int) (roots []cid.Cid, err error)
- func (s *MetadataStoreDefault) ProvideCIDs(limit int) (cids []ipfs.PinnedCID, err error)
- func (s *MetadataStoreDefault) SetLastAnnouncement(cids []cid.Cid, t time.Time) error
- func (s *MetadataStoreDefault) Size(c cid.Cid) (uint64, error)
- func (s *MetadataStoreDefault) Unpin(c cid.Cid) error
- func (s *MetadataStoreDefault) UpdateUnixFSMetadata(c cid.Cid, metadata *pluginDb.UnixFSNode) error
- type PinnedBlock
- type VirtualBlockStore
- func (v *VirtualBlockStore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
- func (v *VirtualBlockStore) DeleteBlock(ctx context.Context, c cid.Cid) error
- func (v *VirtualBlockStore) Get(ctx context.Context, c cid.Cid) (blocks.Block, error)
- func (v *VirtualBlockStore) GetSize(ctx context.Context, c cid.Cid) (int, error)
- func (v *VirtualBlockStore) Has(ctx context.Context, c cid.Cid) (bool, error)
- func (v *VirtualBlockStore) HashOnRead(enabled bool)
- func (v *VirtualBlockStore) Put(ctx context.Context, b blocks.Block) error
- func (v *VirtualBlockStore) PutMany(ctx context.Context, bs []blocks.Block) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BlockDownloader ¶
type BlockStore ¶
type BlockStore struct {
// contains filtered or unexported fields
}
A BlockStore is a blockstore backed by a renterd node.
func NewBlockStore ¶
func NewBlockStore(ctx core.Context, downloader BlockDownloader, metadata MetadataStore) (*BlockStore, error)
NewBlockStore creates a new blockstore backed by a renterd node
func (*BlockStore) AllKeysChan ¶
func (bs *BlockStore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
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 (*BlockStore) DeleteBlock ¶
func (bs *BlockStore) DeleteBlock(ctx context.Context, c cid.Cid) error
DeleteBlock removes a given block from the blockstore.
func (*BlockStore) GetSize ¶
func (bs *BlockStore) GetSize(ctx context.Context, c cid.Cid) (int, error)
GetSize returns the CIDs mapped BlockSize
func (*BlockStore) Has ¶
func (bs *BlockStore) Has(ctx context.Context, c cid.Cid) (bool, error)
Has returns whether or not a given block is in the blockstore.
func (*BlockStore) HashOnRead ¶
func (bs *BlockStore) HashOnRead(enabled bool)
HashOnRead specifies if every read block should be rehashed to make sure it matches its CID.
type ContextKey ¶
type ContextKey string
ContextKey is a type for context keys
const ( // VirtualReadKey is the context key for the virtual read option VirtualReadKey ContextKey = "virtualRead" )
type MetadataStore ¶
type MetadataStoreDefault ¶
type MetadataStoreDefault struct {
// contains filtered or unexported fields
}
func NewMetadataStore ¶
func NewMetadataStore(ctx core.Context) *MetadataStoreDefault
NewMetadataStore creates a new blockstore backed by a renterd node
func (*MetadataStoreDefault) BlockChildren ¶
func (s *MetadataStoreDefault) BlockChildren(c cid.Cid, max *int) (children []cid.Cid, err error)
func (*MetadataStoreDefault) BlockExists ¶
func (s *MetadataStoreDefault) BlockExists(c cid.Cid) error
func (*MetadataStoreDefault) BlockSiblings ¶
func (s *MetadataStoreDefault) BlockSiblings(c cid.Cid, max int) (siblings []cid.Cid, err error)
func (*MetadataStoreDefault) GetUnixFSMetadata ¶
func (s *MetadataStoreDefault) GetUnixFSMetadata(c cid.Cid) (*pluginDb.UnixFSNode, error)
func (*MetadataStoreDefault) MarkBlockReady ¶
func (s *MetadataStoreDefault) MarkBlockReady(c cid.Cid, ready bool) error
func (*MetadataStoreDefault) Pin ¶
func (s *MetadataStoreDefault) Pin(b PinnedBlock) error
Pin adds a block to the store.
func (*MetadataStoreDefault) Pinned ¶
func (s *MetadataStoreDefault) Pinned(offset, limit int) (roots []cid.Cid, err error)
func (*MetadataStoreDefault) ProvideCIDs ¶
func (s *MetadataStoreDefault) ProvideCIDs(limit int) (cids []ipfs.PinnedCID, err error)
func (*MetadataStoreDefault) SetLastAnnouncement ¶
func (s *MetadataStoreDefault) SetLastAnnouncement(cids []cid.Cid, t time.Time) error
func (*MetadataStoreDefault) Size ¶
func (s *MetadataStoreDefault) Size(c cid.Cid) (uint64, error)
func (*MetadataStoreDefault) Unpin ¶
func (s *MetadataStoreDefault) Unpin(c cid.Cid) error
func (*MetadataStoreDefault) UpdateUnixFSMetadata ¶
func (s *MetadataStoreDefault) UpdateUnixFSMetadata(c cid.Cid, metadata *pluginDb.UnixFSNode) error
type PinnedBlock ¶
type VirtualBlockStore ¶
type VirtualBlockStore struct {
// contains filtered or unexported fields
}
VirtualBlockStore is a wrapper around a CachedBlockstore that can bypass the cache
func NewVirtualBlockStore ¶
func NewVirtualBlockStore(ctx core.Context, directBS blockstore.Blockstore, cacheOpts blockstore.CacheOpts) (*VirtualBlockStore, error)
NewVirtualBlockStore creates a new VirtualBlockStore
func (*VirtualBlockStore) AllKeysChan ¶
func (v *VirtualBlockStore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
AllKeysChan returns a channel from which the CIDs in the Blockstore can be read
func (*VirtualBlockStore) DeleteBlock ¶
func (v *VirtualBlockStore) DeleteBlock(ctx context.Context, c cid.Cid) error
DeleteBlock removes a given block from the blockstore
func (*VirtualBlockStore) GetSize ¶
func (v *VirtualBlockStore) GetSize(ctx context.Context, c cid.Cid) (int, error)
GetSize returns the CIDs mapped BlockSize
func (*VirtualBlockStore) Has ¶
func (v *VirtualBlockStore) Has(ctx context.Context, c cid.Cid) (bool, error)
Has returns whether or not a given block is in the blockstore
func (*VirtualBlockStore) HashOnRead ¶
func (v *VirtualBlockStore) HashOnRead(enabled bool)
HashOnRead specifies if every read block should be rehashed to make sure it matches its CID
Directories ¶
Path | Synopsis |
---|---|
package downloader contains a cache for downloading blocks from a renterd node.
|
package downloader contains a cache for downloading blocks from a renterd node. |