MCPcopy
hub / github.com/benbjohnson/litestream / ReplicaClient

Interface ReplicaClient

replica_client.go:19–51  ·  view source on GitHub ↗

ReplicaClient represents client to connect to a Replica.

Source from the content-addressed store, hash-verified

17
18// ReplicaClient represents client to connect to a Replica.
19type ReplicaClient interface {
20 // Type returns the type of client.
21 Type() string
22
23 // Init initializes the replica client connection.
24 // This may establish connections, validate configuration, etc.
25 // Implementations should be idempotent (no-op if already initialized).
26 Init(ctx context.Context) error
27
28 // LTXFiles returns an iterator of all LTX files on the replica for a given level.
29 // If seek is specified, the iterator start from the given TXID or the next available if not found.
30 // If useMetadata is true, the iterator fetches accurate timestamps from metadata for timestamp-based restore.
31 // When false, the iterator uses fast timestamps (LastModified/Created/ModTime) for normal operations.
32 LTXFiles(ctx context.Context, level int, seek ltx.TXID, useMetadata bool) (ltx.FileIterator, error)
33
34 // OpenLTXFile returns a reader that contains an LTX file at a given TXID.
35 // If seek is specified, the reader will start at the given offset.
36 // Returns an os.ErrNotFound error if the LTX file does not exist.
37 OpenLTXFile(ctx context.Context, level int, minTXID, maxTXID ltx.TXID, offset, size int64) (io.ReadCloser, error)
38
39 // WriteLTXFile writes an LTX file to the replica.
40 // Returns metadata for the written file.
41 WriteLTXFile(ctx context.Context, level int, minTXID, maxTXID ltx.TXID, r io.Reader) (*ltx.FileInfo, error)
42
43 // DeleteLTXFiles deletes one or more LTX files.
44 DeleteLTXFiles(ctx context.Context, a []*ltx.FileInfo) error
45
46 // DeleteAll deletes all files.
47 DeleteAll(ctx context.Context) error
48
49 // SetLogger sets the logger for the client.
50 SetLogger(logger *slog.Logger)
51}
52
53// FindLTXFiles returns a list of files that match filter.
54// The useMetadata parameter is passed through to LTXFiles to control whether accurate timestamps

Implementers 12

followTestReplicaClientreplica_internal_test.go
delayedReplicaClientstore_compaction_remote_test.go
testReplicaClientdb_internal_test.go
ReplicaClientwebdav/replica_client.go
ReplicaClientoss/replica_client.go
ReplicaClients3/replica_client.go
ReplicaClientfile/replica_client.go
ReplicaClientgs/replica_client.go
ReplicaClientmock/replica_client.go
ReplicaClientabs/replica_client.go
ReplicaClientnats/replica_client.go
ReplicaClientsftp/replica_client.go

Calls

no outgoing calls

Tested by

no test coverage detected