| 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)
- garbageCollect ∷ 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 ⇒ EndorserBlockHash → m [(TxHash, BytesSize)]
- lookupEbClosure ∷ HasCallStack ⇒ EndorserBlockHash → m (Maybe [(TxHash, ByteString)])
- batchRetrieveTxs ∷ HasCallStack ⇒ EndorserBlockHash → [Int] → m [(Int, TxHash, Maybe ByteString)]
- testScanEbPoints ∷ HasCallStack ⇒ m [(SlotNo, EndorserBlockHash)]
- 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 → EndorserBlock → m (Promise m CompletedEbs)
- writeTxs ∷ HasCallStack ⇒ LeiosPoint → [(TxOffset, 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]
- type TxOffset = Int
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 #
What the DB tells its subscribers as it acquires EBs.
Each notification is sent at every LeiosPoint of the EB that is its
election's focus and whose slot is not older than the ImmutableDB tip's, even
one that becomes the focus after the EB was acquired. An election's focus is
the first announcement in it that the node accepts, until a verified
certificate names another, so every point that a block certifies is a focus.
So a subscriber hears of the EB's youngest focus.
Constructors
| AcquiredEb | The DB holds the EB's body. |
Fields
| |
| AcquiredEbTxs | The DB holds the EB's body and every tx it lists. |
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 does not discard a failure: a failed
write is not survivable and stops the writer either way.
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.