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

Robin Dong robin.k.dong at gmail.com
Tue Dec 17 08:46:53 CET 2013


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


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

> No need to set up another .h file in sheep/http
>
> Reviewed-by: Robin Dong <sanbai at taobao.com>
> Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> ---
>  sheep/Makefile.am  |    2 +-
>  sheep/http/http.h  |   40 ++++++++++++++++++++++++++++++++++++++
>  sheep/http/kv.c    |    2 +-
>  sheep/http/kv.h    |   55
> ----------------------------------------------------
>  sheep/http/s3.c    |    1 -
>  sheep/http/swift.c |    1 -
>  6 files changed, 42 insertions(+), 59 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 a8527d1..e541d0e 100644
> --- a/sheep/http/http.h
> +++ b/sheep/http/http.h
> @@ -109,6 +109,46 @@ int http_request_writes(struct http_request *req,
> const char *str);
>  __printf(2, 3)
>  int http_request_writef(struct http_request *req, const char *fmt, ...);
>
> +/* For kv.c */
> +
> +#define SD_MAX_BUCKET_NAME 64
> +#define SD_MAX_OBJECT_NAME 1024
> +
> +/* Account operations */
> +int kv_create_account(const char *account);
> +int kv_read_account(const char *account, uint32_t *nr_buckets);
> +int kv_update_account(const char *account);
> +int kv_delete_account(const char *account);
> +int kv_list_accounts(struct http_request *req,
> +                   void (*cb)(struct http_request *req, const char
> *account,
> +                              void *opaque),
> +                   void *opaque);
> +
> +/* Bucket operations */
> +int kv_create_bucket(const char *account, const char *bucket);
> +int kv_read_bucket(const char *account, const char *bucket);
> +int kv_update_bucket(const char *account, const char *bucket);
> +int kv_delete_bucket(const char *account, const char *bucket);
> +int kv_list_buckets(struct http_request *req, const char *account,
> +                   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 *account,
> +                    const char *bucket, const char *object);
> +int kv_read_object(struct http_request *req, const char *account,
> +                  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 *account,
> +                    const char *bucket, const char *object);
> +int kv_list_objects(struct http_request *req, const char *account,
> +                   const char *bucket,
> +                   void (*cb)(struct http_request *req, const char
> *bucket,
> +                              const char *object, void *opaque),
> +                   void *opaque);
> +
>  /* object_allocator.c */
>  int oalloc_new_prepare(uint32_t vid, uint64_t *start, uint64_t count);
>  int oalloc_new_finish(uint32_t vid, uint64_t start, uint64_t count);
> diff --git a/sheep/http/kv.c b/sheep/http/kv.c
> index 8dc4db8..cc95995 100644
> --- a/sheep/http/kv.c
> +++ b/sheep/http/kv.c
> @@ -14,7 +14,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 4ccb716..0000000
> --- a/sheep/http/kv.h
> +++ /dev/null
> @@ -1,55 +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 64
> -#define SD_MAX_OBJECT_NAME 1024
> -
> -/* Account operations */
> -int kv_create_account(const char *account);
> -int kv_read_account(const char *account, uint32_t *nr_buckets);
> -int kv_update_account(const char *account);
> -int kv_delete_account(const char *account);
> -int kv_list_accounts(struct http_request *req,
> -                   void (*cb)(struct http_request *req, const char
> *account,
> -                              void *opaque),
> -                   void *opaque);
> -
> -/* Bucket operations */
> -int kv_create_bucket(const char *account, const char *bucket);
> -int kv_read_bucket(const char *account, const char *bucket);
> -int kv_update_bucket(const char *account, const char *bucket);
> -int kv_delete_bucket(const char *account, const char *bucket);
> -int kv_list_buckets(struct http_request *req, const char *account,
> -                   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 *account,
> -                    const char *bucket, const char *object);
> -int kv_read_object(struct http_request *req, const char *account,
> -                  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 *account,
> -                    const char *bucket, const char *object);
> -int kv_list_objects(struct http_request *req, const char *account,
> -                   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 8dde7f3..6a41308 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 d9f5a76..16ce8fb 100644
> --- a/sheep/http/swift.c
> +++ b/sheep/http/swift.c
> @@ -11,7 +11,6 @@
>
>  #include "strbuf.h"
>  #include "http.h"
> -#include "kv.h"
>
>  #define HTTP_REMOVE_ACCOUNT "HTTP_X_REMOVE_ACCOUNT_META_BOOK"
>
> --
> 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/20131217/a97f39b6/attachment-0004.html>


More information about the sheepdog mailing list