Documentation ¶
Index ¶
- type BadBlobs
- func (bad *BadBlobs) Close() error
- func (bad *BadBlobs) Create(ctx context.Context, ref storage.BlobRef, size int64) (storage.BlobWriter, error)
- func (bad *BadBlobs) Delete(ctx context.Context, ref storage.BlobRef) error
- func (bad *BadBlobs) DeleteWithStorageFormat(ctx context.Context, ref storage.BlobRef, formatVer storage.FormatVersion) error
- func (bad *BadBlobs) FreeSpace() (int64, error)
- func (bad *BadBlobs) ListNamespaces(ctx context.Context) ([][]byte, error)
- func (bad *BadBlobs) Open(ctx context.Context, ref storage.BlobRef) (storage.BlobReader, error)
- func (bad *BadBlobs) OpenWithStorageFormat(ctx context.Context, ref storage.BlobRef, formatVer storage.FormatVersion) (storage.BlobReader, error)
- func (bad *BadBlobs) RestoreTrash(ctx context.Context, namespace []byte) error
- func (bad *BadBlobs) SetError(err error)
- func (bad *BadBlobs) SpaceUsed(ctx context.Context) (int64, error)
- func (bad *BadBlobs) SpaceUsedInNamespace(ctx context.Context, namespace []byte) (int64, error)
- func (bad *BadBlobs) Stat(ctx context.Context, ref storage.BlobRef) (storage.BlobInfo, error)
- func (bad *BadBlobs) StatWithStorageFormat(ctx context.Context, ref storage.BlobRef, formatVer storage.FormatVersion) (storage.BlobInfo, error)
- func (bad *BadBlobs) Trash(ctx context.Context, ref storage.BlobRef) error
- func (bad *BadBlobs) WalkNamespace(ctx context.Context, namespace []byte, walkFunc func(storage.BlobInfo) error) error
- type BadDB
- type SlowBlobs
- func (slow *SlowBlobs) Close() error
- func (slow *SlowBlobs) Create(ctx context.Context, ref storage.BlobRef, size int64) (storage.BlobWriter, error)
- func (slow *SlowBlobs) Delete(ctx context.Context, ref storage.BlobRef) error
- func (slow *SlowBlobs) DeleteWithStorageFormat(ctx context.Context, ref storage.BlobRef, formatVer storage.FormatVersion) error
- func (slow *SlowBlobs) FreeSpace() (int64, error)
- func (slow *SlowBlobs) ListNamespaces(ctx context.Context) ([][]byte, error)
- func (slow *SlowBlobs) Open(ctx context.Context, ref storage.BlobRef) (storage.BlobReader, error)
- func (slow *SlowBlobs) OpenWithStorageFormat(ctx context.Context, ref storage.BlobRef, formatVer storage.FormatVersion) (storage.BlobReader, error)
- func (slow *SlowBlobs) RestoreTrash(ctx context.Context, namespace []byte) error
- func (slow *SlowBlobs) SetLatency(delay time.Duration)
- func (slow *SlowBlobs) SpaceUsed(ctx context.Context) (int64, error)
- func (slow *SlowBlobs) SpaceUsedInNamespace(ctx context.Context, namespace []byte) (int64, error)
- func (slow *SlowBlobs) Stat(ctx context.Context, ref storage.BlobRef) (storage.BlobInfo, error)
- func (slow *SlowBlobs) StatWithStorageFormat(ctx context.Context, ref storage.BlobRef, formatVer storage.FormatVersion) (storage.BlobInfo, error)
- func (slow *SlowBlobs) Trash(ctx context.Context, ref storage.BlobRef) error
- func (slow *SlowBlobs) WalkNamespace(ctx context.Context, namespace []byte, walkFunc func(storage.BlobInfo) error) error
- type SlowDB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BadBlobs ¶
type BadBlobs struct {
// contains filtered or unexported fields
}
BadBlobs implements a bad blob store.
func (*BadBlobs) Create ¶
func (bad *BadBlobs) Create(ctx context.Context, ref storage.BlobRef, size int64) (storage.BlobWriter, error)
Create creates a new blob that can be written optionally takes a size argument for performance improvements, -1 is unknown size.
func (*BadBlobs) DeleteWithStorageFormat ¶
func (bad *BadBlobs) DeleteWithStorageFormat(ctx context.Context, ref storage.BlobRef, formatVer storage.FormatVersion) error
DeleteWithStorageFormat deletes the blob with the namespace, key, and format version.
func (*BadBlobs) ListNamespaces ¶
ListNamespaces returns all namespaces that might be storing data.
func (*BadBlobs) OpenWithStorageFormat ¶
func (bad *BadBlobs) OpenWithStorageFormat(ctx context.Context, ref storage.BlobRef, formatVer storage.FormatVersion) (storage.BlobReader, error)
OpenWithStorageFormat opens a reader for the already-located blob, avoiding the potential need to check multiple storage formats to find the blob.
func (*BadBlobs) RestoreTrash ¶
RestoreTrash restores all files in the trash.
func (*BadBlobs) SetError ¶
SetError configures the blob store to return a specific error for all operations.
func (*BadBlobs) SpaceUsedInNamespace ¶
SpaceUsedInNamespace adds up how much is used in the given namespace.
func (*BadBlobs) StatWithStorageFormat ¶
func (bad *BadBlobs) StatWithStorageFormat(ctx context.Context, ref storage.BlobRef, formatVer storage.FormatVersion) (storage.BlobInfo, error)
StatWithStorageFormat looks up disk metadata for the blob file with the given storage format version. This avoids the potential need to check multiple storage formats for the blob when the format is already known.
func (*BadBlobs) WalkNamespace ¶
func (bad *BadBlobs) WalkNamespace(ctx context.Context, namespace []byte, walkFunc func(storage.BlobInfo) error) error
WalkNamespace executes walkFunc for each locally stored blob in the given namespace. If walkFunc returns a non-nil error, WalkNamespace will stop iterating and return the error immediately.
type BadDB ¶
type BadDB struct { storagenode.DB // contains filtered or unexported fields }
BadDB implements bad storage node DB.
type SlowBlobs ¶
type SlowBlobs struct {
// contains filtered or unexported fields
}
SlowBlobs implements a slow blob store.
func (*SlowBlobs) Create ¶
func (slow *SlowBlobs) Create(ctx context.Context, ref storage.BlobRef, size int64) (storage.BlobWriter, error)
Create creates a new blob that can be written optionally takes a size argument for performance improvements, -1 is unknown size.
func (*SlowBlobs) DeleteWithStorageFormat ¶
func (slow *SlowBlobs) DeleteWithStorageFormat(ctx context.Context, ref storage.BlobRef, formatVer storage.FormatVersion) error
DeleteWithStorageFormat deletes the blob with the namespace, key, and format version
func (*SlowBlobs) ListNamespaces ¶
ListNamespaces returns all namespaces that might be storing data.
func (*SlowBlobs) OpenWithStorageFormat ¶
func (slow *SlowBlobs) OpenWithStorageFormat(ctx context.Context, ref storage.BlobRef, formatVer storage.FormatVersion) (storage.BlobReader, error)
OpenWithStorageFormat opens a reader for the already-located blob, avoiding the potential need to check multiple storage formats to find the blob.
func (*SlowBlobs) RestoreTrash ¶
RestoreTrash restores all files in the trash
func (*SlowBlobs) SetLatency ¶
SetLatency configures the blob store to sleep for delay duration for all operations. A zero or negative delay means no sleep.
func (*SlowBlobs) SpaceUsedInNamespace ¶
SpaceUsedInNamespace adds up how much is used in the given namespace
func (*SlowBlobs) StatWithStorageFormat ¶
func (slow *SlowBlobs) StatWithStorageFormat(ctx context.Context, ref storage.BlobRef, formatVer storage.FormatVersion) (storage.BlobInfo, error)
StatWithStorageFormat looks up disk metadata for the blob file with the given storage format version. This avoids the potential need to check multiple storage formats for the blob when the format is already known.
func (*SlowBlobs) WalkNamespace ¶
func (slow *SlowBlobs) WalkNamespace(ctx context.Context, namespace []byte, walkFunc func(storage.BlobInfo) error) error
WalkNamespace executes walkFunc for each locally stored blob in the given namespace. If walkFunc returns a non-nil error, WalkNamespace will stop iterating and return the error immediately.
type SlowDB ¶
type SlowDB struct { storagenode.DB // contains filtered or unexported fields }
SlowDB implements slow storage node DB.
func NewSlowDB ¶
func NewSlowDB(log *zap.Logger, db storagenode.DB) *SlowDB
NewSlowDB creates a new slow storage node DB wrapping the provided db. Use SetLatency to dynamically configure the latency of all piece operations.
func (*SlowDB) SetLatency ¶
SetLatency enables a sleep for delay duration for all piece operations. A zero or negative delay means no sleep.