1
0
mirror of https://github.com/aziascreations/BakaShrot.git synced 2026-11-23 20:58:46 +01:00
Files
BakaShrot/crates/bakashrot-config/example.toml
T
aziascreations 1bae8ee182 Stopped long queries, Read is_open() through TLS, Simplified answers and paging
- [server] query_time_limit (20 s by default) stops a client's query
  through SQLite's progress handler: refused with QueryTimedOut (11). A
  client closing while its query runs stops it too.
- The answer timeout in the DLL (BakaShrot_SetAnswerTimeout /
  GetAnswerTimeout, kept across connections), Python (answer_timeout)
  and C# (AnswerTimeoutMs); QueryTimedOut in every binding.
- is_open() reads what's waiting through TLS: a close_notify says
  closed, TLS's own records keep it open, unasked data or a broken
  stream close it.
- The Rust client checks an answer's type in one place (TryFrom per
  packet); Client::wait() pings while waiting (the tool's --follow).
- Pair::from(&Head), heads_after taking a Pair; simpler SyncState
  paging on both ends; the writer's redundant rollback check dropped.
- codes.rs: the bindings' error codes and copied values match Rust's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 12:17:28 +01:00

81 lines
3.8 KiB
TOML

# A BakaShrot server's config, every key with its default where it has
# one. Read by bakashrot-config, explained in docs/config.md.
#
# Names (topics, nodes, roles): 1-64 of A-Z a-z 0-9 _ . -, not only digits,
# case doesn't matter. Lists of topics or nodes also take patterns: * any
# characters, ? one ("sensors.*"), or "*" for all.
# Names with dots are quoted when they're keys: "sensors.kitchen" = "12h",
# [roles."site.reader"]. Durations: numbers with a unit (s m h d w), like
# "30s" or "1d12h". Relative paths are from this file's folder.
[server]
listen = "0.0.0.0:7000" # required: address and port
# The certificates (bakashrot cert), required. The node this server is,
# for its peers, is its certificate's name.
ca = "ca.crt"
certificate = "server-1.crt"
key = "server-1.key"
# crl = "ca.crl" # the CA's CRL, watched: optional
database = "bakashrot.sqlite"
# "full": every push flushed to disk before it's answered, it survives a
# power loss. "normal": about twice the pushes, a power loss loses the last
# second or so. ("off" isn't allowed.)
synchronous = "full"
# Replication cut partway through an attachment resumes once the peer has
# read back and hashed what it already has, in 30 s at most: up to about
# 4 GB received on a hard disk, 15 GB on a SATA SSD, 30-60 GB on NVMe
# (estimates). Past that, resuming fails at every retry: keep attachments
# well under it (more than a few GB is a lot for this anyway).
max_attachment_size = "1G" # bytes, or K M G T (1024-based); 0: none
retention_interval = "1m" # how often old messages are deleted
idle_database_connections = 8 # kept open once idle, for reads and as many for queries; closed after 1 min unused
query_time_limit = "20s" # a client's query stopped (refused) past it; keep it under the clients' answer timeout (30 s)
# How long each topic's messages are kept, from when they were first
# pushed: 100 years ("36500d") at most, or "forever". A topic takes its
# name's line, else the first pattern matching it, else "*"'s; without
# any, it's kept forever.
[retention]
logs = "30d"
"sensors.*" = "12h"
"*" = "forever"
# Who this server replicates with, by address. A link carries messages
# one way: the server that dials sends, the one dialed takes them.
[replication]
push_to = [] # dialed and sent to: ["10.0.0.2:7000", "server-2.lan:7000"]
accept_from = [] # taken from: ["10.0.0.2", "server-2.lan"], or ["*"]
retry_delay = "10s"
sync_interval = "5s" # a link waiting longer than a minute pings meanwhile
batch_size = 1000 # messages per packet, 1-10000
# What certificates with a role may do. A certificate gets everything its
# roles allow; one without any role listed here is refused. Every key is
# optional: an empty list allows nothing. The topics are only named here:
# one exists from its first message, pushed (push_topics) or replicated
# (accept_topics). A database holds 1,048,575 topic and node pairs at
# most, all topics together, never freed: patterns like "*" in
# push_topics let clients make as many as they like.
[roles.sensor]
push_topics = ["sensors.*"] # always as its own node (its name)
[roles.dashboard]
read_topics = ["*"]
query = true # read-only SQL, reads every topic
# Listing answers the topics it may push to or read, and the nodes of the
# topics it may read. These answer every one (query does too):
# list_topics = true
# list_nodes = true
# Peers are roles too: what's replicated with a server whose certificate
# has this role, whichever end dials.
[roles.peer]
send_topics = ["logs", "sensors.*"]
accept_topics = ["logs"]
send_nodes = ["*"] # the default
accept_nodes = ["*"] # the default