Skip to content

gateway: decide whether the allowance survives a restart, and persist it if so #2618

Closed as not planned

Description

@thiras

Follow-up to #2593 (public gateway).

Today. The allowance (--allowance-bytes-per-day, --allowance <ns>=<bytes>) is metered in memory. A restart forgives whatever was spent that UTC day, by design: the pool balance is the hard stop (crates/cli/src/commands/gateway/allowance.rs module doc, adr/appendix-gateway.md § Payment and allowance).

Ask. Decide whether a restart should forgive the day. If not, persist the per-bucket (day, bytes) under <data-dir>/store (or a small file next to pointers/) on each charge batch and reload at start. The per-namespace buckets make this matter more than it did: an operator who gives a partner 20 GiB/day and restarts for a release has reset that partner's day, and a namespace that is refused could ask for a restart. Keep writes rare (every N MiB or every few seconds), and keep the shape out of the ADRs unless it becomes part of what a publisher can rely on.

Why. Operators will reason about the allowance as a daily cap; a cap that resets on deploys is a surprise once there are several namespaces with their own.

🤖 Generated with Claude Code

Activity

  1. modified the milestone: v0.3 on Oct 28, 2026
  2. yigitdot commented on Nov 17, 2026

    @yigitdot
    Contributor

    Obsolete: #2910 removed the gateway allowance, so there is nothing left to persist across restarts.

  3. moved this from Backlog to Done in deCDNon Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions