| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Arbiter.Core.Codec
Description
Synopsis
- data Col a where
- data NullCol a where
- type RowCodec = Ap NullCol
- col :: Text -> Col a -> RowCodec a
- ncol :: Text -> Col a -> RowCodec (Maybe a)
- runCodec :: Applicative f => (forall x. NullCol x -> f x) -> RowCodec a -> f a
- codecColumns :: RowCodec a -> [Text]
- data ParamType a where
- data SomeParam where
- type Params = [SomeParam]
- pval :: Col a -> a -> SomeParam
- pnul :: Col a -> Maybe a -> SomeParam
- parr :: Col a -> [a] -> SomeParam
- pnarr :: Col a -> [Maybe a] -> SomeParam
- data Codec s a
- cDecode :: Codec s a -> RowCodec a
- cColumns :: Codec s a -> [(Text, Text)]
- cScalar :: Codec s a -> s -> Params
- cArray :: Codec s a -> [s] -> Params
- jobCodec :: Text -> Codec (JobWriteSource payload) (JobRead Value)
- data JobWriteSource payload = JobWriteSource {
- sourceJob :: JobWrite payload
- sourceEncoded :: Value
- sourceColumns :: PayloadColumns
- sourceParentId :: Maybe Int64
- sourceParentState :: Maybe Value
- sourceSuspended :: Bool
- writeColumnNames :: [Text]
- jobRowCodec :: Text -> RowCodec (JobRead Value)
- dlqRowCodec :: Text -> RowCodec (Int64, UTCTime, JobRead Value)
- archiveRowCodec :: Text -> RowCodec (Int64, UTCTime, JobRead Value, Maybe Value)
- rateLimitPolicyViewCodec :: RowCodec RateLimitPolicyView
- rateLimitBucketCodec :: RowCodec RateLimitBucketView
- concurrencyPolicyViewCodec :: RowCodec ConcurrencyPolicyView
- concurrencyKeyViewCodec :: RowCodec ConcurrencyKeyView
- cronScheduleRowCodec :: RowCodec CronScheduleRow
- workerRowWithHealthCodec :: RowCodec (WorkerRow, Text)
- queueRowCodec :: RowCodec QueueRow
Column types
Scalar PostgreSQL column type. The GADT tag recovers the Haskell type.
A named column with nullability. Carries the column name for backends that use name-based decoding (e.g. orville).
Row decoding
Source #runCodec :: Applicative f => (forall x. NullCol x -> f x) -> RowCodec a -> f a
Interpret a RowCodec by providing a natural transformation
from NullCol to some Applicative.
Source #codecColumns :: RowCodec a -> [Text]
Extract the column names from a codec (in order).
Parameter encoding
An existentially-typed parameter. A ParamType paired with its value.
Bidirectional job write codec
A profunctor codec. Writes source s to INSERT columns and params, decodes value a back.
Source #cColumns :: Codec s a -> [(Text, Text)]
Writable (column name, PostgreSQL type) pairs, in order.
Source #jobCodec :: Text -> Codec (JobWriteSource payload) (JobRead Value)
Main-table codec. The write source contains public enqueue fields, payload columns, parent id, rollup state, and suspension state.
Source #data JobWriteSource payload
The insert side of a job row. The payload encoding is built once by the caller.
Constructors
| JobWriteSource | |
Fields
| |
Source #writeColumnNames :: [Text]
Writable job column names, in insert order.
Job codecs
Source #dlqRowCodec :: Text -> RowCodec (Int64, UTCTime, JobRead Value)
DLQ envelope. The shared job snapshot plus its DLQ id and failure time.
Source #archiveRowCodec :: Text -> RowCodec (Int64, UTCTime, JobRead Value, Maybe Value)
Archive envelope. The shared job snapshot plus the result a completed root job stored.
Source #rateLimitPolicyViewCodec :: RowCodec RateLimitPolicyView
A policy row with bucket aggregates and live throttled count.
Source #rateLimitBucketCodec :: RowCodec RateLimitBucketView
A token-bucket row as the admin API reports it.
Source #concurrencyPolicyViewCodec :: RowCodec ConcurrencyPolicyView
A pool policy row as the admin API reports it.
Source #concurrencyKeyViewCodec :: RowCodec ConcurrencyKeyView
A per-key in-flight count as the admin API reports it.
Cron codecs
Source #cronScheduleRowCodec :: RowCodec CronScheduleRow
A cron_schedules row.
Worker codecs
Source #workerRowWithHealthCodec :: RowCodec (WorkerRow, Text)
Worker columns plus the raw derived health token. The operation layer
validates the token before returning a WorkerRow.
Queue codecs
Source #queueRowCodec :: RowCodec QueueRow
An arbiter_queues row.