-- | -- Module: Network.Riak.CRDT.Request -- Copyright: (c) 2016 Sentenai -- Author: Antonio Nikishaev -- License: Apache -- Maintainer: Tim McGilchrist , Mark Hibberd -- Stability: experimental -- Portability: portable -- module Network.Riak.CRDT.Request ( get , counterUpdate , setUpdate , mapUpdate ) where import Data.ByteString (ByteString) import qualified Data.Riak.Proto as Proto import Network.Riak.CRDT.Ops import qualified Network.Riak.CRDT.Types as CRDT import Network.Riak.Lens import Network.Riak.Types counterUpdate :: [CRDT.CounterOp] -> BucketType -> Bucket -> Key -> Proto.DtUpdateReq counterUpdate ops = update (counterUpdateOp ops) setUpdate :: [CRDT.SetOp] -> BucketType -> Bucket -> Key -> Proto.DtUpdateReq setUpdate ops = update (setUpdateOp ops) mapUpdate :: [CRDT.MapOp] -> BucketType -> Bucket -> Key -> Proto.DtUpdateReq mapUpdate ops = update (mapUpdateOp ops) update :: Proto.DtOp -> BucketType -> Bucket -> Key -> Proto.DtUpdateReq update op t b k = Proto.defMessage & Proto.bucket .~ b & Proto.key .~ k & Proto.op .~ op & Proto.type' .~ t get :: ByteString -> ByteString -> ByteString -> Proto.DtFetchReq get t b k = Proto.defMessage & Proto.bucket .~ b & Proto.key .~ k & Proto.type' .~ t