1
0
mirror of https://github.com/aziascreations/BakaShrot.git synced 2026-11-23 20:58:46 +01:00

Paged SyncState, Added Ping, Required ALPN on the server, Capped retention ages, Closed idle database connections

- Protocol 8: SyncStateRequest takes `after` (a Pair), SyncState has
  `more` and 32768 heads at most (MAX_HEADS_PER_PACKET), the lists and
  missing attachments in the first page only; heads_after in storage,
  both ends of replication read in pages (step 17)
- Protocol 8: Ping / Pong (19, 20) keep an idle connection open
  (IDLE_TIMEOUT_SECS 300, KEEPALIVE_SECS 60). Client::ping,
  BakaShrot_Ping, Python ping(), C# Ping(), the PureBasic prototype; the
  tool's --follow, Python's follow(), C#'s Follow() and the replication
  links ping every minute while waiting longer, so sync_interval over
  5 min works now (dropped from known-issues.md)
- The server closes a client offering no ALPN right after TLS: rustls
  only refused one offering other protocols
- Retention ages are 100 years at most (MAX_RETENTION_AGE); the cutoff
  is computed once, saturating (Retention::cutoff): a huge age wrapped
  around to almost nothing in milliseconds
- [server] idle_database_connections (8 by default, 0-512): the idle
  read and query connections each pool keeps, those unused for a minute
  closed by a sweeping thread
- Tests for each, docs, the C header, revamp.md (step 18)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 23:19:58 +01:00
parent c513d8bf05
commit 6fae7e61c9
34 changed files with 1066 additions and 164 deletions
+13 -1
View File
@@ -89,10 +89,22 @@ peers' `send_topics`.
`[roles."site.reader"]`. Unquoted, TOML reads dots as tables: refused,
`[retention]` says to quote.
- **Durations:** numbers with a unit (`s m h d w`), added up: `"30s"`,
`"1d12h"`. Ages in `[retention]` can also be `"forever"`.
`"1d12h"`. Ages in `[retention]` can also be `"forever"`, and are 100
years (`"36500d"`) at most (2026-11-19): longer ones once overflowed
when turned into milliseconds, a huge age wrapping around to almost
nothing.
- **Sizes:** bytes, or `"500M"` with `K M G T` (1024-based), up to 1T.
- **Paths:** relative ones are from the config file's folder.
## Database connections
Reads and queries each have a pool of SQLite connections: one is opened
when none is idle, then kept for the next request.
`[server] idle_database_connections` (8 by default, 0 to 512) is how many
idle ones each pool keeps; more are closed as they're put back, and an
idle one is closed after a minute unused (looked at every 10 s). 0 opens
one per request.
## Retention
A topic takes its name's line, else the first pattern matching it in the