macula_store_pacer (macula v11.5.0)
View SourceA caller-side bucket of record bytes per connection, so a node that writes many records stays under the station's STORE allowance (D28, 3.5): 16 MiB at once, refilled at 1 MiB per second. await/2 sleeps in the calling process until the bucket allows Bytes and records them, so a put path that paces here never runs into a station's stored` 0 for the byte allowance. The bucket is recomputed lazily on each check, like `macula_dht_budget`s, so an idle connection's bucket never grows past its capacity and there is no timer per connection.
A record is at most 256 KiB, so one await never sleeps more than about 15 seconds past a full bucket, and an honest renewer's traffic (small records renewed on their own cadence) never waits at all.
Summary
Functions
Sleep in the calling process until Bytes fit the connection's bucket, then record them. Bytes is the record's wire size.
The connection's current bucket, for tests and diagnostics.
Types
Functions
-spec await(connection(), non_neg_integer()) -> ok.
Sleep in the calling process until Bytes fit the connection's bucket, then record them. Bytes is the record's wire size.
-spec stats(connection()) -> #{bucket := non_neg_integer()}.
The connection's current bucket, for tests and diagnostics.