Documentation ¶
Index ¶
- Constants
- type ReplicaClient
- 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) GenerationDir(generation string) (string, error)
- func (c *ReplicaClient) Generations(ctx context.Context) ([]string, error)
- func (c *ReplicaClient) GenerationsDir() (string, error)
- func (c *ReplicaClient) Path() string
- func (c *ReplicaClient) SnapshotPath(generation string, index int) (string, 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) SnapshotsDir(generation string) (string, error)
- func (c *ReplicaClient) Type() string
- func (c *ReplicaClient) WALDir(generation string) (string, error)
- func (c *ReplicaClient) WALSegmentPath(generation string, index int, offset int64) (string, error)
- 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 ReplicaClientType = "file"
ReplicaClientType is the client type for this package.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReplicaClient ¶
type ReplicaClient struct { Replica *litestream.Replica // contains filtered or unexported fields }
ReplicaClient is a client for writing snapshots & WAL segments to disk.
func NewReplicaClient ¶
func NewReplicaClient(path string) *ReplicaClient
NewReplicaClient returns a new instance of ReplicaClient.
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 at the given positions.
func (*ReplicaClient) GenerationDir ¶
func (c *ReplicaClient) GenerationDir(generation string) (string, error)
GenerationDir returns the path to a generation's root directory.
func (*ReplicaClient) Generations ¶
func (c *ReplicaClient) Generations(ctx context.Context) ([]string, error)
Generations returns a list of available generation names.
func (*ReplicaClient) GenerationsDir ¶
func (c *ReplicaClient) GenerationsDir() (string, error)
GenerationsDir returns the path to a generation root directory.
func (*ReplicaClient) Path ¶
func (c *ReplicaClient) Path() string
Path returns the destination path to replicate the database to.
func (*ReplicaClient) SnapshotPath ¶
func (c *ReplicaClient) SnapshotPath(generation string, index int) (string, error)
SnapshotPath returns the path to an uncompressed snapshot file.
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. Returns os.ErrNotExist if no matching index is found.
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) SnapshotsDir ¶
func (c *ReplicaClient) SnapshotsDir(generation string) (string, error)
SnapshotsDir returns the path to a generation's snapshot directory.
func (*ReplicaClient) Type ¶
func (c *ReplicaClient) Type() string
Type returns "file" as the client type.
func (*ReplicaClient) WALDir ¶
func (c *ReplicaClient) WALDir(generation string) (string, error)
WALDir returns the path to a generation's WAL directory
func (*ReplicaClient) WALSegmentPath ¶
WALSegmentPath returns the path to a WAL segment file.
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 position. 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.