<commit_before>{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
-- |
-- Module       : Database.HyperDex.Internal.Ffi.Client
-- Copyright    : (c) <NAME> 2013-2014
--                (c) <NAME> 2013-2014 
-- License      : BSD-style
-- Maintainer   : <EMAIL>
-- Stability    : unstable
-- Portability  : portable
--
module Database.HyperDex.Internal.Ffi.Client
  ( -- Simple, single-key operations
    get
  , put
  , putIfNotExist
  , delete
  , putConditional
    -- Atomic numeric operations
  , atomicAdd, atomicSub
  , atomicMul, atomicDiv
    -- Atomic integral operations
  , atomicMod
  , atomicAnd, atomicOr
  , atomicXor
    -- Atomic string operations
  , stringPrepend, stringAppend
  , listLPush, listRPush
  , setAdd, setRemove
  , setUnion, setIntersect
    -- Atomic simple map operations
  , mapAdd, mapRemove
  -- , atomicConditionalMapInsert
    -- Atomic numeric value operations
  , mapAtomicAdd, mapAtomicSub
  , mapAtomicMul, mapAtomicDiv
    -- Atomic integral value operations
  , mapAtomicMod
  , mapAtomicAnd, mapAtomicOr
  , mapAtomicXor
    -- Atomic string value operations
  , mapStringPrepend
  , mapStringAppend
  -- Search operations
  , search
  , describeSearch
  , deleteGroup
  , count
  )
  where

import Foreign
import Foreign.C

import Data.ByteString (ByteString, packCString)

import Control.Monad.IO.Class

#include "hyperdex/client.h"

{# import Database.HyperDex.Internal.Client #}
{# import Database.HyperDex.Internal.Data.Attribute #}
{# import Database.HyperDex.Internal.Data.AttributeCheck #}
{# import Database.HyperDex.Internal.Data.MapAttribute #}
import Database.HyperDex.Internal.Core
import Database.HyperDex.Internal.Handle (wrapHyperCallHandle)
import Database.HyperDex.Internal.Util
import Database.HyperDex.Internal.Util.Resource
import qualified Data.ByteString as BS
import Control.Monad

type ClientCall = Client
                -> CString 
                -> CString -> CULong
                -> Ptr Attribute -> CULong
                -> Ptr CInt
                -> IO CLong

type MapCall = Client
             -> CString 
             -> CString -> CULong
             -> Ptr MapAttribute -> CULong
             -> Ptr CInt
             -> IO CLong

put           = hyperdexClientOp {# call hyperdex_client_put              #}
putIfNotExist = hyperdexClientOp {# call hyperdex_client_put_if_not_exist #}<commit_msg>Fix redundant imports for -wall, -werror build.<commit_after>{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
-- |
-- Module       : Database.HyperDex.Internal.Ffi.Client
-- Copyright    : (c) <NAME> 2013-2014
--                (c) <NAME> 2013-2014 
-- License      : BSD-style
-- Maintainer   : <EMAIL>
-- Stability    : unstable
-- Portability  : portable
--
module Database.HyperDex.Internal.Ffi.Client
  ( -- Simple, single-key operations
    get
  , put
  , putIfNotExist
  , delete
  , putConditional
    -- Atomic numeric operations
  , atomicAdd, atomicSub
  , atomicMul, atomicDiv
    -- Atomic integral operations
  , atomicMod
  , atomicAnd, atomicOr
  , atomicXor
    -- Atomic string operations
  , stringPrepend, stringAppend
  , listLPush, listRPush
  , setAdd, setRemove
  , setUnion, setIntersect
    -- Atomic simple map operations
  , mapAdd, mapRemove
  -- , atomicConditionalMapInsert
    -- Atomic numeric value operations
  , mapAtomicAdd, mapAtomicSub
  , mapAtomicMul, mapAtomicDiv
    -- Atomic integral value operations
  , mapAtomicMod
  , mapAtomicAnd, mapAtomicOr
  , mapAtomicXor
    -- Atomic string value operations
  , mapStringPrepend
  , mapStringAppend
  -- Search operations
  , search
  , describeSearch
  , deleteGroup
  , count
  )
  where

import Foreign
import Foreign.C

import Data.ByteString (ByteString, packCString)

import Control.Monad.IO.Class

#include "hyperdex/client.h"

{# import Database.HyperDex.Internal.Client #}
{# import Database.HyperDex.Internal.Data.Attribute #}
{# import Database.HyperDex.Internal.Data.AttributeCheck #}
{# import Database.HyperDex.Internal.Data.MapAttribute #}
import Database.HyperDex.Internal.Core
import Database.HyperDex.Internal.Handle (wrapHyperCallHandle)
import Database.HyperDex.Internal.Util
import Database.HyperDex.Internal.Util.Resource

type ClientCall = Client
                -> CString 
                -> CString -> CULong
                -> Ptr Attribute -> CULong
                -> Ptr CInt
                -> IO CLong

type MapCall = Client
             -> CString 
             -> CString -> CULong
             -> Ptr MapAttribute -> CULong
             -> Ptr CInt
             -> IO CLong

put           = hyperdexClientOp {# call hyperdex_client_put              #}
putIfNotExist = hyperdexClientOp {# call hyperdex_client_put_if_not_exist #}
{'fraction_non_alphanumeric': 0.09378960709759189, 'fraction_numerical': 0.006759611322348965, 'mean_word_length': 2.595292331055429, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2757877', 'n_tokens_mistral': 1504, 'n_tokens_neox': 1408, 'n_words': 321}