<div dir="ltr">Reviewed-by: Robin Dong <<a href="mailto:sanbai@taobao.com">sanbai@taobao.com</a>></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/12/19 Liu Yuan <span dir="ltr"><<a href="mailto:namei.unix@gmail.com" target="_blank">namei.unix@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Both swift and s3 don't have API to update the existing object, it purely<br>
overwrite the whole objects. So no need to maintain this unused code.<br>
<br>
Signed-off-by: Liu Yuan <<a href="mailto:namei.unix@gmail.com">namei.unix@gmail.com</a>><br>
---<br>
 sheep/http/http.h |    2 --<br>
 sheep/http/kv.c   |   84 -----------------------------------------------------<br>
 2 files changed, 86 deletions(-)<br>
<br>
diff --git a/sheep/http/http.h b/sheep/http/http.h<br>
index e541d0e..a2f404c 100644<br>
--- a/sheep/http/http.h<br>
+++ b/sheep/http/http.h<br>
@@ -139,8 +139,6 @@ int kv_create_object(struct http_request *req, const char *account,<br>
                     const char *bucket, const char *object);<br>
 int kv_read_object(struct http_request *req, const char *account,<br>
                   const char *bucket, const char *object);<br>
-int kv_update_object(struct http_request *req, const char *bucket,<br>
-                    const char *object);<br>
 int kv_delete_object(struct http_request *req, const char *account,<br>
                     const char *bucket, const char *object);<br>
 int kv_list_objects(struct http_request *req, const char *account,<br>
diff --git a/sheep/http/kv.c b/sheep/http/kv.c<br>
index d94608a..7a826f7 100644<br>
--- a/sheep/http/kv.c<br>
+++ b/sheep/http/kv.c<br>
@@ -1239,90 +1239,6 @@ out:<br>
        return ret;<br>
 }<br>
<br>
-static int do_kv_update_object(struct http_request *req, const char *obj_name,<br>
-                              struct kv_onode *obj, uint32_t vid,<br>
-                              uint32_t idx, size_t size)<br>
-{<br>
-       uint64_t oid = vid_to_data_oid(vid, idx);<br>
-       int ret;<br>
-<br>
-       ret = sd_read_object(oid, (char *)&obj->hdr, sizeof(obj->hdr), 0);<br>
-       switch (ret) {<br>
-       case SD_RES_SUCCESS:<br>
-               break;<br>
-       case SD_RES_NO_VDI:<br>
-               sd_info("object %s doesn't exist", obj_name);<br>
-               http_response_header(req, NOT_FOUND);<br>
-               return -1;<br>
-       default:<br>
-               sd_err("failed to read %s, %s", req->uri, sd_strerror(ret));<br>
-               http_response_header(req, INTERNAL_SERVER_ERROR);<br>
-               return -1;<br>
-       }<br>
-<br>
-       if (strcmp(obj-><a href="http://hdr.name" target="_blank">hdr.name</a>, obj_name) == 0) {<br>
-               struct timeval tv;<br>
-<br>
-               gettimeofday(&tv, NULL);<br>
-               obj->hdr.mtime = (uint64_t) tv.tv_sec << 32 | tv.tv_usec * 1000;<br>
-               obj->hdr.size = size;<br>
-<br>
-               ret = sd_write_object(oid, (char *)obj,<br>
-                                     sizeof(obj->hdr) + obj->hdr.size,<br>
-                                     0, false);<br>
-               if (ret == SD_RES_SUCCESS)<br>
-                       http_response_header(req, ACCEPTED);<br>
-               else {<br>
-                       sd_err("failed to update object, %" PRIx64, oid);<br>
-                       http_response_header(req, INTERNAL_SERVER_ERROR);<br>
-                       return -1;<br>
-               }<br>
-       }<br>
-<br>
-       return 0;<br>
-}<br>
-<br>
-int kv_update_object(struct http_request *req, const char *bucket,<br>
-                    const char *object)<br>
-{<br>
-       struct kv_onode *obj;<br>
-       int ret;<br>
-       uint64_t hval;<br>
-       uint32_t vid;<br>
-       ssize_t size;<br>
-<br>
-       ret = lookup_bucket(req, bucket, &vid);<br>
-       if (ret < 0)<br>
-               return ret;<br>
-<br>
-       obj = xzalloc(sizeof(*obj));<br>
-<br>
-       /* TODO: support multi parted object for large object */<br>
-       size = http_request_read(req, obj->data, sizeof(obj->data));<br>
-       if (size < 0) {<br>
-               sd_err("%s: bucket %s, object %s", sd_strerror(ret),<br>
-                      bucket, object);<br>
-               http_response_header(req, INTERNAL_SERVER_ERROR);<br>
-               return -1;<br>
-       }<br>
-<br>
-       hval = sd_hash(object, strlen(object));<br>
-       for (int i = 0; i < MAX_DATA_OBJS; i++) {<br>
-               uint32_t idx = (hval + i) % MAX_DATA_OBJS;<br>
-<br>
-               do_kv_update_object(req, object, obj, vid, idx, size);<br>
-               if (req->status != UNKNOWN) {<br>
-                       free(obj);<br>
-                       return 0;<br>
-               }<br>
-       }<br>
-<br>
-       free(obj);<br>
-<br>
-       http_response_header(req, NOT_FOUND);<br>
-       return -1;<br>
-}<br>
-<br>
 static int do_kv_delete_object(struct http_request *req, const char *obj_name,<br>
                               uint32_t vid, uint32_t idx)<br>
 {<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.9.5<br>
<br>
--<br>
sheepdog mailing list<br>
<a href="mailto:sheepdog@lists.wpkg.org">sheepdog@lists.wpkg.org</a><br>
<a href="http://lists.wpkg.org/mailman/listinfo/sheepdog" target="_blank">http://lists.wpkg.org/mailman/listinfo/sheepdog</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>--<br>Best Regard<br>Robin Dong
</div>