erebos-0.1.7: Decentralized messaging and synchronization
Safe HaskellSafe-Inferred
LanguageHaskell2010

Erebos.Storage

Synopsis

Documentation

class (Traversable compl, Monad compl) => StorageCompleteness compl Source #

Minimal complete definition

returnLoadResult, ioLoadBytes

data RefDigest Source #

Instances

Instances details
Show RefDigest Source # 
Instance details

Defined in Erebos.Storage.Internal

NFData RefDigest Source # 
Instance details

Defined in Erebos.Storage.Internal

Methods

rnf :: RefDigest -> () #

StorageCompleteness Partial Source # 
Instance details

Defined in Erebos.Storage.Internal

Associated Types

type LoadResult Partial a Source #

Eq RefDigest Source # 
Instance details

Defined in Erebos.Storage.Internal

Ord RefDigest Source # 
Instance details

Defined in Erebos.Storage.Internal

Hashable RefDigest Source # 
Instance details

Defined in Erebos.Storage.Internal

ByteArrayAccess RefDigest Source # 
Instance details

Defined in Erebos.Storage.Internal

Methods

length :: RefDigest -> Int #

withByteArray :: RefDigest -> (Ptr p -> IO a) -> IO a #

copyByteArrayToPtr :: RefDigest -> Ptr p -> IO () #

type LoadResult Partial a Source # 
Instance details

Defined in Erebos.Storage.Internal

copyRef :: forall c c' m. (StorageCompleteness c, StorageCompleteness c', MonadIO m) => Storage' c' -> Ref' c -> m (LoadResult c (Ref' c')) Source #

data Object' c Source #

Instances

Instances details
Storable Object Source # 
Instance details

Defined in Erebos.Storage

Show (Object' c) Source # 
Instance details

Defined in Erebos.Storage

Methods

showsPrec :: Int -> Object' c -> ShowS #

show :: Object' c -> String #

showList :: [Object' c] -> ShowS #

Mergeable [Stored Object] Source # 
Instance details

Defined in Erebos.Storage.Merge

Associated Types

type Component [Stored Object] Source #

type Component [Stored Object] Source # 
Instance details

Defined in Erebos.Storage.Merge

ioLoadObject :: forall c. StorageCompleteness c => Ref' c -> IO (c (Object' c)) Source #

class Storable a => HeadType a where Source #

Methods

headTypeID :: proxy a -> HeadTypeID Source #

Instances

Instances details
HeadType LocalState Source # 
Instance details

Defined in Erebos.State

loadHeads :: forall a m. MonadIO m => HeadType a => Storage -> m [Head a] Source #

loadHead :: forall a m. (HeadType a, MonadIO m) => Storage -> HeadID -> m (Maybe (Head a)) Source #

reloadHead :: (HeadType a, MonadIO m) => Head a -> m (Maybe (Head a)) Source #

storeHead :: forall a m. MonadIO m => HeadType a => Storage -> a -> m (Head a) Source #

replaceHead :: forall a m. (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 :: forall m. MonadIO m => Storage -> HeadTypeID -> HeadID -> m (Maybe Ref) Source #

storeHeadRaw :: forall m. MonadIO m => Storage -> HeadTypeID -> Ref -> m HeadID Source #

replaceHeadRaw :: forall m. MonadIO m => Storage -> HeadTypeID -> HeadID -> Ref -> Ref -> m (Either (Maybe Ref) Ref) Source #

watchHead :: forall a. HeadType a => Head a -> (Head a -> IO ()) -> IO WatchedHead Source #

watchHeadWith :: forall a b. (HeadType a, Eq b) => Head a -> (Head a -> b) -> (b -> IO ()) -> IO WatchedHead Source #

watchHeadRaw :: forall b. Eq b => Storage -> HeadTypeID -> HeadID -> (Ref -> b) -> (b -> IO ()) -> IO WatchedHead Source #

class Monad m => MonadStorage m where Source #

Minimal complete definition

getStorage

Methods

getStorage :: m Storage Source #

mstore :: Storable a => a -> m (Stored a) Source #

default mstore :: MonadIO m => Storable a => a -> m (Stored a) Source #

Instances

Instances details
MonadStorage (ServiceHandler s) Source # 
Instance details

Defined in Erebos.Service

MonadIO m => MonadStorage (ReaderT (Head a) m) Source # 
Instance details

Defined in Erebos.Storage

Methods

getStorage :: ReaderT (Head a) m Storage Source #

mstore :: Storable a0 => a0 -> ReaderT (Head a) m (Stored a0) Source #

MonadIO m => MonadStorage (ReaderT Storage m) Source # 
Instance details

Defined in Erebos.Storage

class Storable a where Source #

Minimal complete definition

store', load'

Methods

store' :: a -> Store Source #

load' :: Load a Source #

store :: StorageCompleteness c => Storage' c -> a -> IO (Ref' c) Source #

load :: Ref -> a Source #

Instances

Instances details
Storable ByteString Source # 
Instance details

Defined in Erebos.Storage

Storable ChannelAcceptData Source # 
Instance details

Defined in Erebos.Channel

Storable ChannelRequestData Source # 
Instance details

Defined in Erebos.Channel

Storable ChatMessageData Source # 
Instance details

Defined in Erebos.Chatroom

Storable ChatroomData Source # 
Instance details

Defined in Erebos.Chatroom

Storable ChatroomService Source # 
Instance details

Defined in Erebos.Chatroom

Storable ChatroomStateData Source # 
Instance details

Defined in Erebos.Chatroom

Storable ExtendedIdentityData Source # 
Instance details

Defined in Erebos.Identity

Storable IdentityData Source # 
Instance details

Defined in Erebos.Identity

Storable IdentityExtension Source # 
Instance details

Defined in Erebos.Identity

Storable DirectMessage Source # 
Instance details

Defined in Erebos.Message

Storable PublicKexKey Source # 
Instance details

Defined in Erebos.PubKey

Storable PublicKey Source # 
Instance details

Defined in Erebos.PubKey

Storable Signature Source # 
Instance details

Defined in Erebos.PubKey

Storable LocalState Source # 
Instance details

Defined in Erebos.State

Storable SharedState Source # 
Instance details

Defined in Erebos.State

Storable Object Source # 
Instance details

Defined in Erebos.Storage

Storable SyncService Source # 
Instance details

Defined in Erebos.Sync

Storable a => Storable (PairingService a) Source # 
Instance details

Defined in Erebos.Pairing

Storable a => Storable (Signed a) Source # 
Instance details

Defined in Erebos.PubKey

Methods

store' :: Signed a -> Store Source #

load' :: Load (Signed a) Source #

store :: forall (c :: Type -> Type). StorageCompleteness c => Storage' c -> Signed a -> IO (Ref' c) Source #

load :: Ref -> Signed a Source #

Storable a => Storable (Stored a) Source # 
Instance details

Defined in Erebos.Storage

Methods

store' :: Stored a -> Store Source #

load' :: Load (Stored a) Source #

store :: forall (c :: Type -> Type). StorageCompleteness c => Storage' c -> Stored a -> IO (Ref' c) Source #

load :: Ref -> Stored a Source #

Storable a => Storable [a] Source # 
Instance details

Defined in Erebos.Storage

Methods

store' :: [a] -> Store Source #

load' :: Load [a] Source #

store :: forall (c :: Type -> Type). StorageCompleteness c => Storage' c -> [a] -> IO (Ref' c) Source #

load :: Ref -> [a] Source #

class Storable a => ZeroStorable a where Source #

Methods

fromZero :: Storage -> a Source #

Instances

Instances details
ZeroStorable a => ZeroStorable (Stored a) Source # 
Instance details

Defined in Erebos.Storage

Methods

fromZero :: Storage -> Stored a Source #

Storable a => ZeroStorable [a] Source # 
Instance details

Defined in Erebos.Storage

Methods

fromZero :: Storage -> [a] Source #

class StorableText a where Source #

Methods

toText :: a -> Text Source #

fromText :: MonadError String m => Text -> m a Source #

Instances

Instances details
StorableText Text Source # 
Instance details

Defined in Erebos.Storage

StorableText [Char] Source # 
Instance details

Defined in Erebos.Storage

Methods

toText :: [Char] -> Text Source #

fromText :: MonadError String m => Text -> m [Char] Source #

class StorableDate a where Source #

Instances

Instances details
StorableDate Day Source # 
Instance details

Defined in Erebos.Storage

StorableDate UTCTime Source # 
Instance details

Defined in Erebos.Storage

StorableDate ZonedTime Source # 
Instance details

Defined in Erebos.Storage

class StorableUUID a where Source #

Methods

toUUID :: a -> UUID Source #

fromUUID :: UUID -> a Source #

Instances

Instances details
StorableUUID ServiceID Source # 
Instance details

Defined in Erebos.Service

StorableUUID SharedTypeID Source # 
Instance details

Defined in Erebos.State

StorableUUID HeadID Source # 
Instance details

Defined in Erebos.Storage

StorableUUID HeadTypeID Source # 
Instance details

Defined in Erebos.Storage

StorableUUID UUID Source # 
Instance details

Defined in Erebos.Storage

type StoreRec c = StoreRecM c () Source #

storeNum :: (Real a, Fractional a) => String -> a -> StoreRec c Source #

data Load a Source #

Instances

Instances details
Alternative Load Source # 
Instance details

Defined in Erebos.Storage

Methods

empty :: Load a #

(<|>) :: Load a -> Load a -> Load a #

some :: Load a -> Load [a] #

many :: Load a -> Load [a] #

Applicative Load Source # 
Instance details

Defined in Erebos.Storage

Methods

pure :: a -> Load a #

(<*>) :: Load (a -> b) -> Load a -> Load b #

liftA2 :: (a -> b -> c) -> Load a -> Load b -> Load c #

(*>) :: Load a -> Load b -> Load b #

(<*) :: Load a -> Load b -> Load a #

Functor Load Source # 
Instance details

Defined in Erebos.Storage

Methods

fmap :: (a -> b) -> Load a -> Load b #

(<$) :: a -> Load b -> Load a #

Monad Load Source # 
Instance details

Defined in Erebos.Storage

Methods

(>>=) :: Load a -> (a -> Load b) -> Load b #

(>>) :: Load a -> Load b -> Load b #

return :: a -> Load a #

MonadPlus Load Source # 
Instance details

Defined in Erebos.Storage

Methods

mzero :: Load a #

mplus :: Load a -> Load a -> Load a #

MonadError String Load Source # 
Instance details

Defined in Erebos.Storage

Methods

throwError :: String -> Load a #

catchError :: Load a -> (String -> Load a) -> Load a #

data LoadRec a Source #

Instances

Instances details
Alternative LoadRec Source # 
Instance details

Defined in Erebos.Storage

Methods

empty :: LoadRec a #

(<|>) :: LoadRec a -> LoadRec a -> LoadRec a #

some :: LoadRec a -> LoadRec [a] #

many :: LoadRec a -> LoadRec [a] #

Applicative LoadRec Source # 
Instance details

Defined in Erebos.Storage

Methods

pure :: a -> LoadRec a #

(<*>) :: LoadRec (a -> b) -> LoadRec a -> LoadRec b #

liftA2 :: (a -> b -> c) -> LoadRec a -> LoadRec b -> LoadRec c #

(*>) :: LoadRec a -> LoadRec b -> LoadRec b #

(<*) :: LoadRec a -> LoadRec b -> LoadRec a #

Functor LoadRec Source # 
Instance details

Defined in Erebos.Storage

Methods

fmap :: (a -> b) -> LoadRec a -> LoadRec b #

(<$) :: a -> LoadRec b -> LoadRec a #

Monad LoadRec Source # 
Instance details

Defined in Erebos.Storage

Methods

(>>=) :: LoadRec a -> (a -> LoadRec b) -> LoadRec b #

(>>) :: LoadRec a -> LoadRec b -> LoadRec b #

return :: a -> LoadRec a #

MonadPlus LoadRec Source # 
Instance details

Defined in Erebos.Storage

Methods

mzero :: LoadRec a #

mplus :: LoadRec a -> LoadRec a -> LoadRec a #

MonadError String LoadRec Source # 
Instance details

Defined in Erebos.Storage

Methods

throwError :: String -> LoadRec a #

catchError :: LoadRec a -> (String -> LoadRec a) -> LoadRec a #

evalLoad :: Load a -> Ref -> a Source #

loadZero :: a -> Load a Source #

wrappedStore :: MonadIO m => Storable a => Storage -> a -> m (Stored a) Source #

copyStored :: forall c c' 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

data StoreInfo Source #

Constructors

StoreInfo 

Instances

Instances details
Show StoreInfo Source # 
Instance details

Defined in Erebos.Storage

type StoredHistory a = Stored (History a) Source #