| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Erebos.Storage
Synopsis
- type Storage = Storage' Complete
- type PartialStorage = Storage' Partial
- class (Traversable compl, Monad compl) => StorageCompleteness (compl :: Type -> Type)
- openStorage :: FilePath -> IO Storage
- memoryStorage :: IO Storage
- deriveEphemeralStorage :: Storage -> IO Storage
- derivePartialStorage :: Storage -> IO PartialStorage
- type Ref = Ref' Complete
- type PartialRef = Ref' Partial
- data RefDigest
- refDigest :: forall (c :: Type -> Type). Ref' c -> RefDigest
- refFromDigest :: forall (c :: Type -> Type). Storage' c -> RefDigest -> IO (Maybe (Ref' c))
- readRef :: Storage -> ByteString -> IO (Maybe Ref)
- showRef :: forall (c :: Type -> Type). Ref' c -> ByteString
- showRefDigest :: RefDigest -> ByteString
- refDigestFromByteString :: ByteArrayAccess ba => ba -> Maybe RefDigest
- hashToRefDigest :: ByteString -> RefDigest
- copyRef :: forall (c :: Type -> Type) (c' :: Type -> Type) m. (StorageCompleteness c, StorageCompleteness c', MonadIO m) => Storage' c' -> Ref' c -> m (LoadResult c (Ref' c'))
- partialRef :: PartialStorage -> Ref -> PartialRef
- partialRefFromDigest :: PartialStorage -> RefDigest -> PartialRef
- type Object = Object' Complete
- type PartialObject = Object' Partial
- data Object' (c :: Type -> Type)
- = Blob ByteString
- | Rec [(ByteString, RecItem' c)]
- | ZeroObject
- | UnknownObject ByteString ByteString
- type RecItem = RecItem' Complete
- data RecItem' (c :: Type -> Type)
- serializeObject :: forall (c :: Type -> Type). Object' c -> ByteString
- deserializeObject :: PartialStorage -> ByteString -> Except String (PartialObject, ByteString)
- deserializeObjects :: PartialStorage -> ByteString -> Except String [PartialObject]
- ioLoadObject :: StorageCompleteness c => Ref' c -> IO (c (Object' c))
- ioLoadBytes :: StorageCompleteness compl => Ref' compl -> IO (compl ByteString)
- storeRawBytes :: PartialStorage -> ByteString -> IO PartialRef
- lazyLoadBytes :: forall (c :: Type -> Type). StorageCompleteness c => Ref' c -> LoadResult c ByteString
- storeObject :: PartialStorage -> PartialObject -> IO PartialRef
- collectObjects :: Object -> [Object]
- collectStoredObjects :: Stored Object -> [Stored Object]
- type Head = Head' Complete
- class Storable a => HeadType a where
- headTypeID :: proxy a -> HeadTypeID
- data HeadTypeID
- mkHeadTypeID :: String -> HeadTypeID
- headId :: Head a -> HeadID
- headStorage :: Head a -> Storage
- headRef :: Head a -> Ref
- headObject :: Head a -> a
- headStoredObject :: Head a -> Stored a
- loadHeads :: forall a m. (MonadIO m, HeadType a) => Storage -> m [Head a]
- loadHead :: (HeadType a, MonadIO m) => Storage -> HeadID -> m (Maybe (Head a))
- reloadHead :: (HeadType a, MonadIO m) => Head a -> m (Maybe (Head a))
- storeHead :: forall a m. (MonadIO m, HeadType a) => Storage -> a -> m (Head a)
- replaceHead :: (HeadType a, MonadIO m) => Head a -> Stored a -> m (Either (Maybe (Head a)) (Head a))
- updateHead :: (HeadType a, MonadIO m) => Head a -> (Stored a -> m (Stored a, b)) -> m (Maybe (Head a), b)
- updateHead_ :: (HeadType a, MonadIO m) => Head a -> (Stored a -> m (Stored a)) -> m (Maybe (Head a))
- loadHeadRaw :: MonadIO m => Storage -> HeadTypeID -> HeadID -> m (Maybe Ref)
- storeHeadRaw :: MonadIO m => Storage -> HeadTypeID -> Ref -> m HeadID
- replaceHeadRaw :: MonadIO m => Storage -> HeadTypeID -> HeadID -> Ref -> Ref -> m (Either (Maybe Ref) Ref)
- data WatchedHead
- watchHead :: HeadType a => Head a -> (Head a -> IO ()) -> IO WatchedHead
- watchHeadWith :: (HeadType a, Eq b) => Head a -> (Head a -> b) -> (b -> IO ()) -> IO WatchedHead
- unwatchHead :: WatchedHead -> IO ()
- watchHeadRaw :: Eq b => Storage -> HeadTypeID -> HeadID -> (Ref -> b) -> (b -> IO ()) -> IO WatchedHead
- class Monad m => MonadStorage (m :: Type -> Type) where
- getStorage :: m Storage
- mstore :: Storable a => a -> m (Stored a)
- class Storable a where
- class Storable a => ZeroStorable a where
- class StorableText a where
- class StorableDate a where
- class StorableUUID a where
- data Store
- type StoreRec (c :: Type -> Type) = StoreRecM c ()
- evalStore :: forall (c :: Type -> Type). StorageCompleteness c => Storage' c -> Store -> IO (Ref' c)
- evalStoreObject :: forall (c :: Type -> Type). StorageCompleteness c => Storage' c -> Store -> IO (Object' c)
- storeBlob :: ByteString -> Store
- storeRec :: (forall (c :: Type -> Type). StorageCompleteness c => StoreRec c) -> Store
- storeZero :: Store
- storeEmpty :: forall (c :: Type -> Type). String -> StoreRec c
- storeInt :: forall a (c :: Type -> Type). Integral a => String -> a -> StoreRec c
- storeNum :: forall a (c :: Type -> Type). (Real a, Fractional a) => String -> a -> StoreRec c
- storeText :: forall a (c :: Type -> Type). StorableText a => String -> a -> StoreRec c
- storeBinary :: forall a (c :: Type -> Type). ByteArrayAccess a => String -> a -> StoreRec c
- storeDate :: forall a (c :: Type -> Type). StorableDate a => String -> a -> StoreRec c
- storeUUID :: forall a (c :: Type -> Type). StorableUUID a => String -> a -> StoreRec c
- storeRef :: forall a (c :: Type -> Type). (Storable a, StorageCompleteness c) => String -> a -> StoreRec c
- storeRawRef :: forall (c :: Type -> Type). StorageCompleteness c => String -> Ref -> StoreRec c
- storeMbEmpty :: forall (c :: Type -> Type). String -> Maybe () -> StoreRec c
- storeMbInt :: forall a (c :: Type -> Type). Integral a => String -> Maybe a -> StoreRec c
- storeMbNum :: forall a (c :: Type -> Type). (Real a, Fractional a) => String -> Maybe a -> StoreRec c
- storeMbText :: forall a (c :: Type -> Type). StorableText a => String -> Maybe a -> StoreRec c
- storeMbBinary :: forall a (c :: Type -> Type). ByteArrayAccess a => String -> Maybe a -> StoreRec c
- storeMbDate :: forall a (c :: Type -> Type). StorableDate a => String -> Maybe a -> StoreRec c
- storeMbUUID :: forall a (c :: Type -> Type). StorableUUID a => String -> Maybe a -> StoreRec c
- storeMbRef :: forall a (c :: Type -> Type). (Storable a, StorageCompleteness c) => String -> Maybe a -> StoreRec c
- storeMbRawRef :: forall (c :: Type -> Type). StorageCompleteness c => String -> Maybe Ref -> StoreRec c
- storeZRef :: forall a (c :: Type -> Type). (ZeroStorable a, StorageCompleteness c) => String -> a -> StoreRec c
- storeRecItems :: forall (c :: Type -> Type). StorageCompleteness c => [(ByteString, RecItem)] -> StoreRec c
- data Load a
- data LoadRec a
- evalLoad :: Load a -> Ref -> a
- loadCurrentRef :: Load Ref
- loadCurrentObject :: Load Object
- loadRecCurrentRef :: LoadRec Ref
- loadRecItems :: LoadRec [(ByteString, RecItem)]
- loadBlob :: (ByteString -> a) -> Load a
- loadRec :: LoadRec a -> Load a
- loadZero :: a -> Load a
- loadEmpty :: String -> LoadRec ()
- loadInt :: Num a => String -> LoadRec a
- loadNum :: (Real a, Fractional a) => String -> LoadRec a
- loadText :: StorableText a => String -> LoadRec a
- loadBinary :: ByteArray a => String -> LoadRec a
- loadDate :: StorableDate a => String -> LoadRec a
- loadUUID :: StorableUUID a => String -> LoadRec a
- loadRef :: Storable a => String -> LoadRec a
- loadRawRef :: String -> LoadRec Ref
- loadMbEmpty :: String -> LoadRec (Maybe ())
- loadMbInt :: Num a => String -> LoadRec (Maybe a)
- loadMbNum :: (Real a, Fractional a) => String -> LoadRec (Maybe a)
- loadMbText :: StorableText a => String -> LoadRec (Maybe a)
- loadMbBinary :: ByteArray a => String -> LoadRec (Maybe a)
- loadMbDate :: StorableDate a => String -> LoadRec (Maybe a)
- loadMbUUID :: StorableUUID a => String -> LoadRec (Maybe a)
- loadMbRef :: Storable a => String -> LoadRec (Maybe a)
- loadMbRawRef :: String -> LoadRec (Maybe Ref)
- loadTexts :: StorableText a => String -> LoadRec [a]
- loadBinaries :: ByteArray a => String -> LoadRec [a]
- loadRefs :: Storable a => String -> LoadRec [a]
- loadRawRefs :: String -> LoadRec [Ref]
- loadZRef :: ZeroStorable a => String -> LoadRec a
- type Stored a = Stored' Complete a
- fromStored :: Stored a -> a
- storedRef :: Stored a -> Ref
- wrappedStore :: (MonadIO m, Storable a) => Storage -> a -> m (Stored a)
- wrappedLoad :: Storable a => Ref -> Stored a
- copyStored :: forall (c :: Type -> Type) (c' :: Type -> Type) m a. (StorageCompleteness c, StorageCompleteness c', MonadIO m) => Storage' c' -> Stored' c a -> m (LoadResult c (Stored' c' a))
- unsafeMapStored :: (a -> b) -> Stored a -> Stored b
- data StoreInfo = StoreInfo {}
- makeStoreInfo :: IO StoreInfo
- type StoredHistory a = Stored (History a)
- fromHistory :: StoredHistory a -> a
- fromHistoryAt :: ZonedTime -> StoredHistory a -> Maybe a
- storedFromHistory :: StoredHistory a -> Stored a
- storedHistoryList :: StoredHistory a -> [Stored a]
- beginHistory :: Storable a => Storage -> StoreInfo -> a -> IO (StoredHistory a)
- modifyHistory :: Storable a => StoreInfo -> (a -> a) -> StoredHistory a -> IO (StoredHistory a)
Documentation
type PartialStorage = Storage' Partial Source #
class (Traversable compl, Monad compl) => StorageCompleteness (compl :: Type -> Type) Source #
Minimal complete definition
Instances
| StorageCompleteness Complete Source # | |||||
Defined in Erebos.Storage.Internal Associated Types
Methods returnLoadResult :: Complete a -> LoadResult Complete a Source # ioLoadBytes :: Ref' Complete -> IO (Complete ByteString) Source # | |||||
| StorageCompleteness Partial Source # | |||||
Defined in Erebos.Storage.Internal Associated Types
Methods returnLoadResult :: Partial a -> LoadResult Partial a Source # ioLoadBytes :: Ref' Partial -> IO (Partial ByteString) Source # | |||||
type PartialRef = Ref' Partial Source #
Instances
| Show RefDigest Source # | |||||
| NFData RefDigest Source # | |||||
Defined in Erebos.Storage.Internal | |||||
| StorageCompleteness Partial Source # | |||||
Defined in Erebos.Storage.Internal Associated Types
Methods returnLoadResult :: Partial a -> LoadResult Partial a Source # ioLoadBytes :: Ref' Partial -> IO (Partial ByteString) Source # | |||||
| Eq RefDigest Source # | |||||
| Ord RefDigest Source # | |||||
| Hashable RefDigest Source # | |||||
Defined in Erebos.Storage.Internal | |||||
| ByteArrayAccess RefDigest Source # | |||||
| type LoadResult Partial a Source # | |||||
Defined in Erebos.Storage.Internal | |||||
refFromDigest :: forall (c :: Type -> Type). Storage' c -> RefDigest -> IO (Maybe (Ref' c)) Source #
showRefDigest :: RefDigest -> ByteString Source #
refDigestFromByteString :: ByteArrayAccess ba => ba -> Maybe RefDigest Source #
copyRef :: forall (c :: Type -> Type) (c' :: Type -> Type) m. (StorageCompleteness c, StorageCompleteness c', MonadIO m) => Storage' c' -> Ref' c -> m (LoadResult c (Ref' c')) Source #
partialRef :: PartialStorage -> Ref -> PartialRef Source #
type PartialObject = Object' Partial Source #
data Object' (c :: Type -> Type) Source #
Constructors
| Blob ByteString | |
| Rec [(ByteString, RecItem' c)] | |
| ZeroObject | |
| UnknownObject ByteString ByteString |
data RecItem' (c :: Type -> Type) Source #
Constructors
| RecEmpty | |
| RecInt Integer | |
| RecNum Rational | |
| RecText Text | |
| RecBinary ByteString | |
| RecDate ZonedTime | |
| RecUUID UUID | |
| RecRef (Ref' c) | |
| RecUnknown ByteString ByteString |
serializeObject :: forall (c :: Type -> Type). Object' c -> ByteString Source #
deserializeObject :: PartialStorage -> ByteString -> Except String (PartialObject, ByteString) Source #
ioLoadObject :: StorageCompleteness c => Ref' c -> IO (c (Object' c)) Source #
ioLoadBytes :: StorageCompleteness compl => Ref' compl -> IO (compl ByteString) Source #
storeRawBytes :: PartialStorage -> ByteString -> IO PartialRef Source #
lazyLoadBytes :: forall (c :: Type -> Type). StorageCompleteness c => Ref' c -> LoadResult c ByteString Source #
storeObject :: PartialStorage -> PartialObject -> IO PartialRef Source #
collectObjects :: Object -> [Object] Source #
class Storable a => HeadType a where Source #
Methods
headTypeID :: proxy a -> HeadTypeID Source #
Instances
| HeadType LocalState Source # | |
Defined in Erebos.State Methods headTypeID :: proxy LocalState -> HeadTypeID Source # | |
data HeadTypeID Source #
Instances
| StorableUUID HeadTypeID Source # | |
Defined in Erebos.Storage | |
| Eq HeadTypeID Source # | |
Defined in Erebos.Storage.Internal | |
| Ord HeadTypeID Source # | |
Defined in Erebos.Storage.Internal Methods compare :: HeadTypeID -> HeadTypeID -> Ordering # (<) :: HeadTypeID -> HeadTypeID -> Bool # (<=) :: HeadTypeID -> HeadTypeID -> Bool # (>) :: HeadTypeID -> HeadTypeID -> Bool # (>=) :: HeadTypeID -> HeadTypeID -> Bool # max :: HeadTypeID -> HeadTypeID -> HeadTypeID # min :: HeadTypeID -> HeadTypeID -> HeadTypeID # | |
mkHeadTypeID :: String -> HeadTypeID Source #
headStorage :: Head a -> Storage Source #
headObject :: Head a -> a Source #
headStoredObject :: Head a -> Stored a Source #
replaceHead :: (HeadType a, MonadIO m) => Head a -> Stored a -> m (Either (Maybe (Head a)) (Head a)) Source #
updateHead :: (HeadType a, MonadIO m) => Head a -> (Stored a -> m (Stored a, b)) -> m (Maybe (Head a), b) Source #
updateHead_ :: (HeadType a, MonadIO m) => Head a -> (Stored a -> m (Stored a)) -> m (Maybe (Head a)) Source #
loadHeadRaw :: MonadIO m => Storage -> HeadTypeID -> HeadID -> m (Maybe Ref) Source #
storeHeadRaw :: MonadIO m => Storage -> HeadTypeID -> Ref -> m HeadID Source #
replaceHeadRaw :: MonadIO m => Storage -> HeadTypeID -> HeadID -> Ref -> Ref -> m (Either (Maybe Ref) Ref) Source #
data WatchedHead Source #
watchHeadWith :: (HeadType a, Eq b) => Head a -> (Head a -> b) -> (b -> IO ()) -> IO WatchedHead Source #
unwatchHead :: WatchedHead -> IO () Source #
watchHeadRaw :: Eq b => Storage -> HeadTypeID -> HeadID -> (Ref -> b) -> (b -> IO ()) -> IO WatchedHead Source #
class Monad m => MonadStorage (m :: Type -> Type) where Source #
Minimal complete definition
Methods
getStorage :: m Storage Source #
Instances
| MonadStorage (ServiceHandler s) Source # | |
Defined in Erebos.Service Methods getStorage :: ServiceHandler s Storage Source # mstore :: Storable a => a -> ServiceHandler s (Stored a) Source # | |
| MonadIO m => MonadStorage (ReaderT (Head a) m) Source # | |
| MonadIO m => MonadStorage (ReaderT Storage m) Source # | |
class Storable a where Source #
Methods
store :: forall (c :: Type -> Type). StorageCompleteness c => Storage' c -> a -> IO (Ref' c) Source #
Instances
class Storable a => ZeroStorable a where Source #
Instances
| ZeroStorable a => ZeroStorable (Stored a) Source # | |
| Storable a => ZeroStorable [a] Source # | |
Defined in Erebos.Storage | |
class StorableText a where Source #
Instances
class StorableDate a where Source #
Instances
class StorableUUID a where Source #
Instances
| StorableUUID ServiceID Source # | |
| StorableUUID SharedTypeID Source # | |
Defined in Erebos.State | |
| StorableUUID HeadID Source # | |
| StorableUUID HeadTypeID Source # | |
Defined in Erebos.Storage | |
| StorableUUID UUID Source # | |
evalStore :: forall (c :: Type -> Type). StorageCompleteness c => Storage' c -> Store -> IO (Ref' c) Source #
evalStoreObject :: forall (c :: Type -> Type). StorageCompleteness c => Storage' c -> Store -> IO (Object' c) Source #
storeBlob :: ByteString -> Store Source #
storeNum :: forall a (c :: Type -> Type). (Real a, Fractional a) => String -> a -> StoreRec c Source #
storeBinary :: forall a (c :: Type -> Type). ByteArrayAccess a => String -> a -> StoreRec c Source #
storeRef :: forall a (c :: Type -> Type). (Storable a, StorageCompleteness c) => String -> a -> StoreRec c Source #
storeRawRef :: forall (c :: Type -> Type). StorageCompleteness c => String -> Ref -> StoreRec c Source #
storeMbNum :: forall a (c :: Type -> Type). (Real a, Fractional a) => String -> Maybe a -> StoreRec c Source #
storeMbText :: forall a (c :: Type -> Type). StorableText a => String -> Maybe a -> StoreRec c Source #
storeMbBinary :: forall a (c :: Type -> Type). ByteArrayAccess a => String -> Maybe a -> StoreRec c Source #
storeMbDate :: forall a (c :: Type -> Type). StorableDate a => String -> Maybe a -> StoreRec c Source #
storeMbUUID :: forall a (c :: Type -> Type). StorableUUID a => String -> Maybe a -> StoreRec c Source #
storeMbRef :: forall a (c :: Type -> Type). (Storable a, StorageCompleteness c) => String -> Maybe a -> StoreRec c Source #
storeMbRawRef :: forall (c :: Type -> Type). StorageCompleteness c => String -> Maybe Ref -> StoreRec c Source #
storeZRef :: forall a (c :: Type -> Type). (ZeroStorable a, StorageCompleteness c) => String -> a -> StoreRec c Source #
storeRecItems :: forall (c :: Type -> Type). StorageCompleteness c => [(ByteString, RecItem)] -> StoreRec c Source #
Instances
loadCurrentRef :: Load Ref Source #
loadRecItems :: LoadRec [(ByteString, RecItem)] Source #
loadBlob :: (ByteString -> a) -> Load a Source #
loadMbText :: StorableText a => String -> LoadRec (Maybe a) Source #
loadMbDate :: StorableDate a => String -> LoadRec (Maybe a) Source #
loadMbUUID :: StorableUUID a => String -> LoadRec (Maybe a) Source #
fromStored :: Stored a -> a Source #
copyStored :: forall (c :: Type -> Type) (c' :: Type -> Type) m a. (StorageCompleteness c, StorageCompleteness c', MonadIO m) => Storage' c' -> Stored' c a -> m (LoadResult c (Stored' c' a)) Source #
unsafeMapStored :: (a -> b) -> Stored a -> Stored b Source #
Passed function needs to preserve the object representation to be safe
type StoredHistory a = Stored (History a) Source #
fromHistory :: StoredHistory a -> a Source #
fromHistoryAt :: ZonedTime -> StoredHistory a -> Maybe a Source #
storedFromHistory :: StoredHistory a -> Stored a Source #
storedHistoryList :: StoredHistory a -> [Stored a] Source #
beginHistory :: Storable a => Storage -> StoreInfo -> a -> IO (StoredHistory a) Source #
modifyHistory :: Storable a => StoreInfo -> (a -> a) -> StoredHistory a -> IO (StoredHistory a) Source #