[sheepdog] [PATCH v2] http: merge kv.h into http.h

Robin Dong robin.k.dong at gmail.com
Fri Dec 6 08:53:00 CET 2013


Reviewed-by: Robin Dong <sanbai at taobao.com>


2013/12/6 Liu Yuan <namei.unix at gmail.com>

> No need to set up another .h file in sheep/http
>
> Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> ---
>  sheep/Makefile.am  |    2 +-
>  sheep/http/http.h  |   28 ++++++++++++++++++++++++++++
>  sheep/http/kv.c    |    2 +-
>  sheep/http/kv.h    |   44 --------------------------------------------
>  sheep/http/s3.c    |    1 -
>  sheep/http/swift.c |    1 -
>  6 files changed, 30 insertions(+), 48 deletions(-)
>  delete mode 100644 sheep/http/kv.h
>
> diff --git a/sheep/Makefile.am b/sheep/Makefile.am
> index af1087f..3cfec53 100644
> --- a/sheep/Makefile.am
> +++ b/sheep/Makefile.am
> @@ -52,7 +52,7 @@ sheep_LDADD           = ../lib/libsheepdog.a -lpthread
> -lm\
>  sheep_DEPENDENCIES     = ../lib/libsheepdog.a
>
>
> -noinst_HEADERS         = sheep_priv.h cluster.h http/http.h http/kv.h
> trace/trace.h
> +noinst_HEADERS         = sheep_priv.h cluster.h http/http.h trace/trace.h
>
>  EXTRA_DIST             =
>
> diff --git a/sheep/http/http.h b/sheep/http/http.h
> index 046d412..5849b7d 100644
> --- a/sheep/http/http.h
> +++ b/sheep/http/http.h
> @@ -114,4 +114,32 @@ int oalloc_new_finish(uint32_t vid, uint64_t start,
> uint64_t count);
>  int oalloc_free(uint32_t vid, uint64_t start, uint64_t count);
>  int oalloc_init(uint32_t vid);
>
> +/* for kv.c */
> +#define SD_MAX_BUCKET_NAME 1024
> +#define SD_MAX_OBJECT_NAME 1024
> +
> +/* Bucket operations */
> +int kv_create_bucket(struct http_request *req, const char *bucket);
> +int kv_read_bucket(struct http_request *req, const char *bucket);
> +int kv_update_bucket(struct http_request *req, const char *bucket);
> +int kv_delete_bucket(struct http_request *req, const char *bucket);
> +int kv_list_buckets(struct http_request *req,
> +                   void (*cb)(struct http_request *req, const char
> *bucket,
> +                              void *opaque),
> +                   void *opaque);
> +
> +/* Object operations */
> +int kv_create_object(struct http_request *req, const char *bucket,
> +                    const char *object);
> +int kv_read_object(struct http_request *req, const char *bucket,
> +                  const char *object);
> +int kv_update_object(struct http_request *req, const char *bucket,
> +                    const char *object);
> +int kv_delete_object(struct http_request *req, const char *bucket,
> +                    const char *object);
> +int kv_list_objects(struct http_request *req, const char *bucket,
> +                   void (*cb)(struct http_request *req, const char
> *bucket,
> +                              const char *object, void *opaque),
> +                   void *opaque);
> +
>  #endif /* __SHEEP_HTTP_H__ */
> diff --git a/sheep/http/kv.c b/sheep/http/kv.c
> index 8113389..9281c6d 100644
> --- a/sheep/http/kv.c
> +++ b/sheep/http/kv.c
> @@ -12,7 +12,7 @@
>  /* This file implements backend kv functions for object storage. */
>
>  #include "sheep_priv.h"
> -#include "kv.h"
> +#include "http.h"
>
>  #define FOR_EACH_VDI(nr, vdis) FOR_EACH_BIT(nr, vdis, SD_NR_VDIS)
>
> diff --git a/sheep/http/kv.h b/sheep/http/kv.h
> deleted file mode 100644
> index f0b09fe..0000000
> --- a/sheep/http/kv.h
> +++ /dev/null
> @@ -1,44 +0,0 @@
> -/*
> - * Copyright (C) 2013 MORITA Kazutaka <morita.kazutaka at gmail.com>
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License version
> - * 2 as published by the Free Software Foundation.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program. If not, see <http://www.gnu.org/licenses/>.
> - */
> -
> -#ifndef __SD_KV_H__
> -#define __SD_KV_H__
> -
> -#include "http.h"
> -
> -#define SD_MAX_BUCKET_NAME 1024
> -#define SD_MAX_OBJECT_NAME 1024
> -
> -/* Bucket operations */
> -int kv_create_bucket(struct http_request *req, const char *bucket);
> -int kv_read_bucket(struct http_request *req, const char *bucket);
> -int kv_update_bucket(struct http_request *req, const char *bucket);
> -int kv_delete_bucket(struct http_request *req, const char *bucket);
> -int kv_list_buckets(struct http_request *req,
> -                   void (*cb)(struct http_request *req, const char
> *bucket,
> -                              void *opaque),
> -                   void *opaque);
> -
> -/* Object operations */
> -int kv_create_object(struct http_request *req, const char *bucket,
> -                    const char *object);
> -int kv_read_object(struct http_request *req, const char *bucket,
> -                  const char *object);
> -int kv_update_object(struct http_request *req, const char *bucket,
> -                    const char *object);
> -int kv_delete_object(struct http_request *req, const char *bucket,
> -                    const char *object);
> -int kv_list_objects(struct http_request *req, const char *bucket,
> -                   void (*cb)(struct http_request *req, const char
> *bucket,
> -                              const char *object, void *opaque),
> -                   void *opaque);
> -
> -#endif /* __SD_KV_H__ */
> diff --git a/sheep/http/s3.c b/sheep/http/s3.c
> index ca2efe3..3d8914b 100644
> --- a/sheep/http/s3.c
> +++ b/sheep/http/s3.c
> @@ -10,7 +10,6 @@
>   */
>
>  #include "http.h"
> -#include "kv.h"
>
>  #define MAX_BUCKET_LISTING 1000
>
> diff --git a/sheep/http/swift.c b/sheep/http/swift.c
> index 7b3354a..6e122e2 100644
> --- a/sheep/http/swift.c
> +++ b/sheep/http/swift.c
> @@ -10,7 +10,6 @@
>   */
>
>  #include "http.h"
> -#include "kv.h"
>
>  static void make_bucket_path(char *bucket, size_t size, const char
> *account,
>                              const char *container)
> --
> 1.7.9.5
>
> --
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog
>



-- 
--
Best Regard
Robin Dong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/sheepdog/attachments/20131206/c927bd96/attachment-0004.html>


More information about the sheepdog mailing list