Documentation
¶
Overview ¶
Package walship is an opt-in prototype of continuous SQLite replication by WAL frame shipping (ADR 039). It is not wired into the control plane.
Index ¶
Constants ¶
const DefaultCheckpointBytes = 16 << 20
DefaultCheckpointBytes is the WAL size at which the shipper checkpoints and lets SQLite restart the WAL.
const ( // DefaultObjectTimeout bounds one object-store call; callers override it from env. DefaultObjectTimeout = 2 * time.Minute )
Variables ¶
var ErrNoIdentity = errors.New("walship: sink has no age identity to decrypt with")
ErrNoIdentity means a Get was attempted on a sink built without identities.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket interface {
Put(ctx context.Context, key string, body io.ReadSeeker, contentType, contentEncoding string) error
Get(ctx context.Context, key string) (io.ReadCloser, int64, error)
List(ctx context.Context, prefix, token string, limit int32) (ListPage, error)
}
Bucket is the slice of an object-store client the sink needs.
type DirSink ¶
type DirSink struct{ Dir string }
DirSink stores replica objects as files under Dir.
type ListPage ¶
ListPage is one page of keys; local so walship stays off objectstore's import graph and its large fan-in.
type ObjectSink ¶
type ObjectSink struct {
Bucket Bucket
Prefix string
Recipients []age.Recipient
Identities []age.Identity
// Timeout bounds each call; zero means DefaultObjectTimeout.
Timeout time.Duration
// TempDir holds ciphertext while uploading; empty uses the OS default.
TempDir string
}
ObjectSink stores each replica object as one age-encrypted S3 object under Prefix, so the bucket only ever sees ciphertext. The shipping side needs only Recipients; the standby adds Identities to read.
func (*ObjectSink) Get ¶
func (o *ObjectSink) Get(name string) (io.ReadCloser, error)
Get downloads and decrypts name. The timeout covers the whole read.
type Reader ¶
type Reader struct{ Sink Sink }
Reader lists and fetches what a Shipper wrote; promote and status build on it.
func (Reader) Generations ¶
Generations returns generation numbers that have a snapshot, ascending.
type RestoreResult ¶
type RestoreResult struct {
Generation int
Epochs int
FrameBytes int64
// Truncated is true when a missing segment stopped replay early.
Truncated bool
}
RestoreResult describes what Restore replayed.
type Shipper ¶
type Shipper struct {
// contains filtered or unexported fields
}
Shipper copies new WAL frames of one SQLite database to a Sink. It holds a read transaction between syncs so SQLite cannot restart the WAL under it.
func New ¶
New opens a shipper for the database at path. checkpointBytes <= 0 uses DefaultCheckpointBytes.