blob: 620d423df931a25fc7df72d2ea62afd9a4aead34 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
{-|
Description: Implement custom storage backend
Exports type class, which can be used to create custom 'Storage' backend.
-}
module Erebos.Storage.Backend (
StorageBackend(..),
Complete, Partial,
Storage, PartialStorage,
newStorage,
WatchID, startWatchID, nextWatchID,
) where
import Control.Concurrent.MVar
import Data.HashTable.IO qualified as HT
import Erebos.Object.Internal
import Erebos.Storage.Internal
newStorage :: StorageBackend bck => bck -> IO (Storage' (BackendCompleteness bck))
newStorage stBackend = do
stRefGeneration <- newMVar =<< HT.new
stRefRoots <- newMVar =<< HT.new
return Storage {..}
|