Documentation ¶
Index ¶
- Constants
- func ParseHost(s string) (bucket, region, endpoint string, forcePathStyle bool)
- type ReplicaClient
- func (c *ReplicaClient) DeleteAll(ctx context.Context) error
- func (c *ReplicaClient) DeleteGeneration(ctx context.Context, generation string) error
- func (c *ReplicaClient) DeleteSnapshot(ctx context.Context, generation string, index int) error
- func (c *ReplicaClient) DeleteWALSegments(ctx context.Context, a []litestream.Pos) error
- func (c *ReplicaClient) Generations(ctx context.Context) ([]string, error)
- func (c *ReplicaClient) Init(ctx context.Context) (err error)
- func (c *ReplicaClient) SnapshotReader(ctx context.Context, generation string, index int) (io.ReadCloser, error)
- func (c *ReplicaClient) Snapshots(ctx context.Context, generation string) (litestream.SnapshotIterator, error)
- func (c *ReplicaClient) Type() string
- func (c *ReplicaClient) WALSegmentReader(ctx context.Context, pos litestream.Pos) (io.ReadCloser, error)
- func (c *ReplicaClient) WALSegments(ctx context.Context, generation string) (litestream.WALSegmentIterator, error)
- func (c *ReplicaClient) WriteSnapshot(ctx context.Context, generation string, index int, rd io.Reader) (info litestream.SnapshotInfo, err error)
- func (c *ReplicaClient) WriteWALSegment(ctx context.Context, pos litestream.Pos, rd io.Reader) (info litestream.WALSegmentInfo, err error)
Constants ¶
const DefaultRegion = "us-east-1"
DefaultRegion is the region used if one is not specified.
const MaxKeys = 1000
MaxKeys is the number of keys S3 can operate on per batch.
const ReplicaClientType = "s3"
ReplicaClientType is the client type for this package.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ReplicaClient ¶
type ReplicaClient struct { // AWS authentication keys. AccessKeyID string SecretAccessKey string // S3 bucket information Region string Bucket string Path string Endpoint string ForcePathStyle bool SkipVerify bool // contains filtered or unexported fields }
ReplicaClient is a client for writing snapshots & WAL segments to disk.
func NewReplicaClient ¶
func NewReplicaClient() *ReplicaClient
NewReplicaClient returns a new instance of ReplicaClient.
func (*ReplicaClient) DeleteAll ¶
func (c *ReplicaClient) DeleteAll(ctx context.Context) error
DeleteAll deletes everything on the remote path. Mainly used for testing.
func (*ReplicaClient) DeleteGeneration ¶
func (c *ReplicaClient) DeleteGeneration(ctx context.Context, generation string) error
DeleteGeneration deletes all snapshots & WAL segments within a generation.
func (*ReplicaClient) DeleteSnapshot ¶
DeleteSnapshot deletes a snapshot with the given generation & index.
func (*ReplicaClient) DeleteWALSegments ¶
func (c *ReplicaClient) DeleteWALSegments(ctx context.Context, a []litestream.Pos) error
DeleteWALSegments deletes WAL segments with at the given positions.
func (*ReplicaClient) Generations ¶
func (c *ReplicaClient) Generations(ctx context.Context) ([]string, error)
Generations returns a list of available generation names.
func (*ReplicaClient) Init ¶
func (c *ReplicaClient) Init(ctx context.Context) (err error)
Init initializes the connection to S3. No-op if already initialized.
func (*ReplicaClient) SnapshotReader ¶
func (c *ReplicaClient) SnapshotReader(ctx context.Context, generation string, index int) (io.ReadCloser, error)
SnapshotReader returns a reader for snapshot data at the given generation/index.
func (*ReplicaClient) Snapshots ¶
func (c *ReplicaClient) Snapshots(ctx context.Context, generation string) (litestream.SnapshotIterator, error)
Snapshots returns an iterator over all available snapshots for a generation.
func (*ReplicaClient) Type ¶
func (c *ReplicaClient) Type() string
Type returns "s3" as the client type.
func (*ReplicaClient) WALSegmentReader ¶
func (c *ReplicaClient) WALSegmentReader(ctx context.Context, pos litestream.Pos) (io.ReadCloser, error)
WALSegmentReader returns a reader for a section of WAL data at the given index. Returns os.ErrNotExist if no matching index/offset is found.
func (*ReplicaClient) WALSegments ¶
func (c *ReplicaClient) WALSegments(ctx context.Context, generation string) (litestream.WALSegmentIterator, error)
WALSegments returns an iterator over all available WAL files for a generation.
func (*ReplicaClient) WriteSnapshot ¶
func (c *ReplicaClient) WriteSnapshot(ctx context.Context, generation string, index int, rd io.Reader) (info litestream.SnapshotInfo, err error)
WriteSnapshot writes LZ4 compressed data from rd into a file on disk.
func (*ReplicaClient) WriteWALSegment ¶
func (c *ReplicaClient) WriteWALSegment(ctx context.Context, pos litestream.Pos, rd io.Reader) (info litestream.WALSegmentInfo, err error)
WriteWALSegment writes LZ4 compressed data from rd into a file on disk.