14 lines
293 B
Nim
Raw Normal View History

2025-07-16 10:05:47 +03:00
import std/[times, deques, options]
2025-07-14 11:14:36 +03:00
import chronos
type
BucketState* = object
budget*: int
budgetCap*: int
lastTimeFull*: Moment
2025-07-16 15:51:26 +03:00
RateLimitStore* =
2025-07-14 11:14:36 +03:00
concept s
s.saveBucketState(BucketState) is Future[bool]
2025-07-16 10:05:47 +03:00
s.loadBucketState() is Future[Option[BucketState]]