avers-0.0.17.1: Server-side implementation of the Avers storage model

Safe HaskellNone
LanguageHaskell2010

Avers

Contents

Synopsis

The Avers Monad

data Avers a #

Instances
Monad Avers # 
Instance details

Defined in Avers.Types

Methods

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

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

return :: a -> Avers a #

fail :: String -> Avers a #

Functor Avers # 
Instance details

Defined in Avers.Types

Methods

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

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

Applicative Avers # 
Instance details

Defined in Avers.Types

Methods

pure :: a -> Avers a #

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

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

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

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

MonadIO Avers # 
Instance details

Defined in Avers.Types

Methods

liftIO :: IO a -> Avers a #

MonadAvers Avers # 
Instance details

Defined in Avers.Types

Methods

liftAvers :: Avers a -> Avers a #

MonadState Handle Avers # 
Instance details

Defined in Avers.Types

Methods

get :: Avers Handle #

put :: Handle -> Avers () #

state :: (Handle -> (a, Handle)) -> Avers a #

MonadError AversError Avers # 
Instance details

Defined in Avers.Types

Methods

throwError :: AversError -> Avers a #

catchError :: Avers a -> (AversError -> Avers a) -> Avers a #

Types

newtype Path #

Path

Constructors

Path 

Fields

Instances
Eq Path # 
Instance details

Defined in Avers.Types

Methods

(==) :: Path -> Path -> Bool #

(/=) :: Path -> Path -> Bool #

Ord Path # 
Instance details

Defined in Avers.Types

Methods

compare :: Path -> Path -> Ordering #

(<) :: Path -> Path -> Bool #

(<=) :: Path -> Path -> Bool #

(>) :: Path -> Path -> Bool #

(>=) :: Path -> Path -> Bool #

max :: Path -> Path -> Path #

min :: Path -> Path -> Path #

Show Path # 
Instance details

Defined in Avers.Types

Methods

showsPrec :: Int -> Path -> ShowS #

show :: Path -> String #

showList :: [Path] -> ShowS #

IsString Path # 
Instance details

Defined in Avers.Types

Methods

fromString :: String -> Path #

Generic Path # 
Instance details

Defined in Avers.Types

Associated Types

type Rep Path :: Type -> Type #

Methods

from :: Path -> Rep Path x #

to :: Rep Path x -> Path #

ToJSON Path # 
Instance details

Defined in Avers.Types

FromJSON Path # 
Instance details

Defined in Avers.Types

ToDatum Path # 
Instance details

Defined in Avers.Types

Methods

toDatum :: Path -> Datum #

FromDatum Path # 
Instance details

Defined in Avers.Types

type Rep Path # 
Instance details

Defined in Avers.Types

type Rep Path = D1 (MetaData "Path" "Avers.Types" "avers-0.0.17.1-9UlRn0838nX4asVZe4Ejxo" True) (C1 (MetaCons "Path" PrefixI True) (S1 (MetaSel (Just "unPath") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

class Pk a where #

Pk - Types which can be converted to a database primary key.

Methods

toPk :: a -> Text #

Instances
Pk Text # 
Instance details

Defined in Avers.Types

Methods

toPk :: Text -> Text #

Pk ObjectId # 
Instance details

Defined in Avers.Types

Methods

toPk :: ObjectId -> Text #

Pk RevId # 
Instance details

Defined in Avers.Types

Methods

toPk :: RevId -> Text #

Pk ObjId # 
Instance details

Defined in Avers.Types

Methods

toPk :: ObjId -> Text #

Pk Object # 
Instance details

Defined in Avers.Types

Methods

toPk :: Object -> Text #

Pk Patch # 
Instance details

Defined in Avers.Types

Methods

toPk :: Patch -> Text #

Pk Snapshot # 
Instance details

Defined in Avers.Types

Methods

toPk :: Snapshot -> Text #

Pk Secret # 
Instance details

Defined in Avers.Types

Methods

toPk :: Secret -> Text #

Pk SecretId # 
Instance details

Defined in Avers.Types

Methods

toPk :: SecretId -> Text #

Pk Blob # 
Instance details

Defined in Avers.Types

Methods

toPk :: Blob -> Text #

Pk BlobId # 
Instance details

Defined in Avers.Types

Methods

toPk :: BlobId -> Text #

Pk Session # 
Instance details

Defined in Avers.Types

Methods

toPk :: Session -> Text #

Pk SessionId # 
Instance details

Defined in Avers.Types

Methods

toPk :: SessionId -> Text #

Pk (Record a) # 
Instance details

Defined in Avers.Views

Methods

toPk :: Record a -> Text #

newtype ObjId #

ObjId

Constructors

ObjId 

Fields

Instances
Eq ObjId # 
Instance details

Defined in Avers.Types

Methods

(==) :: ObjId -> ObjId -> Bool #

(/=) :: ObjId -> ObjId -> Bool #

Ord ObjId # 
Instance details

Defined in Avers.Types

Methods

compare :: ObjId -> ObjId -> Ordering #

(<) :: ObjId -> ObjId -> Bool #

(<=) :: ObjId -> ObjId -> Bool #

(>) :: ObjId -> ObjId -> Bool #

(>=) :: ObjId -> ObjId -> Bool #

max :: ObjId -> ObjId -> ObjId #

min :: ObjId -> ObjId -> ObjId #

Show ObjId # 
Instance details

Defined in Avers.Types

Methods

showsPrec :: Int -> ObjId -> ShowS #

show :: ObjId -> String #

showList :: [ObjId] -> ShowS #

Generic ObjId # 
Instance details

Defined in Avers.Types

Associated Types

type Rep ObjId :: Type -> Type #

Methods

from :: ObjId -> Rep ObjId x #

to :: Rep ObjId x -> ObjId #

ToJSON ObjId # 
Instance details

Defined in Avers.Types

FromJSON ObjId # 
Instance details

Defined in Avers.Types

ToDatum ObjId # 
Instance details

Defined in Avers.Types

Methods

toDatum :: ObjId -> Datum #

FromDatum ObjId # 
Instance details

Defined in Avers.Types

Pk ObjId # 
Instance details

Defined in Avers.Types

Methods

toPk :: ObjId -> Text #

type Rep ObjId # 
Instance details

Defined in Avers.Types

type Rep ObjId = D1 (MetaData "ObjId" "Avers.Types" "avers-0.0.17.1-9UlRn0838nX4asVZe4Ejxo" True) (C1 (MetaCons "ObjId" PrefixI True) (S1 (MetaSel (Just "unObjId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

rootObjId :: ObjId #

The root object id is used for object created internally or when there is no applicable creator.

newtype RevId #

RevId

Constructors

RevId 

Fields

Instances
Enum RevId # 
Instance details

Defined in Avers.Types

Eq RevId # 
Instance details

Defined in Avers.Types

Methods

(==) :: RevId -> RevId -> Bool #

(/=) :: RevId -> RevId -> Bool #

Ord RevId # 
Instance details

Defined in Avers.Types

Methods

compare :: RevId -> RevId -> Ordering #

(<) :: RevId -> RevId -> Bool #

(<=) :: RevId -> RevId -> Bool #

(>) :: RevId -> RevId -> Bool #

(>=) :: RevId -> RevId -> Bool #

max :: RevId -> RevId -> RevId #

min :: RevId -> RevId -> RevId #

Show RevId # 
Instance details

Defined in Avers.Types

Methods

showsPrec :: Int -> RevId -> ShowS #

show :: RevId -> String #

showList :: [RevId] -> ShowS #

Generic RevId # 
Instance details

Defined in Avers.Types

Associated Types

type Rep RevId :: Type -> Type #

Methods

from :: RevId -> Rep RevId x #

to :: Rep RevId x -> RevId #

ToJSON RevId # 
Instance details

Defined in Avers.Types

FromJSON RevId # 
Instance details

Defined in Avers.Types

ToDatum RevId # 
Instance details

Defined in Avers.Types

Methods

toDatum :: RevId -> Datum #

FromDatum RevId # 
Instance details

Defined in Avers.Types

Pk RevId # 
Instance details

Defined in Avers.Types

Methods

toPk :: RevId -> Text #

type Rep RevId # 
Instance details

Defined in Avers.Types

type Rep RevId = D1 (MetaData "RevId" "Avers.Types" "avers-0.0.17.1-9UlRn0838nX4asVZe4Ejxo" True) (C1 (MetaCons "RevId" PrefixI True) (S1 (MetaSel (Just "unRevId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

zeroRevId :: RevId #

The RevId which is used for the initial snapshot.

data ObjectId #

ObjectId

Constructors

BaseObjectId !ObjId

The base object whose snapshots contain the actual content.

ReleaseObjectId !ObjId !RevId

An object describing a particualar release of the base object.

AuthorizationObjectId !ObjId

Object which contains authorization rules.

Instances
Eq ObjectId # 
Instance details

Defined in Avers.Types

Ord ObjectId # 
Instance details

Defined in Avers.Types

Show ObjectId # 
Instance details

Defined in Avers.Types

Generic ObjectId # 
Instance details

Defined in Avers.Types

Associated Types

type Rep ObjectId :: Type -> Type #

Methods

from :: ObjectId -> Rep ObjectId x #

to :: Rep ObjectId x -> ObjectId #

ToJSON ObjectId # 
Instance details

Defined in Avers.Types

FromJSON ObjectId # 
Instance details

Defined in Avers.Types

ToDatum ObjectId # 
Instance details

Defined in Avers.Types

Methods

toDatum :: ObjectId -> Datum #

FromDatum ObjectId # 
Instance details

Defined in Avers.Types

Pk ObjectId # 
Instance details

Defined in Avers.Types

Methods

toPk :: ObjectId -> Text #

type Rep ObjectId # 
Instance details

Defined in Avers.Types

data Operation #

The operations that can be applied to JSON values.

Constructors

Set

Set is applied to Objects. It is used for adding, updating and deleting properties from the object.

Fields

Splice

Splice is used to manipulate Arrays. It can remove and insert multiple elements in a single operation.

Fields

Instances
Eq Operation # 
Instance details

Defined in Avers.Types

Show Operation # 
Instance details

Defined in Avers.Types

Generic Operation # 
Instance details

Defined in Avers.Types

Associated Types

type Rep Operation :: Type -> Type #

ToJSON Operation # 
Instance details

Defined in Avers.Types

FromJSON Operation # 
Instance details

Defined in Avers.Types

ToDatum Operation # 
Instance details

Defined in Avers.Types

Methods

toDatum :: Operation -> Datum #

FromDatum Operation # 
Instance details

Defined in Avers.Types

type Rep Operation # 
Instance details

Defined in Avers.Types

Object

data Object #

Instances
Show Object # 
Instance details

Defined in Avers.Types

Generic Object # 
Instance details

Defined in Avers.Types

Associated Types

type Rep Object :: Type -> Type #

Methods

from :: Object -> Rep Object x #

to :: Rep Object x -> Object #

ToJSON Object # 
Instance details

Defined in Avers.Types

FromJSON Object # 
Instance details

Defined in Avers.Types

ToDatum Object # 
Instance details

Defined in Avers.Types

Methods

toDatum :: Object -> Datum #

FromDatum Object # 
Instance details

Defined in Avers.Types

Pk Object # 
Instance details

Defined in Avers.Types

Methods

toPk :: Object -> Text #

type Rep Object # 
Instance details

Defined in Avers.Types

exists :: ObjId -> Avers Bool #

True if the object exists.

createObject :: ToJSON a => ObjectType a -> ObjId -> a -> Avers ObjId #

Create a new object of the given type. An initial snapshot (RevId 0) is created from the supplied content.

createObject' :: ToJSON a => ObjId -> UTCTime -> ObjectType a -> ObjId -> a -> Avers () #

A more low-level version of createObject, for use when you want to generate your own ObjId or create objects at a specific time.

lookupObject :: ObjId -> Avers Object #

Lookup an Object by its ObjId. Throws ObjectNotFound if the object doesn't exist.

deleteObject :: ObjId -> Avers () #

Mark the object as deleted.

pruneObject :: ObjId -> Avers () #

Prune the object from the database. This is only allowed if the object is marked as deleted. Note that this is a very dangerous operation, it can not be undone.

TODO: Prune related Release and Authoriation objects.

createCheckpoint :: ObjectId -> ObjId -> Avers RevId #

Create a checkpoint for for the given object. All patches (and of course snapshots) before the checkpoint can be dropped. Use vacuumObject to do that.

vacuumObject :: ObjectId -> Avers () #

Drop all patches and snapshots before the most recent checkpoint. This effectively drops the object's history, and frees space in the database.

Patch

data Patch #

Patch

Instances
Show Patch # 
Instance details

Defined in Avers.Types

Methods

showsPrec :: Int -> Patch -> ShowS #

show :: Patch -> String #

showList :: [Patch] -> ShowS #

Generic Patch # 
Instance details

Defined in Avers.Types

Associated Types

type Rep Patch :: Type -> Type #

Methods

from :: Patch -> Rep Patch x #

to :: Rep Patch x -> Patch #

ToJSON Patch # 
Instance details

Defined in Avers.Types

FromJSON Patch # 
Instance details

Defined in Avers.Types

ToDatum Patch # 
Instance details

Defined in Avers.Types

Methods

toDatum :: Patch -> Datum #

FromDatum Patch # 
Instance details

Defined in Avers.Types

Pk Patch # 
Instance details

Defined in Avers.Types

Methods

toPk :: Patch -> Text #

type Rep Patch # 
Instance details

Defined in Avers.Types

data PatchError #

Constructors

UnknownPatchError !Text 
Instances
Show PatchError # 
Instance details

Defined in Avers.Types

Generic PatchError # 
Instance details

Defined in Avers.Types

Associated Types

type Rep PatchError :: Type -> Type #

type Rep PatchError # 
Instance details

Defined in Avers.Types

type Rep PatchError = D1 (MetaData "PatchError" "Avers.Types" "avers-0.0.17.1-9UlRn0838nX4asVZe4Ejxo" False) (C1 (MetaCons "UnknownPatchError" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text)))

Snapshot

data Snapshot #

Snapshot

Instances
Show Snapshot # 
Instance details

Defined in Avers.Types

Generic Snapshot # 
Instance details

Defined in Avers.Types

Associated Types

type Rep Snapshot :: Type -> Type #

Methods

from :: Snapshot -> Rep Snapshot x #

to :: Rep Snapshot x -> Snapshot #

ToJSON Snapshot # 
Instance details

Defined in Avers.Types

FromJSON Snapshot # 
Instance details

Defined in Avers.Types

ToDatum Snapshot # 
Instance details

Defined in Avers.Types

Methods

toDatum :: Snapshot -> Datum #

FromDatum Snapshot # 
Instance details

Defined in Avers.Types

Pk Snapshot # 
Instance details

Defined in Avers.Types

Methods

toPk :: Snapshot -> Text #

type Rep Snapshot # 
Instance details

Defined in Avers.Types

type Rep Snapshot = D1 (MetaData "Snapshot" "Avers.Types" "avers-0.0.17.1-9UlRn0838nX4asVZe4Ejxo" False) (C1 (MetaCons "Snapshot" PrefixI True) (S1 (MetaSel (Just "snapshotObjectId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 ObjectId) :*: (S1 (MetaSel (Just "snapshotRevisionId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 RevId) :*: S1 (MetaSel (Just "snapshotContent") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Value))))

lookupLatestSnapshot :: ObjectId -> Avers Snapshot #

Get the snapshot of the newest revision of the given object.

objectContent :: FromJSON a => ObjectId -> Avers a #

Fetch the content of the object and try to parse it.

This function will fail with a ParseError if the content can not be decoded into the desired type.

Release

data Release #

Release

Constructors

Release 
Instances
ToJSON Release # 
Instance details

Defined in Avers.Types

FromJSON Release # 
Instance details

Defined in Avers.Types

createRelease :: ObjId -> RevId -> Avers () #

Create a new release of the given revision. If the object doesn't exist, it will fail with ObjectNotFound.

Patching

resolvePathIn :: Path -> Value -> Maybe Value #

Resolve the path in the object.

Session

newtype SessionId #

SessionId

Constructors

SessionId 

Fields

Instances
Generic SessionId # 
Instance details

Defined in Avers.Types

Associated Types

type Rep SessionId :: Type -> Type #

ToJSON SessionId # 
Instance details

Defined in Avers.Types

FromJSON SessionId # 
Instance details

Defined in Avers.Types

ToDatum SessionId # 
Instance details

Defined in Avers.Types

Methods

toDatum :: SessionId -> Datum #

FromDatum SessionId # 
Instance details

Defined in Avers.Types

Pk SessionId # 
Instance details

Defined in Avers.Types

Methods

toPk :: SessionId -> Text #

type Rep SessionId # 
Instance details

Defined in Avers.Types

type Rep SessionId = D1 (MetaData "SessionId" "Avers.Types" "avers-0.0.17.1-9UlRn0838nX4asVZe4Ejxo" True) (C1 (MetaCons "SessionId" PrefixI True) (S1 (MetaSel (Just "unSessionId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

data Session #

The session record that is stored in the database.

A session is a unique identifier attached to a particular object. It contains the creation date and when it was last accessed. If you need to store additional data for a session, we recommend to use cookies.

Instances
Generic Session # 
Instance details

Defined in Avers.Types

Associated Types

type Rep Session :: Type -> Type #

Methods

from :: Session -> Rep Session x #

to :: Rep Session x -> Session #

ToJSON Session # 
Instance details

Defined in Avers.Types

FromJSON Session # 
Instance details

Defined in Avers.Types

ToDatum Session # 
Instance details

Defined in Avers.Types

Methods

toDatum :: Session -> Datum #

FromDatum Session # 
Instance details

Defined in Avers.Types

Pk Session # 
Instance details

Defined in Avers.Types

Methods

toPk :: Session -> Text #

type Rep Session # 
Instance details

Defined in Avers.Types

type Rep Session = D1 (MetaData "Session" "Avers.Types" "avers-0.0.17.1-9UlRn0838nX4asVZe4Ejxo" False) (C1 (MetaCons "Session" PrefixI True) ((S1 (MetaSel (Just "sessionId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 SessionId) :*: S1 (MetaSel (Just "sessionObjId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 ObjId)) :*: (S1 (MetaSel (Just "sessionCreatedAt") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 UTCTime) :*: S1 (MetaSel (Just "sessionLastAccessedAt") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 UTCTime))))

data ObjectType a #

An ObjectType describes a particular type of object that is managed by Avers.

Constructors

ObjectType 

Fields

data SomeObjectType where #

lookupObjectType :: Text -> Avers SomeObjectType #

Lookup an object type which is registered in the Avers monad.

data AversError #

Instances
Show AversError # 
Instance details

Defined in Avers.Types

Generic AversError # 
Instance details

Defined in Avers.Types

Associated Types

type Rep AversError :: Type -> Type #

MonadError AversError Avers # 
Instance details

Defined in Avers.Types

Methods

throwError :: AversError -> Avers a #

catchError :: Avers a -> (AversError -> Avers a) -> Avers a #

type Rep AversError # 
Instance details

Defined in Avers.Types

data Config #

Configuration of the Avers monad.

Constructors

Config 

Fields

data Handle #

Instances
MonadState Handle Avers # 
Instance details

Defined in Avers.Types

Methods

get :: Avers Handle #

put :: Handle -> Avers () #

state :: (Handle -> (a, Handle)) -> Avers a #

newState :: Config -> IO (Either AversError Handle) #

Deprecated: Use newHandle instead

Blob

newtype BlobId #

BlobId

Constructors

BlobId 

Fields

Instances
Show BlobId # 
Instance details

Defined in Avers.Types

Generic BlobId # 
Instance details

Defined in Avers.Types

Associated Types

type Rep BlobId :: Type -> Type #

Methods

from :: BlobId -> Rep BlobId x #

to :: Rep BlobId x -> BlobId #

ToJSON BlobId # 
Instance details

Defined in Avers.Types

FromJSON BlobId # 
Instance details

Defined in Avers.Types

ToDatum BlobId # 
Instance details

Defined in Avers.Types

Methods

toDatum :: BlobId -> Datum #

FromDatum BlobId # 
Instance details

Defined in Avers.Types

Pk BlobId # 
Instance details

Defined in Avers.Types

Methods

toPk :: BlobId -> Text #

type Rep BlobId # 
Instance details

Defined in Avers.Types

type Rep BlobId = D1 (MetaData "BlobId" "Avers.Types" "avers-0.0.17.1-9UlRn0838nX4asVZe4Ejxo" True) (C1 (MetaCons "BlobId" PrefixI True) (S1 (MetaSel (Just "unBlobId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

data Blob #

Blob

Constructors

Blob 
Instances
Show Blob # 
Instance details

Defined in Avers.Types

Methods

showsPrec :: Int -> Blob -> ShowS #

show :: Blob -> String #

showList :: [Blob] -> ShowS #

Generic Blob # 
Instance details

Defined in Avers.Types

Associated Types

type Rep Blob :: Type -> Type #

Methods

from :: Blob -> Rep Blob x #

to :: Rep Blob x -> Blob #

ToJSON Blob # 
Instance details

Defined in Avers.Types

FromJSON Blob # 
Instance details

Defined in Avers.Types

ToDatum Blob # 
Instance details

Defined in Avers.Types

Methods

toDatum :: Blob -> Datum #

FromDatum Blob # 
Instance details

Defined in Avers.Types

Pk Blob # 
Instance details

Defined in Avers.Types

Methods

toPk :: Blob -> Text #

type Rep Blob # 
Instance details

Defined in Avers.Types

type Rep Blob = D1 (MetaData "Blob" "Avers.Types" "avers-0.0.17.1-9UlRn0838nX4asVZe4Ejxo" False) (C1 (MetaCons "Blob" PrefixI True) (S1 (MetaSel (Just "blobId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 BlobId) :*: (S1 (MetaSel (Just "blobSize") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Int) :*: S1 (MetaSel (Just "blobContentType") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text))))

Secret

newtype SecretId #

SecretId

Constructors

SecretId 

Fields

Instances
Show SecretId # 
Instance details

Defined in Avers.Types

Generic SecretId # 
Instance details

Defined in Avers.Types

Associated Types

type Rep SecretId :: Type -> Type #

Methods

from :: SecretId -> Rep SecretId x #

to :: Rep SecretId x -> SecretId #

ToJSON SecretId # 
Instance details

Defined in Avers.Types

FromJSON SecretId # 
Instance details

Defined in Avers.Types

ToDatum SecretId # 
Instance details

Defined in Avers.Types

Methods

toDatum :: SecretId -> Datum #

FromDatum SecretId # 
Instance details

Defined in Avers.Types

Pk SecretId # 
Instance details

Defined in Avers.Types

Methods

toPk :: SecretId -> Text #

type Rep SecretId # 
Instance details

Defined in Avers.Types

type Rep SecretId = D1 (MetaData "SecretId" "Avers.Types" "avers-0.0.17.1-9UlRn0838nX4asVZe4Ejxo" True) (C1 (MetaCons "SecretId" PrefixI True) (S1 (MetaSel (Just "unSecretId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

data Secret #

Secret

A Secret is a password (encrypted with scrypt) that is attached to a SecretId (for example the ObjId of an account).

It is up to you to ensure that SecretIds are unique. If you use ObjIds then they by definition are.

Constructors

Secret 
Instances
Generic Secret # 
Instance details

Defined in Avers.Types

Associated Types

type Rep Secret :: Type -> Type #

Methods

from :: Secret -> Rep Secret x #

to :: Rep Secret x -> Secret #

ToJSON Secret # 
Instance details

Defined in Avers.Types

FromJSON Secret # 
Instance details

Defined in Avers.Types

ToDatum Secret # 
Instance details

Defined in Avers.Types

Methods

toDatum :: Secret -> Datum #

FromDatum Secret # 
Instance details

Defined in Avers.Types

Pk Secret # 
Instance details

Defined in Avers.Types

Methods

toPk :: Secret -> Text #

type Rep Secret # 
Instance details

Defined in Avers.Types

type Rep Secret = D1 (MetaData "Secret" "Avers.Types" "avers-0.0.17.1-9UlRn0838nX4asVZe4Ejxo" False) (C1 (MetaCons "Secret" PrefixI True) (S1 (MetaSel (Just "secretId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 SecretId) :*: S1 (MetaSel (Just "secretValue") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text)))

verifySecret :: SecretId -> Text -> Avers () #

Verify the value against the secret. If that fails, then this function throws an error.

This function automatically updates the secret in the database if the scrypt params have changed.

applyObjectUpdates #

Arguments

:: ObjectId

The object which you want to update

-> RevId

The RevId against which the operations were created

-> ObjId

Committer

-> [Operation]

The operations to apply

-> Bool

True if validation should be skipped

-> Avers ([Patch], Int, [Patch]) 

newId :: Int -> IO Text #

Views

data View obj a #

Constructors

View 

Fields

data SomeView obj where #

Constructors

SomeView :: (ToDatum a, FromDatum a, FromJSON obj, ToJSON a) => View obj a -> SomeView obj 

viewTable :: View obj a -> Exp Table #

Construct the table name for the given view. The table names look something like this: "view_openGames"

updateView :: ToDatum a => View obj a -> ObjId -> Maybe obj -> Avers () #

Index

data Index a #

Constructors

Index 

data SomeIndex where #

Constructors

SomeIndex :: IsDatum a => Index a -> SomeIndex 

Metrics

Change

data Change #

A change in the system, for example a new object, patch, release, blob etc.

Constructors

CPatch !Patch

A new patch was created.

Instances
Show Change # 
Instance details

Defined in Avers.Types

Generic Change # 
Instance details

Defined in Avers.Types

Associated Types

type Rep Change :: Type -> Type #

Methods

from :: Change -> Rep Change x #

to :: Rep Change x -> Change #

ToJSON Change # 
Instance details

Defined in Avers.Types

type Rep Change # 
Instance details

Defined in Avers.Types

type Rep Change = D1 (MetaData "Change" "Avers.Types" "avers-0.0.17.1-9UlRn0838nX4asVZe4Ejxo" False) (C1 (MetaCons "CPatch" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Patch)))

changeChannel :: Handle -> IO (TChan Change) #

Return a TChan to which all changes in the system are streamed. Make sure to continuously drain items from the TChan, otherwise they will accumulate in memory and you will run OOM eventually.

Do not write into the channel!