mirror of
https://github.com/aziascreations/BakaShrot.git
synced 2026-11-23 20:58:46 +01:00
Add pushed_at timestamps and per-topic retention
- Every message is stamped with the time its push arrived (UTC ms since 1970, the server's clock), carried as is by replication. Exposed in LatestMessage and Messages, BakaShrot_GetMessagePushedAt() in the DLL, Message.pushed_at / .pushed in Python, GetMessages --time, GetLatestMessage, and the messages view (pushed_at, pushed_utc). - [BakaShrot.Retention] in each server's config: a max age per topic, by name, id, pattern or *, ages like 30d or 1d12h. A background pass (Server/Storage/Retention.pbi, every RetentionInterval seconds) deletes what's older, in batches through the writer. node_heads is left as is, so ids never go back and peers don't resend what was deleted. - Replicated messages already past the receiver's max age are skipped on arrival, their head still raised so they aren't sent again. - Schema v6: data.pushed_at (older databases stamped at upgrade time), a (topic_id, pushed_at) index, the unused archives table dropped. The writer takes the next id from node_heads. - Folded into protocol 3, not released yet. - Tests/Retention-Test.ps1 (52 checks), Python checks for pushed_at. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RwFeVPXGLs3KK1MAQn3ouP
This commit is contained in:
@@ -54,6 +54,23 @@ Node =
|
||||
; kitchen = 2
|
||||
|
||||
|
||||
[BakaShrot.Retention]
|
||||
; How long this server keeps each topic's messages, counted from when they
|
||||
; were pushed (to whichever server they were first pushed to). Past that,
|
||||
; they may be deleted: checked every RetentionInterval seconds. Each server
|
||||
; has its own: a peer keeps its copies as long as its own config says.
|
||||
; One line per topic: name or id = age, a pattern (sensors.*), or * for
|
||||
; every topic not listed. A topic takes its id's line, else its name's,
|
||||
; else the first pattern matching it, else *'s.
|
||||
; Ages: numbers with a unit, s m h d w, added up (1d12h), or forever.
|
||||
; Without any line, everything is kept forever.
|
||||
; Deleting doesn't shrink the file, SQLite reuses the space for new
|
||||
; messages; the "vacuum" console command gives it back to the disk.
|
||||
; logs = 30d
|
||||
; sensors.* = 12h
|
||||
; * = 365d
|
||||
|
||||
|
||||
[BakaShrot.Server]
|
||||
; IPV4 that the server will be bound to.
|
||||
Host =
|
||||
@@ -84,6 +101,10 @@ PeerSyncInterval = 5
|
||||
; A batch is also cut short at about 64 KB, a bigger message goes alone.
|
||||
PeerBatchSize = 100
|
||||
|
||||
; Seconds between two passes deleting the messages past their topic's age
|
||||
; ([BakaShrot.Retention] above). Only runs if a topic has one.
|
||||
RetentionInterval = 60
|
||||
|
||||
|
||||
; One [BakaShrot.Peer.<name>] section per peer this node talks to.
|
||||
; <name> is only a key for this file; it is never sent on the wire.
|
||||
|
||||
Reference in New Issue
Block a user