Safe Haskell | None |
---|---|
Language | Haskell2010 |
Raw bindings to the underlying C client API. These are not memory safe. For documentation, see https://apple.github.io/foundationdb/api-c.html.
Synopsis
- currentAPIVersion :: Int
- selectAPIVersion :: Int -> IO CFDBError
- setupNetwork :: IO CFDBError
- runNetwork :: IO CFDBError
- stopNetwork :: IO CFDBError
- networkSetOption :: NetworkOption -> IO CFDBError
- newtype Future a = Future (Ptr (Future a))
- futureCancel :: Future a -> IO ()
- futureDestroy :: Future a -> IO ()
- futureDestroyPtr :: FunPtr (Ptr a -> IO ())
- futureBlockUntilReady :: Future a -> IO CFDBError
- futureIsReady :: Future a -> IO Bool
- futureReleaseMemory :: Future a -> IO ()
- futureGetError :: Future a -> IO CFDBError
- futureGetInt64 :: Future Int64 -> IO (CFDBError, Int64)
- futureGetKey :: Future ByteString -> IO (Either CFDBError ByteString)
- futureGetValue :: Future (Maybe ByteString) -> IO (Either CFDBError (Maybe ByteString))
- futureGetStringArray :: Future [ByteString] -> IO (Either CFDBError [ByteString])
- data FDBKeyValue = FDBKeyValue {
- key :: Ptr ()
- key_length :: Int
- value :: Ptr ()
- value_length :: Int
- futureGetKeyValueArray :: Future [(ByteString, ByteString)] -> IO (Either CFDBError ([(ByteString, ByteString)], Bool))
- data DatabasePtr
- createDatabase :: String -> IO (CFDBError, DatabasePtr)
- databaseDestroy :: DatabasePtr -> IO ()
- databaseSetOption :: DatabasePtr -> DatabaseOption -> IO CFDBError
- databaseCreateTransaction :: DatabasePtr -> IO (CFDBError, Transaction)
- newtype Transaction = Transaction (Ptr Transaction)
- data KeySelector
- keySelectorBytes :: KeySelector -> ByteString
- keySelectorTuple :: KeySelector -> (ByteString, Bool, Int)
- tupleKeySelector :: (ByteString, Bool, Int) -> KeySelector
- transactionDestroy :: Transaction -> IO ()
- transactionDestroyPtr :: FunPtr (Ptr a -> IO ())
- transactionSetOption :: Transaction -> TransactionOption -> IO CFDBError
- transactionSetReadVersion :: Transaction -> Int64 -> IO ()
- transactionGetReadVersion :: Transaction -> IO (Future Int64)
- transactionGet :: Transaction -> ByteString -> Bool -> IO (Future (Maybe ByteString))
- transactionGetKey :: Transaction -> ByteString -> Bool -> Int -> Bool -> IO (Future ByteString)
- transactionGetAddressesForKey :: Transaction -> ByteString -> IO (Future [ByteString])
- transactionGetRange :: Transaction -> KeySelector -> KeySelector -> Int -> Int -> FDBStreamingMode -> Int -> Bool -> Bool -> IO (Future [(ByteString, ByteString)])
- data FDBStreamingMode
- transactionSet :: Transaction -> ByteString -> ByteString -> IO ()
- transactionClear :: Transaction -> ByteString -> IO ()
- transactionClearRange :: Transaction -> ByteString -> ByteString -> IO ()
- transactionAtomicOp :: Transaction -> ByteString -> MutationType -> IO ()
- transactionCommit :: Transaction -> IO (Future ())
- transactionGetCommittedVersion :: Transaction -> IO (CFDBError, Int)
- transactionGetApproximateSize :: Transaction -> IO (Future Int64)
- transactionGetVersionstamp :: Transaction -> IO (Future ByteString)
- transactionWatch :: Transaction -> ByteString -> IO (Future ())
- transactionOnError :: Transaction -> CFDBError -> IO (Future ())
- transactionReset :: Transaction -> IO ()
- transactionCancel :: Transaction -> IO ()
- transactionAddConflictRange :: Transaction -> ByteString -> ByteString -> FDBConflictRangeType -> IO CFDBError
- data FDBConflictRangeType
- newtype CFDBError = CFDBError {
- getCFDBError :: CInt
- isError :: CFDBError -> Bool
- getError :: CFDBError -> IO String
- errorPredicate :: FDBErrorPredicate -> CFDBError -> Bool
- data FDBErrorPredicate
- data MappedKeyValue = MappedKeyValue {}
- getMappedRangeResult :: Future [MappedKeyValue] -> IO (Either CFDBError ([MappedKeyValue], Bool))
- transactionGetMappedRange :: Transaction -> KeySelector -> KeySelector -> ByteString -> Int -> Int -> FDBStreamingMode -> Int -> Bool -> Bool -> IO (Future [MappedKeyValue])
API versioning
currentAPIVersion :: Int Source #
Current version of the installed FDB library. For example, returns 630 if you are using FoundationDB client 6.3.x.
Network
runNetwork :: IO CFDBError Source #
Future
Instances
Show (Future a) Source # | |
Storable (Future a) Source # | |
Defined in FoundationDB.Internal.Bindings |
futureCancel :: Future a -> IO () Source #
futureDestroy :: Future a -> IO () Source #
futureReleaseMemory :: Future a -> IO () Source #
futureGetKey :: Future ByteString -> IO (Either CFDBError ByteString) Source #
futureGetValue :: Future (Maybe ByteString) -> IO (Either CFDBError (Maybe ByteString)) Source #
futureGetStringArray :: Future [ByteString] -> IO (Either CFDBError [ByteString]) Source #
data FDBKeyValue Source #
FDBKeyValue | |
|
Instances
Eq FDBKeyValue Source # | |
Defined in FoundationDB.Internal.Bindings (==) :: FDBKeyValue -> FDBKeyValue -> Bool # (/=) :: FDBKeyValue -> FDBKeyValue -> Bool # | |
Show FDBKeyValue Source # | |
Defined in FoundationDB.Internal.Bindings showsPrec :: Int -> FDBKeyValue -> ShowS # show :: FDBKeyValue -> String # showList :: [FDBKeyValue] -> ShowS # | |
Storable FDBKeyValue Source # | |
Defined in FoundationDB.Internal.Bindings sizeOf :: FDBKeyValue -> Int # alignment :: FDBKeyValue -> Int # peekElemOff :: Ptr FDBKeyValue -> Int -> IO FDBKeyValue # pokeElemOff :: Ptr FDBKeyValue -> Int -> FDBKeyValue -> IO () # peekByteOff :: Ptr b -> Int -> IO FDBKeyValue # pokeByteOff :: Ptr b -> Int -> FDBKeyValue -> IO () # peek :: Ptr FDBKeyValue -> IO FDBKeyValue # poke :: Ptr FDBKeyValue -> FDBKeyValue -> IO () # |
futureGetKeyValueArray :: Future [(ByteString, ByteString)] -> IO (Either CFDBError ([(ByteString, ByteString)], Bool)) Source #
Database
data DatabasePtr Source #
Handle to the underlying C API client state.
Instances
Eq DatabasePtr Source # | |
Defined in FoundationDB.Internal.Bindings (==) :: DatabasePtr -> DatabasePtr -> Bool # (/=) :: DatabasePtr -> DatabasePtr -> Bool # | |
Show DatabasePtr Source # | |
Defined in FoundationDB.Internal.Bindings showsPrec :: Int -> DatabasePtr -> ShowS # show :: DatabasePtr -> String # showList :: [DatabasePtr] -> ShowS # | |
Storable DatabasePtr Source # | |
Defined in FoundationDB.Internal.Bindings sizeOf :: DatabasePtr -> Int # alignment :: DatabasePtr -> Int # peekElemOff :: Ptr DatabasePtr -> Int -> IO DatabasePtr # pokeElemOff :: Ptr DatabasePtr -> Int -> DatabasePtr -> IO () # peekByteOff :: Ptr b -> Int -> IO DatabasePtr # pokeByteOff :: Ptr b -> Int -> DatabasePtr -> IO () # peek :: Ptr DatabasePtr -> IO DatabasePtr # poke :: Ptr DatabasePtr -> DatabasePtr -> IO () # |
createDatabase :: String -> IO (CFDBError, DatabasePtr) Source #
databaseDestroy :: DatabasePtr -> IO () Source #
databaseSetOption :: DatabasePtr -> DatabaseOption -> IO CFDBError Source #
Transaction
newtype Transaction Source #
Instances
Show Transaction Source # | |
Defined in FoundationDB.Internal.Bindings showsPrec :: Int -> Transaction -> ShowS # show :: Transaction -> String # showList :: [Transaction] -> ShowS # | |
Storable Transaction Source # | |
Defined in FoundationDB.Internal.Bindings sizeOf :: Transaction -> Int # alignment :: Transaction -> Int # peekElemOff :: Ptr Transaction -> Int -> IO Transaction # pokeElemOff :: Ptr Transaction -> Int -> Transaction -> IO () # peekByteOff :: Ptr b -> Int -> IO Transaction # pokeByteOff :: Ptr b -> Int -> Transaction -> IO () # peek :: Ptr Transaction -> IO Transaction # poke :: Ptr Transaction -> Transaction -> IO () # |
data KeySelector Source #
Specifies a key in the database. See the official
docs
for more information. These can be supplied to getKey
or used to build a
Range
.
LastLessThan ByteString | Selects the lexicographically greatest key less than the specified key. |
LastLessOrEq ByteString | Selects the lexicographically greatest less than or equal to the specified key. |
FirstGreaterThan ByteString | Selects the lexicographically least key greater than the specified key. |
FirstGreaterOrEq ByteString | Selects the lexicographically least key greater than or equal to the specified key. |
WithOffset Int KeySelector | offsets a key selector. Using |
Instances
Eq KeySelector Source # | |
Defined in FoundationDB.Internal.Bindings (==) :: KeySelector -> KeySelector -> Bool # (/=) :: KeySelector -> KeySelector -> Bool # | |
Ord KeySelector Source # | |
Defined in FoundationDB.Internal.Bindings compare :: KeySelector -> KeySelector -> Ordering # (<) :: KeySelector -> KeySelector -> Bool # (<=) :: KeySelector -> KeySelector -> Bool # (>) :: KeySelector -> KeySelector -> Bool # (>=) :: KeySelector -> KeySelector -> Bool # max :: KeySelector -> KeySelector -> KeySelector # min :: KeySelector -> KeySelector -> KeySelector # | |
Show KeySelector Source # | |
Defined in FoundationDB.Internal.Bindings showsPrec :: Int -> KeySelector -> ShowS # show :: KeySelector -> String # showList :: [KeySelector] -> ShowS # |
keySelectorTuple :: KeySelector -> (ByteString, Bool, Int) Source #
Convert a KeySelector
to its or_equal, offset settings. Equivalent to
the macros FDB_KEYSEL_LAST_LESS_THAN
etc.
tupleKeySelector :: (ByteString, Bool, Int) -> KeySelector Source #
Inverse of keySelectorTuple
transactionDestroy :: Transaction -> IO () Source #
transactionSetReadVersion :: Transaction -> Int64 -> IO () Source #
transactionGetReadVersion :: Transaction -> IO (Future Int64) Source #
transactionGet :: Transaction -> ByteString -> Bool -> IO (Future (Maybe ByteString)) Source #
transactionGetKey :: Transaction -> ByteString -> Bool -> Int -> Bool -> IO (Future ByteString) Source #
transactionGetAddressesForKey :: Transaction -> ByteString -> IO (Future [ByteString]) Source #
:: Transaction | |
-> KeySelector | begin |
-> KeySelector | end |
-> Int | max number of pairs to return |
-> Int | max number of bytes to return |
-> FDBStreamingMode | |
-> Int | if FDBStreamingMode is FdbStreamingModeIterator, start this at 1 and increment by for each successive call reading this range. Otherwise, ignored. |
-> Bool | isSnapshotRead |
-> Bool | whether to return pairs in reverse order |
-> IO (Future [(ByteString, ByteString)]) |
data FDBStreamingMode Source #
StreamingModeWantAll | |
StreamingModeIterator | |
StreamingModeExact | |
StreamingModeSmall | |
StreamingModeMedium | |
StreamingModeLarge | |
StreamingModeSerial |
Instances
transactionSet :: Transaction -> ByteString -> ByteString -> IO () Source #
transactionClear :: Transaction -> ByteString -> IO () Source #
transactionClearRange :: Transaction -> ByteString -> ByteString -> IO () Source #
:: Transaction | |
-> ByteString | key |
-> MutationType | |
-> IO () |
transactionCommit :: Transaction -> IO (Future ()) Source #
transactionWatch :: Transaction -> ByteString -> IO (Future ()) Source #
transactionOnError :: Transaction -> CFDBError -> IO (Future ()) Source #
transactionReset :: Transaction -> IO () Source #
transactionCancel :: Transaction -> IO () Source #
transactionAddConflictRange :: Transaction -> ByteString -> ByteString -> FDBConflictRangeType -> IO CFDBError Source #
data FDBConflictRangeType Source #
Instances
Error
errorPredicate :: FDBErrorPredicate -> CFDBError -> Bool Source #
data FDBErrorPredicate Source #
Instances
data MappedKeyValue Source #
The result of a mapped key value query, containing the parent key and value (i.e., the key and value in the secondary index), and the range of key-value pairs retrieved based on the range query generated from the mapper's operation on the parent key and value.
WARNING: FDB's docs warn that the returned KeySelector fields have not yet been tested. Use them at your own risk!
Instances
Eq MappedKeyValue Source # | |
Defined in FoundationDB.Internal.Bindings (==) :: MappedKeyValue -> MappedKeyValue -> Bool # (/=) :: MappedKeyValue -> MappedKeyValue -> Bool # | |
Show MappedKeyValue Source # | |
Defined in FoundationDB.Internal.Bindings showsPrec :: Int -> MappedKeyValue -> ShowS # show :: MappedKeyValue -> String # showList :: [MappedKeyValue] -> ShowS # |
getMappedRangeResult :: Future [MappedKeyValue] -> IO (Either CFDBError ([MappedKeyValue], Bool)) Source #
Extracts the mappedKeyValue results from the future, along with a bool indicating whether more results are available.
transactionGetMappedRange Source #
:: Transaction | |
-> KeySelector | begin |
-> KeySelector | end |
-> ByteString | Mapper name |
-> Int | max number of pairs to return |
-> Int | max number of bytes to return |
-> FDBStreamingMode | |
-> Int | if FDBStreamingMode is FdbStreamingModeIterator, start this at 1 and increment by for each successive call reading this range. Otherwise, ignored. |
-> Bool | isSnapshotRead |
-> Bool | whether to return pairs in reverse order |
-> IO (Future [MappedKeyValue]) |