Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module contains details for external store implementations.
Synopsis
- type StoreResult a = IO (Either Text a)
- type FeatureKey = Text
- type FeatureNamespace = Text
- data PersistentDataStore = PersistentDataStore {
- persistentDataStoreAllFeatures :: !(FeatureNamespace -> StoreResult (KeyMap SerializedItemDescriptor))
- persistentDataStoreGetFeature :: !(FeatureNamespace -> FeatureKey -> StoreResult (Maybe SerializedItemDescriptor))
- persistentDataStoreUpsertFeature :: !(FeatureNamespace -> FeatureKey -> SerializedItemDescriptor -> StoreResult Bool)
- persistentDataStoreIsInitialized :: !(StoreResult Bool)
- persistentDataStoreInitialize :: !(KeyMap (KeyMap SerializedItemDescriptor) -> StoreResult ())
- data SerializedItemDescriptor = SerializedItemDescriptor {}
- serializeWithPlaceholder :: SerializedItemDescriptor -> ByteString
- byteStringToVersionedData :: ByteString -> Maybe VersionedData
Documentation
type StoreResult a = IO (Either Text a) Source #
The result type for every PersistentDataStore
function. Instead of throwing
an exception, any store related error should return Left
. Exceptions
unrelated to the store should not be caught.
type FeatureKey = Text Source #
Represents the key for a given feature.
type FeatureNamespace = Text Source #
Represents a namespace such as features or segments
data PersistentDataStore Source #
The interface implemented by external stores for use by the SDK.
PersistentDataStore | |
|
data SerializedItemDescriptor Source #
A record representing an object that can be persisted in an external store.
Instances
serializeWithPlaceholder :: SerializedItemDescriptor -> ByteString Source #
Generate a ByteString
representation of the SerializedItemDescriptor
.
If the SerializedItemDescriptor
has either a Nothing
value, or is marked
as deleted, the ByteString representation will be a tombstone marker containing the version and deletion status.
Otherwise, the internal item representation is returned.
byteStringToVersionedData :: ByteString -> Maybe VersionedData Source #
Partially decode the provided ByteString into a VersionedData
struct.
This is useful for persistent stores who need to perform version comparsions before persisting data.