Documentation
¶
Overview ¶
Package billingspool owns the process-local durable terminal handoff.
Index ¶
- Variables
- func ValidateStablePath(path string) error
- type Config
- type Health
- type HealthState
- type Spool
- func (s *Spool) AppendCall(ctx context.Context, r billing.CallUsageRecord) error
- func (s *Spool) AppendLeg(ctx context.Context, r billing.CallLegUsageRecord) error
- func (s *Spool) Close() error
- func (s *Spool) Health() Health
- func (s *Spool) PendingCount() int
- func (s *Spool) ProcessOnce(ctx context.Context) error
- func (s *Spool) Start(ctx context.Context) error
- func (s *Spool) Stop(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrPendingCapacity = errors.New("billingspool: pending record capacity exhausted") ErrPayloadCapacity = errors.New("billingspool: pending payload capacity exhausted") ErrDatabaseCapacity = errors.New("billingspool: database capacity exhausted") ErrFreeDiskCapacity = errors.New("billingspool: free disk capacity exhausted") ErrFingerprintConflict = errors.New("billingspool: stable key fingerprint conflict") ErrSpoolClosed = errors.New("billingspool: spool is closed") ErrWorkerAlreadyRunning = errors.New("billingspool: flusher already running") )
Functions ¶
func ValidateStablePath ¶
ValidateStablePath rejects volatile OS temp directories for durable spool state.
Types ¶
type Config ¶
type Config struct {
Path string
DB *bun.DB
MaxPendingRecords int
MaxPendingPayloadBytes int64
MaxDatabaseBytes int64
MinFreeDiskBytes int64
ProcessedRetention time.Duration
ClaimTimeout time.Duration
BackoffBase time.Duration
BackoffMax time.Duration
Now func() time.Time
// CommitAcknowledgedHook is test-only fault injection. It runs after the
// SQLite commit and before Append returns, making the acknowledgement edge
// observable without weakening the commit-before-success contract.
CommitAcknowledgedHook func() error
// FreeDiskBytes is an injectable filesystem watermark probe. Production
// callers may provide the platform-specific durable-state probe; nil means
// the database-size and pending-payload bounds remain authoritative.
FreeDiskBytes func() int64
}
type HealthState ¶
type HealthState string
const ( HealthReady HealthState = "ready" HealthDegraded HealthState = "degraded" HealthFull HealthState = "full" )
Click to show internal directories.
Click to hide internal directories.