Documentation
¶
Overview ¶
Package objectstore provides the small S3-compatible object-store surface used by Shrike. It intentionally owns HTTP and signing rather than exposing an SDK client to API packages.
Index ¶
- Constants
- type FilePruneOptions
- type FilePruneResult
- type FileStore
- func (s *FileStore) Delete(_ context.Context, key string) error
- func (s *FileStore) GetObject(_ context.Context, key string) (*Object, error)
- func (s *FileStore) Prune(ctx context.Context, options FilePruneOptions) (FilePruneResult, error)
- func (s *FileStore) PutWithOptions(_ context.Context, key string, body []byte, options PutOptions) error
- func (s *FileStore) Stat(_ context.Context, key string) (*ObjectInfo, error)
- type Object
- type ObjectInfo
- type PutOptions
- type S3Options
- type S3Store
- func (s *S3Store) Delete(ctx context.Context, key string) error
- func (s *S3Store) Get(ctx context.Context, key string) ([]byte, error)
- func (s *S3Store) GetObject(ctx context.Context, key string) (*Object, error)
- func (s *S3Store) Put(ctx context.Context, key string, body []byte, contentType string) error
- func (s *S3Store) PutWithOptions(ctx context.Context, key string, body []byte, options PutOptions) error
- func (s *S3Store) Stat(ctx context.Context, key string) (*ObjectInfo, error)
Constants ¶
const (
BackblazeRegion = "eu-central-003"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FilePruneOptions ¶ added in v0.1.80
type FilePruneOptions struct {
HighWatermarkPercent int
LowWatermarkPercent int
MinimumAge time.Duration
DryRun bool
Now time.Time
}
FilePruneOptions controls the high/low-watermark image eviction pass. Access recency comes from filesystem atime; production mounts must not use noatime. Relatime is sufficient and deliberately coarsens write traffic.
type FilePruneResult ¶ added in v0.1.80
type FilePruneResult struct {
Triggered bool `json:"triggered"`
DryRun bool `json:"dry_run"`
ObjectsScanned uint64 `json:"objects_scanned"`
ObjectsDeleted uint64 `json:"objects_deleted"`
BytesReclaimed uint64 `json:"bytes_reclaimed"`
InodesReclaimed uint64 `json:"inodes_reclaimed"`
BytesUsedBefore uint64 `json:"bytes_used_before"`
BytesUsedAfter uint64 `json:"bytes_used_after"`
InodesUsedBefore uint64 `json:"inodes_used_before"`
InodesUsedAfter uint64 `json:"inodes_used_after"`
}
type FileStore ¶ added in v0.1.5
type FileStore struct {
// contains filtered or unexported fields
}
FileStore implements the image object-store contract on a local filesystem. Bodies and metadata are replaced atomically, so concurrent readers never see a partially written image.
func NewFileStore ¶ added in v0.1.5
func (*FileStore) Prune ¶ added in v0.1.80
func (s *FileStore) Prune(ctx context.Context, options FilePruneOptions) (FilePruneResult, error)
Prune evicts least-recently-accessed objects when either byte or inode use reaches the high watermark, and continues until both are below the low watermark. Metadata sidecars are always removed with their object.
func (*FileStore) PutWithOptions ¶ added in v0.1.5
type Object ¶
type Object struct {
Body []byte
ObjectInfo
}
Object is an object body together with the metadata returned by B2.
type ObjectInfo ¶
type ObjectInfo struct {
Key string
Size int64
ETag string
ContentType string
CacheControl string
LastModified time.Time
Metadata map[string]string
}
ObjectInfo is the metadata available from S3 HEAD and GET responses.
type PutOptions ¶
type S3Store ¶
type S3Store struct {
// contains filtered or unexported fields
}
S3Store is a path-style, Signature V4 S3 client with a small in-process read cache. Backblaze B2 implements this protocol and uses path-style bucket URLs at the endpoint already present in the TypeScript deployment.
func NewS3Store ¶
func (*S3Store) GetObject ¶
GetObject bypasses the small generic cache so callers that need current ETags and metadata do not accidentally pair a cached body with fresh object metadata. The image service owns its own response cache and uses this method.