package ledger import ( "errors" "time" ) type OperatingMode string const ( ModeNormal OperatingMode = "NORMAL" ModeGLOnly OperatingMode = "GL_ONLY" InternalExecutionMetadata = "gl_execution" ) var ( ErrModeConflict = errors.New("operating mode revision changed") ErrModeRequired = errors.New("operation is not permitted in the current ledger mode") ErrInsufficientFunds = errors.New("insufficient ledger funds") ErrSettlementInFlight = errors.New("settlement is in flight; drain the worker before switching") ErrConcurrentPosting = errors.New("concurrent posting conflicted; retry with the same idempotency key") ) type OperatingState struct { Mode OperatingMode Revision int64 ActorID string Reason string ChangedAt time.Time } type UserAssetBalance struct { AssetID int64 Available Amount Frozen Amount }