Documentation
¶
Overview ¶
Package objstore is a thin S3 client (AWS SDK for Go v2) for offloading etcd snapshots to an S3-compatible object store — AWS S3, MinIO, Ceph RGW, etc. A custom BaseEndpoint + path-style addressing makes the non-AWS stores work. Credentials are passed in a Target (loaded from /etc/stratum/snapshot.conf or the environment) — never on the command line.
Index ¶
- func RemoveStaleTemps(root *os.Root, name string, olderThan time.Duration) error
- type Object
- type Target
- func (t *Target) Download(ctx context.Context, root *os.Root, name string) error
- func (t *Target) Enabled() bool
- func (t *Target) Key(name string) string
- func (t *Target) List(ctx context.Context) ([]Object, error)
- func (t *Target) Prune(ctx context.Context, owned func(name string) bool, keep int) error
- func (t *Target) Upload(ctx context.Context, localPath, name string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RemoveStaleTemps ¶
RemoveStaleTemps removes from root the regular files named like the temp files Download makes for name (".<name>.<digits>") that were last written more than olderThan ago: what a SIGKILL or power loss mid-download leaves, a partial copy of a snapshot. Younger ones may be a concurrent download's.
Types ¶
type Target ¶
type Target struct {
Endpoint string // custom endpoint for S3-compatible stores; empty = real AWS
Region string // default "us-east-1"
Bucket string
Prefix string // key prefix (folder within the bucket)
AccessKey string
SecretKey string
PathStyle bool // true for MinIO/Ceph and most non-AWS endpoints
}
Target describes an S3-compatible destination for snapshots.
func (*Target) Download ¶
Download fetches object `name` into root (multipart), as a file called name. The file is written 0600 to a temp file beside it and renamed into place once complete, so a failed download leaves an existing file untouched, and a symlink at that name is replaced, never followed. root is a directory handle, not a path, so the directory that was checked is the one written even if its name is swapped meanwhile.