| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Storage.LeiosDB.API
Synopsis
- data LeiosDbHandle (m ∷ Type → Type) = LeiosDbHandle {
- closeLeiosDbHandle ∷ m ()
- openReader ∷ HasCallStack ⇒ m (LeiosDbReader m)
- openWriter ∷ HasCallStack ⇒ m (LeiosDbWriter m)
- subscribeEbNotifications ∷ HasCallStack ⇒ m (StrictTChan m LeiosEbNotification)
- leiosDbGarbageCollect ∷ HasCallStack ⇒ SlotNo → m ()
- leiosDbPromoteToImmutable ∷ HasCallStack ⇒ [LeiosPoint] → m ()
- leiosDbSampleStats ∷ HasCallStack ⇒ m LeiosDbStats
- data LeiosDbStats = LeiosDbStats {
- volatileEbs ∷ !Int
- immutableEbs ∷ !Int
- walBytes ∷ !Integer
- data LeiosEbNotification
- data LeiosDbReader (m ∷ Type → Type) = LeiosDbReader {
- closeReader ∷ m ()
- lookupEbBody ∷ HasCallStack ⇒ EbHash → m [(TxHash, BytesSize)]
- lookupEbClosure ∷ HasCallStack ⇒ EbHash → m (Maybe [(TxHash, ByteString)])
- batchRetrieveTxs ∷ HasCallStack ⇒ EbHash → [Int] → m [(Int, TxHash, Maybe ByteString)]
- testScanEbPoints ∷ HasCallStack ⇒ m [(SlotNo, EbHash)]
- scanCompleteEbClosuresNotOlderThanSlot ∷ HasCallStack ⇒ SlotNo → m [LeiosPoint]
- withReader ∷ MonadThrow m ⇒ LeiosDbHandle m → (LeiosDbReader m → m a) → m a
- allocateReader ∷ IOLike m ⇒ ResourceRegistry m → LeiosDbHandle m → m (LeiosDbReader m)
- data LeiosDbWriter (m ∷ Type → Type) = LeiosDbWriter {
- closeWriter ∷ m ()
- writeEbPoint ∷ HasCallStack ⇒ LeiosPoint → BytesSize → m (Promise m ())
- writeEbBody ∷ HasCallStack ⇒ LeiosPoint → LeiosEb → m (Promise m CompletedEbs)
- writeTxs ∷ HasCallStack ⇒ [(TxHash, ByteString)] → m (Promise m CompletedEbs)
- newtype Promise (m ∷ Type → Type) a = Promise {
- await ∷ m a
- awaitAll ∷ (Foldable t, Applicative m) ⇒ t (Promise m ()) → m ()
- withWriter ∷ MonadThrow m ⇒ LeiosDbHandle m → (LeiosDbWriter m → m a) → m a
- allocateWriter ∷ IOLike m ⇒ ResourceRegistry m → LeiosDbHandle m → m (LeiosDbWriter m)
- type CompletedEbs = [LeiosPoint]
Handle
data LeiosDbHandle (m ∷ Type → Type) Source #
The Leios database. Hands out readers, writers and subscriptions.
Constructors
| LeiosDbHandle | |
Fields
| |
Instances
| NoThunks (LeiosDbHandle m) Source # | |
Defined in Ouroboros.Consensus.Storage.LeiosDB.API | |
data LeiosDbStats Source #
In-memory LeiosDb counters: seeded from the database files once per handle, bumped by the write, copy and GC paths, never written back.
An EB that has been copied to the immutable partition but not yet evicted from the volatile one counts in both partitions -- that is the truth on disk during the window between copy and GC.
Constructors
| LeiosDbStats | |
Fields
| |
Instances
| Show LeiosDbStats Source # | |
Defined in Ouroboros.Consensus.Storage.LeiosDB.Trace Methods showsPrec ∷ Int → LeiosDbStats → ShowS # show ∷ LeiosDbStats → String # showList ∷ [LeiosDbStats] → ShowS # | |
data LeiosEbNotification Source #
Constructors
| AcquiredEb | An EB body was written. |
Fields
| |
| AcquiredEbTxs | Every tx of the EB is now in the DB. |
Fields
| |
Reading
data LeiosDbReader (m ∷ Type → Type) Source #
Query API into the LeiosDb. Do not use a reader in two concurrent threads.
Constructors
| LeiosDbReader | |
Fields
| |
Instances
| NoThunks (LeiosDbReader m) Source # | |
Defined in Ouroboros.Consensus.Storage.LeiosDB.API | |
withReader ∷ MonadThrow m ⇒ LeiosDbHandle m → (LeiosDbReader m → m a) → m a Source #
allocateReader ∷ IOLike m ⇒ ResourceRegistry m → LeiosDbHandle m → m (LeiosDbReader m) Source #
Writing
data LeiosDbWriter (m ∷ Type → Type) Source #
Modifying API into the LeiosDb.
Asynchronous interface where each operation returns upon submission. The
returned Promise can be used to await the write being performed. Any
exceptions are thrown through await.
Constructors
| LeiosDbWriter | |
Fields
| |
Instances
| NoThunks (LeiosDbWriter m) Source # | |
Defined in Ouroboros.Consensus.Storage.LeiosDB.API | |
newtype Promise (m ∷ Type → Type) a Source #
The result of a submitted write.
await rethrows whatever the write threw, in the awaiting thread, as a
LeiosDbException naming the write and the site that submitted it.
Awaiting twice is fine. Not awaiting discards the failure along with the
result: collect promises and awaitAll them instead, unless the write's
fate genuinely does not matter.
awaitAll ∷ (Foldable t, Applicative m) ⇒ t (Promise m ()) → m () Source #
Await every promise, in order.
withWriter ∷ MonadThrow m ⇒ LeiosDbHandle m → (LeiosDbWriter m → m a) → m a Source #
allocateWriter ∷ IOLike m ⇒ ResourceRegistry m → LeiosDbHandle m → m (LeiosDbWriter m) Source #
type CompletedEbs = [LeiosPoint] Source #
EBs whose tx closure became complete as a result of a write.