Configuration¶
Storage¶
Pass storage settings to CairnDB.configure as a dict with a type
discriminator, which defaults to "filesystem":
CairnDB.configure({"storage": {"type": "s3", "bucket": "myapp", "region": "eu-west-1"}})
CairnDB.configure(S3StorageConfig(bucket="myapp")) # or a config object
CairnDB(storage) # or an existing backend
Configs are validated when they are constructed: a config object that
exists is usable. An unknown type raises ConfigurationError, and
missing or unknown fields raise ValueError.
filesystem¶
Field |
Type |
Default |
Meaning |
|---|---|---|---|
|
str |
required |
root directory |
s3¶
Field |
Type |
Default |
Meaning |
|---|---|---|---|
|
str |
required |
bucket name |
|
str |
|
key prefix for everything this engine stores |
|
str | None |
|
AWS region; boto3’s default otherwise |
|
str | None |
|
custom endpoint for S3-compatible stores (MinIO, R2, LocalStack) |
Credentials come from boto3’s default chain.
gcs¶
Field |
Type |
Default |
Meaning |
|---|---|---|---|
|
str |
required |
bucket name |
|
str |
|
key prefix |
|
str | None |
|
GCP project id |
|
str | None |
|
service-account JSON key; Application Default Credentials otherwise |
azure¶
Field |
Type |
Default |
Meaning |
|---|---|---|---|
|
str |
required |
blob container name |
|
str |
|
blob name prefix |
|
str | None |
|
full connection string |
|
str | None |
|
|
Exactly one of connection_string and account_url is required. If
both are given, connection_string wins.
Environment variables¶
StorageConfig.from_env(), ClientConfig.from_env(), and the CLI read
these variables.
Storage variables¶
Variable |
Backend |
Maps to |
|---|---|---|
|
all |
|
|
filesystem |
|
|
s3, gcs, azure |
|
|
s3 (and gcs, as a fallback) |
|
|
gcs |
|
|
s3 |
|
|
s3 |
|
|
gcs |
|
|
gcs |
|
|
azure |
|
|
azure |
|
|
azure |
|
For GCS, CAIRNDB_GCS_BUCKET wins. CAIRNDB_S3_BUCKET is read as a
fallback when it is unset.
CLI variables¶
Variable |
Default |
Meaning |
|---|---|---|
|
unset (root log) |
named log the jobs act on; same as |
Client variables¶
These are used by ClientConfig.from_env() and cairndb rebuild:
Variable |
Default |
Meaning |
|---|---|---|
|
|
local SQLite projection path |
|
|
seconds between polls, in (0, 3600] |
|
|
projection schema version ( |
Provider SDK variables apply as usual, for example AWS_PROFILE,
AWS_DEFAULT_REGION, GOOGLE_APPLICATION_CREDENTIALS, and
AZURE_CLIENT_ID.
Projection options¶
These are the arguments of db.projection(name, ...):
Argument |
Default |
Meaning |
|---|---|---|
|
|
the named log to project |
|
|
projection schema version; selects |
|
|
local SQLite file |
|
|
seconds between background polls |
|
|
|
|
|
an existing |
Every component that names snapshots defaults to the same projection
schema version, "1": db.projection, ClientConfig, SnapshotBuilder,
and the CLI. It is available as
cairndb.storage.base.DEFAULT_SCHEMA_VERSION.
Client options¶
ClientConfig configures the lower-level
CairnDBClient:
Field |
Default |
Meaning |
|---|---|---|
|
|
a |
|
|
projection path |
|
|
in (0, 3600] |
|
|
copy-on-write copies during the atomic swap, when supported |
|
|
projection schema version |
Committer options¶
CommitterConfig tunes the write path. Pass it to Committer, or to
Log(..., committer_config=...):
Field |
Default |
Range |
Meaning |
|---|---|---|---|
|
|
1 – 100 000 |
cap on events per commit object |
|
|
0 – 10 |
linger before committing to grow batches; 0 still batches what arrives during a PUT |
|
|
≥ 1 |
attempts per batch before appends fail with |
|
|
0 – 5 |
backoff when a PUT was rejected but the winner is not visible yet |
|
|
≥ 0 |
commits at or below this are known to exist; speeds up cold-start tail discovery |
Coordination defaults¶
Setting |
Value |
|---|---|
|
10 |
Lease |
required, > 0 seconds |
Lease |
|