Documentation ¶
Index ¶
- func AsIdentity(key string) (digest []byte, ok bool, err error)
- type CachingTempStore
- func (ttrw *CachingTempStore) Close() error
- func (ttrw *CachingTempStore) Get(ctx context.Context, key string) ([]byte, error)
- func (ttrw *CachingTempStore) GetStream(ctx context.Context, key string) (io.ReadCloser, error)
- func (ttrw *CachingTempStore) Has(ctx context.Context, key string) (bool, error)
- func (ttrw *CachingTempStore) PreloadStore() types.ReadableWritableStorage
- func (ttrw *CachingTempStore) Put(ctx context.Context, key string, data []byte) error
- type DeferredStorageCar
- func (dcs *DeferredStorageCar) Close() error
- func (dcs *DeferredStorageCar) Get(ctx context.Context, key string) ([]byte, error)
- func (dcs *DeferredStorageCar) GetStream(ctx context.Context, key string) (io.ReadCloser, error)
- func (dcs *DeferredStorageCar) Has(ctx context.Context, key string) (bool, error)
- func (dcs *DeferredStorageCar) Put(ctx context.Context, key string, data []byte) error
- type DeferredWriter
- type DuplicateAdderCar
- type ReadableWritableStorage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CachingTempStore ¶
type CachingTempStore struct {
// contains filtered or unexported fields
}
CachingTempStore is a ReadableWritableStorage that is intended for temporary use. It uses DeferredStorageCar as a backing store, so the underlying CAR file is lazily created on the first write (none will be created if there are no writes).
A provided BlockWriteOpener will receive blocks for each Put operation, this is intended to be used to write a properly ordered CARv1 file.
PreloadStore returns a secondary ReadableWritableStorage that can be used by a traversal preloader to optimistically load blocks into the temporary store. Blocks loaded via the PreloadStore will not be written to the provided BlockWriteOpener until they appear in a Put operation on the parent store. In this way, the BlockWriteOpener will receive blocks in the order that they appear in the traversal.
func NewCachingTempStore ¶
func NewCachingTempStore(outWriter linking.BlockWriteOpener, store *DeferredStorageCar) *CachingTempStore
func (*CachingTempStore) Close ¶
func (ttrw *CachingTempStore) Close() error
Close will clean up any temporary resources used by the storage.
func (*CachingTempStore) GetStream ¶
func (ttrw *CachingTempStore) GetStream(ctx context.Context, key string) (io.ReadCloser, error)
func (*CachingTempStore) PreloadStore ¶
func (ttrw *CachingTempStore) PreloadStore() types.ReadableWritableStorage
type DeferredStorageCar ¶
type DeferredStorageCar struct {
// contains filtered or unexported fields
}
DeferredStorageCar is a wrapper around github.com/ipld/go-car/v2/storage.StorageCar that defers creating the CAR until the first Put() operation. In this way it can be optimistically instantiated and no file will be created if it is never written to (such as in the case of an error).
func NewDeferredStorageCar ¶
func NewDeferredStorageCar(tempDir string, root cid.Cid) *DeferredStorageCar
NewDeferredStorageCar creates a new DeferredStorageCar.
func (*DeferredStorageCar) Close ¶
func (dcs *DeferredStorageCar) Close() error
Close will clean up any temporary resources used by the storage.
func (*DeferredStorageCar) GetStream ¶
func (dcs *DeferredStorageCar) GetStream(ctx context.Context, key string) (io.ReadCloser, error)
GetStream returns data from the underlying CARv1.
type DeferredWriter ¶ added in v0.11.0
type DeferredWriter interface { ipldstorage.WritableStorage io.Closer BlockWriteOpener() linking.BlockWriteOpener OnPut(cb func(int), once bool) }
type DuplicateAdderCar ¶ added in v0.11.0
type DuplicateAdderCar struct { *deferred.DeferredCarWriter // contains filtered or unexported fields }
func NewDuplicateAdderCarForPath ¶ added in v0.20.1
func NewDuplicateAdderCarForPath( ctx context.Context, outPath string, root cid.Cid, path string, scope trustlessutils.DagScope, bytes *trustlessutils.ByteRange, store *DeferredStorageCar, ) *DuplicateAdderCar
func NewDuplicateAdderCarForStream ¶ added in v0.11.0
func NewDuplicateAdderCarForStream( ctx context.Context, outStream io.Writer, root cid.Cid, path string, scope trustlessutils.DagScope, bytes *trustlessutils.ByteRange, store *DeferredStorageCar, ) *DuplicateAdderCar
func (*DuplicateAdderCar) BlockWriteOpener ¶ added in v0.11.0
func (da *DuplicateAdderCar) BlockWriteOpener() linking.BlockWriteOpener
func (*DuplicateAdderCar) Close ¶ added in v0.11.0
func (da *DuplicateAdderCar) Close() error
Close closes the dup stream, verifying completion, if one was created.
type ReadableWritableStorage ¶
type ReadableWritableStorage interface { ipldstorage.ReadableStorage ipldstorage.WritableStorage ipldstorage.StreamingReadableStorage }