From: Hannu Valtonen <me@ormod.com>
To: Colin McCabe <cmccabe@alumni.cmu.edu>
Cc: ceph-devel@vger.kernel.org
Subject: Re: proposed C API for librados
Date: Thu, 24 Feb 2011 08:38:14 +0200 [thread overview]
Message-ID: <4D65FCD6.1070100@ormod.com> (raw)
In-Reply-To: <AANLkTi=qvZjPOHkZbPem0TPjovGiqNo7Arq=q2YqEWDS@mail.gmail.com>
On 2/24/11 8:09 AM, Colin McCabe wrote:
Hi,
If you're having a stab at this, could you please add a librados C api
for listing of pools at the same time. (it's available on the C++ side
but would be great to have on the C side for Python bindings)
> Hi all,
>
> We're trying to finalize the API for librados for the 0.25 release.
> This is the C API we're looking at.
>
> cheers,
> Colin
>
>
> =================================================================
> #ifndef CEPH_LIBRADOS_H
> #define CEPH_LIBRADOS_H
>
> #ifdef __cplusplus
> extern "C" {
> #endif
>
> #include<netinet/in.h>
> #include<linux/types.h>
> #include<string.h>
>
> #ifndef CEPH_OSD_TMAP_SET
> #define CEPH_OSD_TMAP_HDR 'h'
> #define CEPH_OSD_TMAP_SET 's'
> #define CEPH_OSD_TMAP_RM 'r'
> #endif
>
> #define LIBRADOS_VER_MAJOR 0
> #define LIBRADOS_VER_MINOR 25
> #define LIBRADOS_VER_EXTRA 0
>
> #define LIBRADOS_VERSION(maj, min, extra) ((maj<< 16) + (min<< 8) + extra)
>
> #define LIBRADOS_VERSION_CODE LIBRADOS_VERSION(LIBRADOS_VER_MAJOR,
> LIBRADOS_VER_MINOR, LIBRADOS_VER_EXTRA)
>
> #define LIBRADOS_SUPPORTS_WATCH 1
>
> typedef void *rados_t;
> typedef void *rados_pool_t;
> typedef void *rados_list_ctx_t;
> typedef uint64_t rados_snap_t;
>
> struct rados_pool_stat_t {
> uint64_t num_bytes; // in bytes
> uint64_t num_kb; // in KB
> uint64_t num_objects;
> uint64_t num_object_clones;
> uint64_t num_object_copies; // num_objects * num_replicas
> uint64_t num_objects_missing_on_primary;
> uint64_t num_objects_unfound;
> uint64_t num_objects_degraded;
> uint64_t num_rd, num_rd_kb,num_wr, num_wr_kb;
> };
>
> struct rados_statfs_t {
> uint64_t kb, kb_used, kb_avail;
> uint64_t num_objects;
> };
>
>
> void rados_version(int *major, int *minor, int *extra);
>
> /* initialization */
> int rados_create(rados_t *cluster, const char * const id);
>
> /* Connect to the cluster */
> int rados_connect(rados_t cluster);
>
> /* destroy the cluster instance */
> void rados_destroy(rados_t cluster);
>
> /* Config
> *
> * Functions for manipulating the Ceph configuration at runtime.
> * After changing the Ceph configuration, you should call rados_conf_apply to
> * ensure that the changes have been applied.
> */
> int rados_conf_read_file(rados_t cluster, const char *path);
>
> /* Sets a configuration value from a string.
> * Returns 0 on success, error code otherwise. */
> int rados_conf_set(rados_t cluster, const char *option, const char *value);
>
> /* Reopens the log file.
> * You must do this after changing the logging configuration.
> * It is also good practice to call this from your SIGHUP signal
> handler, so that users can send you
> * a SIGHUP to reopen the log.
> */
> void rados_reopen_log(rados_t cluster);
>
> /* Returns a configuration value as a string.
> * If len is positive, that is the maximum number of bytes we'll write into the
> * buffer. If len == -1, we'll call malloc() and set *buf.
> * Returns 0 on success, error code otherwise. Returns ENAMETOOLONG if the
> * buffer is too short. */
> int rados_conf_get(rados_t cluster, const char *option, char *buf, int len);
> int rados_conf_get_alloc(rados_t cluster, const char *option, char **buf);
>
> /* pools */
> int rados_pool_open(rados_t cluster, const char *name, rados_pool_t *pool);
> int rados_pool_close(rados_pool_t pool);
> int rados_pool_lookup(rados_t cluster, const char *name);
>
> int rados_pool_stat(rados_pool_t pool, struct rados_pool_stat_t *stats);
>
> void rados_snap_set_read(rados_pool_t pool, rados_snap_t snap);
> int rados_snap_set_write_context(rados_pool_t pool, rados_snap_t seq,
> rados_snap_t *snaps, int num_snaps);
>
> int rados_pool_create(rados_t cluster, const char *name);
> int rados_pool_create_with_auid(rados_t cluster, const char *name,
> uint64_t auid);
> int rados_pool_create_with_crush_rule(rados_t cluster, const char
> *name, __u8 crush_rule);
> int rados_pool_create_with_all(rados_t cluster, const char *name, uint64_t auid,
> __u8 crush_rule);
> int rados_pool_delete(rados_pool_t pool);
> int rados_pool_set_auid(rados_pool_t pool, uint64_t auid);
>
> /* objects */
> int rados_objects_list_open(rados_pool_t pool, rados_list_ctx_t *ctx);
> int rados_objects_list_next(rados_list_ctx_t ctx, const char **entry);
> void rados_objects_list_close(rados_list_ctx_t ctx);
>
>
> /* snapshots */
> int rados_pool_snap_create(rados_pool_t pool, const char *snapname);
> int rados_pool_snap_remove(rados_pool_t pool, const char *snapname);
> int rados_pool_snap_rollback_object(rados_pool_t pool, const char *oid,
> const char *snapname);
> int rados_pool_selfmanaged_snap_create(rados_pool_t pool, uint64_t *snapid);
> int rados_pool_selfmanaged_snap_remove(rados_pool_t pool, uint64_t snapid);
> int rados_pool_snap_list(rados_pool_t pool, rados_snap_t *snaps, int maxlen);
> int rados_pool_snap_lookup(rados_pool_t pool, const char *name,
> rados_snap_t *id);
> int rados_pool_snap_get_name(rados_pool_t pool, rados_snap_t id, char
> *name, int maxlen);
>
> /* sync io */
> uint64_t rados_get_last_version(rados_pool_t pool);
>
> int rados_write(rados_pool_t pool, const char *oid, off_t off, const
> char *buf, size_t len);
> int rados_write_full(rados_pool_t pool, const char *oid, off_t off,
> const char *buf, size_t len);
> int rados_read(rados_pool_t pool, const char *oid, off_t off, char
> *buf, size_t len);
> int rados_remove(rados_pool_t pool, const char *oid);
> int rados_trunc(rados_pool_t pool, const char *oid, size_t size);
>
> /* attrs */
> int rados_getxattr(rados_pool_t pool, const char *o, const char *name,
> char *buf, size_t len);
> int rados_setxattr(rados_pool_t pool, const char *o, const char *name,
> const char *buf, size_t len);
> int rados_rmxattr(rados_pool_t pool, const char *o, const char *name);
>
> /* misc */
> int rados_stat(rados_pool_t pool, const char *o, uint64_t *psize,
> time_t *pmtime);
> int rados_tmap_update(rados_pool_t pool, const char *o, const char
> *cmdbuf, size_t cmdbuflen);
> int rados_exec(rados_pool_t pool, const char *oid, const char *cls,
> const char *method,
> const char *in_buf, size_t in_len, char *buf, size_t out_len);
>
> /* async io */
> typedef void *rados_completion_t;
> typedef void (*rados_callback_t)(rados_completion_t cb, void *arg);
>
> int rados_aio_create_completion(void *cb_arg, rados_callback_t
> cb_complete, rados_callback_t cb_safe,
> rados_completion_t *pc);
> int rados_aio_wait_for_complete(rados_completion_t c);
> int rados_aio_wait_for_safe(rados_completion_t c);
> int rados_aio_is_complete(rados_completion_t c);
> int rados_aio_is_safe(rados_completion_t c);
> int rados_aio_get_return_value(rados_completion_t c);
> uint64_t rados_aio_get_obj_ver(rados_completion_t c);
> void rados_aio_release(rados_completion_t c);
> int rados_aio_write(rados_pool_t pool, const char *oid,
> off_t off, const char *buf, size_t len,
> rados_completion_t completion);
> int rados_aio_write_full(rados_pool_t pool, const char *oid,
> off_t off, const char *buf, size_t len,
> rados_completion_t completion);
> int rados_aio_read(rados_pool_t pool, const char *oid,
> off_t off, char *buf, size_t len,
> rados_completion_t completion);
>
> /* watch/notify */
> typedef void (*rados_watchcb_t)(uint8_t opcode, uint64_t ver, void *arg);
> int rados_watch(rados_pool_t pool, const char *o, uint64_t ver,
> uint64_t *handle,
> rados_watchcb_t watchcb, void *arg);
> int rados_unwatch(rados_pool_t pool, const char *o, uint64_t handle);
> int rados_notify(rados_pool_t pool, const char *o, uint64_t ver);
>
> #ifdef __cplusplus
> }
> #endif
>
> #endif
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2011-02-24 6:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-24 6:09 proposed C API for librados Colin McCabe
2011-02-24 6:38 ` Hannu Valtonen [this message]
2011-02-24 6:57 ` Colin McCabe
2011-02-24 15:25 ` Sage Weil
2011-02-24 17:56 ` Colin McCabe
2011-02-24 18:43 ` Colin McCabe
2011-02-24 8:06 ` Wido den Hollander
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D65FCD6.1070100@ormod.com \
--to=me@ormod.com \
--cc=ceph-devel@vger.kernel.org \
--cc=cmccabe@alumni.cmu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.