Documentation
¶
Overview ¶
Package objectstore keeps the last valid snapshot of each source in an S3 bucket, the production store of ADR 0005: Scaleway Object Storage in fr-par, shared by the sync job and the API container, which have no volume in common.
Each source is one object whose key is the file name of package store (amf.snapshot) and whose content is its file format, envelope and digest included: Load checks a downloaded object as store.Disk checks a file. A PUT replaces an object at once, so a reader gets the previous snapshot or the new one, never part of one.
Load remembers the entity tag of the last object it accepted for each source and sends it in If-None-Match: while the object is unchanged, the bucket answers 304 and the remembered snapshot is returned without a download. The API reloads every minute; the sync job writes a few times a day.
Requests go path-style to the endpoint host, signed with AWS Signature Version 4, through the given HTTP client: in production the platform client, which allows that host only and bounds time and response size.
Index ¶
Constants ¶
const ( Host = "s3.fr-par.scw.cloud" Region = "fr-par" )
Scaleway Object Storage in fr-par (ADR 0005), the defaults of Options.
const DefaultAttempts = 3
DefaultAttempts is the number of tries of a request the bucket answers with a 5xx, a throttle or a network error, the first one included.
Variables ¶
var ErrInvalidOptions = errors.New("invalid object store options")
ErrInvalidOptions means New was given Options it cannot use.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// Endpoint is the HTTPS URL of the S3 API; "https://" + Host when
// empty.
Endpoint string
// Region signs the requests; Region when empty.
Region string
// Bucket holds the snapshots. Required.
Bucket string
// AccessKey and SecretKey are the credentials of the bucket. Required.
AccessKey string
SecretKey config.Secret
// HTTP sends the requests: the platform client, which allows the
// endpoint host only and bounds time and size. Required.
HTTP s3.HTTPClient
// Attempts is the number of tries of a request; DefaultAttempts when
// 0.
Attempts int
}
Options configures a Store.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store keeps one object per source in a bucket. It implements app.SnapshotStore and is safe for concurrent use.