mirror of
https://github.com/logos-messaging/nim-sds.git
synced 2026-05-18 07:59:54 +00:00
feat: inform application layer bloomFilterCapacity > maxMessageCapacity
This commit is contained in:
parent
c977124a7e
commit
faf21c7747
@ -25,8 +25,8 @@ type
|
||||
## filter is NOT in the snapshot — callers rebuild it from `messageHistory`.
|
||||
lamportTimestamp*: int64
|
||||
messageHistory*: seq[SdsMessage]
|
||||
## Delivered messages, oldest first (insertion order preserved for
|
||||
## causal-history tail access and FIFO eviction).
|
||||
## MUST be ordered oldest-first. FIFO eviction relies on insertion order;
|
||||
## skipping ORDER BY corrupts the log across restarts.
|
||||
outgoingBuffer*: seq[UnacknowledgedMessage]
|
||||
incomingBuffer*: seq[IncomingMessage]
|
||||
outgoingRepairBuffer*: seq[(SdsMessageID, OutgoingRepairEntry)]
|
||||
@ -75,7 +75,7 @@ type
|
||||
removeIncomingRepair*:
|
||||
proc(channelId: SdsChannelID, msgId: SdsMessageID) {.gcsafe, raises: [].}
|
||||
|
||||
# Bootstrap on `addChannel` / `getOrCreateChannel`
|
||||
# Bootstrap on `addChannel` / `getOrCreateChannel`.
|
||||
loadAllForChannel*:
|
||||
proc(channelId: SdsChannelID): ChannelSnapshot {.gcsafe, raises: [].}
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import std/times
|
||||
import chronicles
|
||||
|
||||
const
|
||||
DefaultMaxMessageHistory* = 1000
|
||||
@ -49,6 +50,13 @@ proc init*(
|
||||
maxRepairRequests: int = DefaultMaxRepairRequests,
|
||||
repairSweepInterval: Duration = DefaultRepairSweepInterval,
|
||||
): T =
|
||||
# Bloom is rebuilt by replaying messageHistory on restart and is also the
|
||||
# outgoing summary peers see. A bloom smaller than the log causes continuous
|
||||
# clean() churn and incomplete summaries to peers, with no compensating gain.
|
||||
if maxMessageHistory > bloomFilterCapacity:
|
||||
warn "maxMessageHistory > bloomFilterCapacity will cause continuous bloom rebuilds and incomplete summaries to peers; reduce maxMessageHistory or increase bloomFilterCapacity unless you have a specific reason",
|
||||
maxMessageHistory = maxMessageHistory,
|
||||
bloomFilterCapacity = bloomFilterCapacity
|
||||
return T(
|
||||
bloomFilterCapacity: bloomFilterCapacity,
|
||||
bloomFilterErrorRate: bloomFilterErrorRate,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user