Commits

Bryan O'Sullivan committed 2f943e8

Change the types of getMany and putMany to be ... nicer.

Comments (0)

Files changed (2)

src/Network/Riak/Monoid.hs

        Connection -> Bucket -> Key -> R -> IO (Maybe (c, VClock))
 get conn bucket key r = fmap (first mconcat) `fmap` V.get conn bucket key r
 
-getMany :: (Monoid c, V.IsContent c) => Connection -> [(Bucket, Key)] -> R
+getMany :: (Monoid c, V.IsContent c) => Connection -> Bucket -> [Key] -> R
         -> IO [Maybe (c, VClock)]
-getMany conn bks r = map (fmap (first mconcat)) `fmap` V.getMany conn bks r
+getMany conn b ks r = map (fmap (first mconcat)) `fmap` V.getMany conn b ks r
 
 put :: (Monoid c, V.IsContent c) =>
        Connection -> Bucket -> Key -> Maybe VClock -> c -> W -> DW

src/Network/Riak/Value.hs

   putResp =<< exchange conn
               (Req.put bucket key mvclock (toContent val) w dw True)
 
-putMany :: (IsContent c) => Connection -> [(Bucket, Key, Maybe VClock, c)]
+putMany :: (IsContent c) => Connection -> Bucket -> [(Key, Maybe VClock, c)]
         -> W -> DW -> IO [([c], VClock)]
-putMany conn puts w dw =
-  mapM putResp =<< pipeline conn (map (\(b,k,v,c) -> Req.put b k v (toContent c) w dw True) puts)
+putMany conn b puts w dw =
+  mapM putResp =<< pipeline conn (map (\(k,v,c) -> Req.put b k v (toContent c) w dw True) puts)
 
 putResp :: (IsContent c) => PutResponse -> IO ([c], VClock)
 putResp PutResponse{..} = do
 put_ conn bucket key mvclock val w dw =
   exchange_ conn (Req.put bucket key mvclock (toContent val) w dw False)
 
-putMany_ :: (IsContent c) => Connection -> [(Bucket, Key, Maybe VClock, c)]
+putMany_ :: (IsContent c) => Connection -> Bucket -> [(Key, Maybe VClock, c)]
          -> W -> DW -> IO ()
-putMany_ conn puts w dw =
-  pipeline_ conn . map (\(b,k,v,c) -> Req.put b k v (toContent c) w dw False) $ puts
+putMany_ conn b puts w dw =
+  pipeline_ conn . map (\(k,v,c) -> Req.put b k v (toContent c) w dw False) $ puts
 
 get :: (IsContent c) => Connection -> Bucket -> Key -> R
     -> IO (Maybe ([c], VClock))
 get conn bucket key r = getResp =<< exchangeMaybe conn (Req.get bucket key r)
 
-getMany :: (IsContent c) => Connection -> [(Bucket, Key)] -> R
+getMany :: (IsContent c) => Connection -> Bucket -> [Key] -> R
         -> IO [Maybe ([c], VClock)]
-getMany conn bks r =
-    mapM getResp =<< pipelineMaybe conn (map (\(b,k) -> Req.get b k r) bks)
+getMany conn b ks r =
+    mapM getResp =<< pipelineMaybe conn (map (\k -> Req.get b k r) ks)
 
 getResp :: (IsContent c) => Maybe GetResponse -> IO (Maybe ([c], VClock))
 getResp resp =
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.