librgw: RGWFileHandle and RGWLibFS

Experimentally reframe the C interface objects as subobjects in
private internal types.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
This commit is contained in:
Matt Benjamin 2015-10-05 14:58:09 -04:00
parent f9382815a3
commit 290e78812f
2 changed files with 44 additions and 4 deletions

View File

@ -24,20 +24,35 @@
extern "C" {
#endif
/*
* object types
*/
enum rgw_fh_type {
RGW_FS_TYPE_FILE = 0,
RGW_FS_TYPE_DIRECTORY,
};
/*
* dynamic allocated handle to support nfs handle
* Currently we support only one instance of librgw.
* In order to support several instance we will need to include an
* instance id (16bit)
*/
struct rgw_file_handle
{
uint64_t handle;
uint64_t handle; // XXX deprecating
void *fh_private; /* librgw private data */
/* opaque content-addressable name */
struct {
void *data;
uint16_t len;
} fh_name;
/* object type */
enum rgw_fh_type fh_type;
};
struct rgw_fs
{
librgw_t rgw;
void *fs_private;
struct rgw_file_handle root_fh;
char *user_id;
char *access_key_id;

View File

@ -8,6 +8,31 @@
/* internal header */
class RGWFileHandle
{
struct rgw_file_handle fh;
public:
RGWFileHandle() {
fh.fh_private = this;
}
struct rgw_file_handle* get_fh() { return &fh; }
}; /* RGWFileHandle */
class RGWLibFS
{
struct rgw_fs fs;
// XXX auth caching
public:
RGWLibFS() {
fs.fs_private = this;
}
struct rgw_fs* get_fs() { return &fs; }
}; /* RGWLibFS */
/*
read directory content (buckets)
*/