Module counter

Module counter 

Source
Expand description

Counter management for promotional code generation.

Supports multiple counter storage modes:

  • File: Separate .counter file with OS locking
  • InBin: Counter stored in the .bin mutable section
  • External: Consumer-managed counter (e.g., database column, PostgreSQL)

Structs§

CounterManager
Counter manager for different storage modes.

Enums§

CounterMode
Counter storage mode.

Functions§

counter_from_bytes
Deserialize counter value from bytes.
counter_to_bytes
Serialize counter value to bytes (for in-bin storage).
increment_counter_file
Increment counter by a specific amount.
read_counter_file
Read counter value from a file.
reserve_counter_file
Atomically reserve a range of counter values.
write_counter_file
Write counter value to a file.