Documentation
¶
Overview ¶
Package storagefs implements fs.Storage.
Index ¶
- type ObjectRef
- type Option
- type ScrubOptions
- type ScrubReport
- type Storage
- func (s *Storage) AbortMultipartUpload(_ context.Context, _, _, uploadID string) error
- func (s *Storage) BucketACL(_ context.Context, bucket string) (fs.ACL, error)
- func (s *Storage) BucketExists(_ context.Context, bucket string) (bool, error)
- func (s *Storage) CompleteMultipartUpload(_ context.Context, req *fs.CompleteMultipartUploadRequest) (*fs.CompleteMultipartUploadResponse, error)
- func (s *Storage) CreateBucket(ctx context.Context, bucket string) error
- func (s *Storage) CreateMultipartUpload(_ context.Context, req *fs.CreateMultipartUploadRequest) (*fs.MultipartUpload, error)
- func (s *Storage) DeleteBucket(ctx context.Context, bucket string) error
- func (s *Storage) DeleteObject(ctx context.Context, bucket, key string) error
- func (s *Storage) DeleteObjectTagging(_ context.Context, bucket, key string) error
- func (s *Storage) GetObject(ctx context.Context, bucket, key string) (*fs.GetObjectResponse, error)
- func (s *Storage) GetObjectTagging(_ context.Context, bucket, key string) ([]fs.Tag, error)
- func (s *Storage) ListBuckets(ctx context.Context) ([]fs.Bucket, error)
- func (s *Storage) ListMultipartUploads(_ context.Context, bucket string) ([]fs.MultipartUpload, error)
- func (s *Storage) ListObjects(ctx context.Context, bucket, prefix string) ([]fs.Object, error)
- func (s *Storage) ListParts(_ context.Context, bucket, key, uploadID string) ([]fs.Part, error)
- func (s *Storage) ObjectACL(_ context.Context, bucket, key string) (fs.ACL, error)
- func (s *Storage) ObjectOwner(_ context.Context, bucket, key string) (fs.Owner, error)
- func (s *Storage) PutObject(ctx context.Context, req *fs.PutObjectRequest) (*fs.PutObjectResponse, error)
- func (s *Storage) PutObjectTagging(_ context.Context, bucket, key string, tags []fs.Tag) error
- func (s *Storage) Scrub(ctx context.Context, opts ScrubOptions) (*ScrubReport, error)
- func (s *Storage) SetBucketACL(_ context.Context, bucket string, acl fs.ACL) error
- func (s *Storage) SetObjectACL(_ context.Context, bucket, key string, acl fs.ACL) error
- func (s *Storage) UploadPart(_ context.Context, req *fs.UploadPartRequest) (*fs.Part, error)
- type SyncPolicy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶ added in v0.5.0
type Option func(*Storage)
Option configures a Storage.
func WithSyncPolicy ¶ added in v0.5.0
func WithSyncPolicy(p SyncPolicy) Option
WithSyncPolicy sets the durability policy (default SyncNone).
func WithVerifyReads ¶ added in v0.5.0
WithVerifyReads makes GetObject recompute and check each object's checksum before serving it, returning fs.ErrIntegrity on a mismatch so corrupt data is never served. Off by default: it costs a full extra read per GET.
type ScrubOptions ¶ added in v0.5.0
type ScrubOptions struct {
// Quarantine moves each corrupt object (and its sidecar) into
// <root>/.quarantine so it is no longer served. When false, corruption is
// only reported.
Quarantine bool
}
ScrubOptions configures a scrub pass.
type ScrubReport ¶ added in v0.5.0
type ScrubReport struct {
// Scanned is the number of objects examined.
Scanned int
// OK is the number whose content matched its stored checksum.
OK int
// Corrupt lists objects whose content did not match (bit-rot).
Corrupt []ObjectRef
// Unverifiable is the number with no stored checksum to compare against
// (e.g. pre-checksum data directories).
Unverifiable int
// Quarantined is the number of corrupt objects moved aside.
Quarantined int
}
ScrubReport summarizes a scrub pass.
func (*ScrubReport) Healthy ¶ added in v0.5.0
func (r *ScrubReport) Healthy() bool
Healthy reports whether the pass found no corruption.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func (*Storage) AbortMultipartUpload ¶
func (*Storage) BucketExists ¶
func (*Storage) CompleteMultipartUpload ¶
func (s *Storage) CompleteMultipartUpload(_ context.Context, req *fs.CompleteMultipartUploadRequest) (*fs.CompleteMultipartUploadResponse, error)
func (*Storage) CreateBucket ¶
func (*Storage) CreateMultipartUpload ¶
func (s *Storage) CreateMultipartUpload(_ context.Context, req *fs.CreateMultipartUploadRequest) (*fs.MultipartUpload, error)
func (*Storage) DeleteBucket ¶
DeleteBucket deletes the specified bucket.
NB: bucket is already sanitized.
func (*Storage) DeleteObject ¶
DeleteObject deletes the specified object from the bucket.
NB: bucket and key are already sanitized.
func (*Storage) DeleteObjectTagging ¶ added in v0.4.0
func (*Storage) GetObjectTagging ¶ added in v0.4.0
func (*Storage) ListBuckets ¶
func (*Storage) ListMultipartUploads ¶ added in v0.4.0
func (*Storage) ListObjects ¶
ListObjects lists all objects in bucket by prefix.
NB: bucket and prefix are already sanitized.
func (*Storage) ObjectOwner ¶ added in v0.10.0
ObjectOwner returns the principal recorded when the object was written. Objects stored before owners were modeled report the zero owner.
func (*Storage) PutObject ¶
func (s *Storage) PutObject(ctx context.Context, req *fs.PutObjectRequest) (*fs.PutObjectResponse, error)
func (*Storage) PutObjectTagging ¶ added in v0.4.0
func (*Storage) Scrub ¶ added in v0.5.0
func (s *Storage) Scrub(ctx context.Context, opts ScrubOptions) (*ScrubReport, error)
Scrub walks every object, recomputing its MD5 and comparing to the stored content checksum, reporting (and optionally quarantining) any mismatch. It is safe to run concurrently with serving; it stops early if ctx is canceled.
func (*Storage) SetBucketACL ¶ added in v0.5.0
func (*Storage) SetObjectACL ¶ added in v0.10.0
SetObjectACL rewrites the object's sidecar with the new canned ACL, creating a sidecar for pre-sidecar objects. The object content is not touched.
func (*Storage) UploadPart ¶
type SyncPolicy ¶ added in v0.5.0
type SyncPolicy int
SyncPolicy controls how aggressively storagefs flushes writes to stable storage. Atomicity (no torn object ever visible) comes from the temp-file + rename protocol regardless of policy; SyncPolicy governs durability — whether an acknowledged write survives a power loss.
const ( // SyncNone performs no fsync. Fastest; an acked write may be lost on power // loss (never torn). The library/test default. SyncNone SyncPolicy = iota // SyncFile fsyncs file contents before the rename. The object's data is // durable once PutObject returns; the directory entry (the rename) relies on // the OS to persist it. SyncFile // SyncFileDir fsyncs file contents and the parent directory after the // rename, so both the data and its visibility survive a crash. The binary // default. SyncFileDir )
func ParseSyncPolicy ¶ added in v0.5.0
func ParseSyncPolicy(s string) (SyncPolicy, error)
ParseSyncPolicy maps a config string to a SyncPolicy, defaulting unknown or empty values to SyncFileDir (the safe choice).