// Package dbreads is a forwarded `carlos db` read (spec // docs/superpowers/specs/2026-10-22-db-region-forward-design.md): the wire // the console, the box and the CLI share, and the box's half of the work. // Every object lives under db-reads/ in the deployment bucket and is a // conditional create; the store's lifecycle rule is the only deletion (J2, // J4). package dbreads import ( "time" "github.com/carlosframework/platform/internal/runs" ) // Capability is what a box publishes in its edges file while its armed // db-reads loop's last readiness probe passed (spec §7.1). const Capability = "db-read-1" // Purpose is the envelope's fixed purpose and the sealing's HKDF info: one // string, so nothing else signed by the root or sealed by this package can be // mistaken for a db read. const Purpose = "carlos-db-read-v1" // Prefix is the one prefix every db read object lives under. const Prefix = "db-reads/" const ( OpQuery = "query" OpPull = "pull" // plan 3 PickupWindow = 60 * time.Second // from issued_at (§5.7) Skew = 60 * time.Second ConsoleWaitsPicked = 2 * time.Minute PlanBudget = 10 * time.Minute QueryTimeout = 5 * time.Minute OwnerDeadline = 20 * time.Minute OwnerGrace = time.Minute RequestBound = 22 * time.Minute CLIBound = 23 * time.Minute CancelEvery = 5 * time.Second ListEvery = 30 * time.Second ProbeEvery = 5 * time.Minute WorkerExitGrace = 5 * time.Second MaxJitter = 500 * time.Millisecond DefaultMaxRestored int64 = 2 << 30 // CARLOS_DB_READ_MAX_BYTES // PlanBytesFactor bounds a plan's LTX files, all together, at this many // times the restored-size cap: the most a worker writes before it // restores (Astra round 1, finding 1). PlanBytesFactor int64 = 2 MaxOutputBytes = runs.MaxOutputBytes ChunkBytes = runs.ChunkBytes ChunkEvery = runs.ChunkEvery // MaxPullBytes is a pull's cap on its planned LTX files (spec §5.7, rev // 7: measured on dev, 2026-10-23). CARLOS_DB_PULL_MAX_BYTES on a box can // only lower it, so no box ships more than a CLI accepts. MaxPullBytes int64 = 2 << 30 // PullChunkBytes is a pull's chunk: larger than a query's, so a full // pull is about two thousand objects, not eight. PullChunkBytes = 1 << 20 ReadsPerBox = 2 MaxConnections = 3 // two reads and one probe (carlos-dbread.socket) OpenPerPerson = 2 OpenPerConsole = 16 DiskFloor int64 = 5 << 30 DiskFreePercent = 10 // MaxSQLBytes keeps a request well inside the root envelope's payload // bound (release.MaxRootEnvelopeBytes/2). MaxSQLBytes = 256 << 10 )