Anonymous avatar Anonymous committed 87c3ab2

expose R,W,DW to python clients

Comments (0)

Files changed (1)

client_lib/jiak.py

     def list_bucket(self, Bucket):
         return self._expect(200,
                  self._do_req("GET", self.JKP + urllib.quote_plus(Bucket)))
-    def store(self, JObj):
+    def store(self, JObj, W=2,DW=2):
         NewData = self._expect(200,
                      self._do_req("PUT",
                                   self.JKP
                                   + urllib.quote_plus(JObj.bucket) + "/"
                                   + urllib.quote_plus(JObj.key)
-                                  + "?returnbody=true",
+                                  + "?returnbody=true"
+                                  + "&w=" + str(W)
+                                  + "&dw=" + str(DW),
                                   JObj.to_json(),
                                   {"Content-Type": "application/json"}))
         JObj.update(NewData)
-    def fetch(self, bucket, key):
+    def fetch(self, bucket, key, R=2):
         Resp = self._do_req("GET",
                             self.JKP + urllib.quote_plus(bucket)
-                            + "/" + urllib.quote_plus(key))
+                            + "/" + urllib.quote_plus(key)
+                            + "?r=" + str(R))
         if Resp.status == 404:
             return None
         Data = self._expect(200,Resp)
         Obj = JiakObject(bucket, key)
         Obj.update(Data)
         return Obj
-    def delete(self, bucket, key):
+    def delete(self, bucket, key, DW=2):
         Resp = self._do_req("DELETE",
                             self.JKP + urllib.quote_plus(bucket)
-                            + "/" + urllib.quote_plus(key))
+                            + "/" + urllib.quote_plus(key)
+                            + "?dw=" + str(DW))
         if Resp.status == 404:
             return None
         elif Resp.status == 204:
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.