/usr/include/radosstriper/libradosstriper.hpp is in libradosstriper-dev 12.2.4-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | #ifndef __LIBRADOSSTRIPER_HPP
#define __LIBRADOSSTRIPER_HPP
#include <string.h>
#include <string>
#include <map>
#include "../rados/buffer.h"
#include "../rados/librados.hpp"
#include "libradosstriper.h"
namespace libradosstriper
{
struct RadosStriperImpl;
struct MultiAioCompletionImpl;
/*
* Completion object for multiple asynchronous IO
* It allows to internally handle several "requests"
*/
struct MultiAioCompletion {
MultiAioCompletion(MultiAioCompletionImpl *pc_) : pc(pc_) {}
~MultiAioCompletion();
int set_complete_callback(void *cb_arg, librados::callback_t cb);
int set_safe_callback(void *cb_arg, librados::callback_t cb);
void wait_for_complete();
void wait_for_safe();
void wait_for_complete_and_cb();
void wait_for_safe_and_cb();
bool is_complete();
bool is_safe();
bool is_complete_and_cb();
bool is_safe_and_cb();
int get_return_value();
void release();
MultiAioCompletionImpl *pc;
};
/* RadosStriper : This class allows to perform read/writes on striped objects
*
* Typical use (error checking omitted):
*
* RadosStriper rs;
* RadosStriper.striper_create("my_cluster", rs);
* bufferlist bl;
* ... put data in bl ...
* rs.write(object_name, bl, len, offset);
* bufferlist bl2;
* rs.read(object_name, &bl2, len, offset);
* ...
*/
class RadosStriper
{
public:
/*
* constructor
*/
RadosStriper();
/*
* builds the C counter part of a RadosStriper
*/
static void to_rados_striper_t(RadosStriper &striper,
rados_striper_t *s);
/*
* copy constructor
*/
RadosStriper(const RadosStriper& rs);
/*
* operator=
*/
RadosStriper& operator=(const RadosStriper& rs);
/*
* destructor
* Internally calling close() if an object is currently opened
*/
~RadosStriper();
/*
* create method
*/
static int striper_create(librados::IoCtx& ioctx,
RadosStriper *striper);
/*
* set object layout's stripe unit
* This layout will be used when new objects are created (by writing to them)
* Already existing objects will be opened with their own layout.
*/
int set_object_layout_stripe_unit(unsigned int stripe_unit);
/*
* set object layout's stripe count
* This layout will be used when new objects are created (by writing to them)
* Already existing objects will be opened with their own layout.
*/
int set_object_layout_stripe_count(unsigned int stripe_count);
/*
* set object layout's object size
* This layout will be used when new objects are created (by writing to them)
* Already existing objects will be opened with their own layout.
*/
int set_object_layout_object_size(unsigned int object_size);
/**
* Get the value of an extended attribute on a striped object
*/
int getxattr(const std::string& oid, const char *name, ceph::bufferlist& bl);
/**
* Set the value of an extended attribute on a striped object
*/
int setxattr(const std::string& oid, const char *name, ceph::bufferlist& bl);
/**
* Delete an extended attribute from a striped object
*/
int rmxattr(const std::string& oid, const char *name);
/**
* Start iterating over xattrs on a striped object.
*/
int getxattrs(const std::string& oid,
std::map<std::string, ceph::bufferlist>& attrset);
/**
* synchronously write to the striped object at the specified offset.
* NOTE: this call steals the contents of @param bl.
*/
int write(const std::string& soid, const ceph::bufferlist& bl, size_t len, uint64_t off);
/**
* synchronously fill the striped object with the specified data
* NOTE: this call steals the contents of @param bl.
*/
int write_full(const std::string& soid, const ceph::bufferlist& bl);
/**
* synchronously append data to the striped object
* NOTE: this call steals the contents of @p bl.
*/
int append(const std::string& soid, const ceph::bufferlist& bl, size_t len);
/**
* asynchronously write to the striped object at the specified offset.
* NOTE: this call steals the contents of @p bl.
*/
int aio_write(const std::string& soid, librados::AioCompletion *c, const ceph::bufferlist& bl, size_t len, uint64_t off);
/**
* asynchronously fill the striped object with the specified data
* NOTE: this call steals the contents of @p bl.
*/
int aio_write_full(const std::string& soid, librados::AioCompletion *c, const ceph::bufferlist& bl);
/**
* asynchronously append data to the striped object
* NOTE: this call steals the contents of @p bl.
*/
int aio_append(const std::string& soid, librados::AioCompletion *c, const ceph::bufferlist& bl, size_t len);
/**
* synchronously read from the striped object at the specified offset.
*/
int read(const std::string& soid, ceph::bufferlist* pbl, size_t len, uint64_t off);
/**
* asynchronously read from the striped object at the specified offset.
*/
int aio_read(const std::string& soid, librados::AioCompletion *c, ceph::bufferlist *pbl, size_t len, uint64_t off);
/**
* synchronously get striped object stats (size/mtime)
*/
int stat(const std::string& soid, uint64_t *psize, time_t *pmtime);
int stat2(const std::string& soid, uint64_t *psize, struct timespec *pts);
/**
* asynchronously get striped object stats (size/mtime)
*/
int aio_stat(const std::string& soid, librados::AioCompletion *c,
uint64_t *psize, time_t *pmtime);
int aio_stat2(const std::string& soid, librados::AioCompletion *c,
uint64_t *psize, struct timespec *pts);
/**
* deletes a striped object.
* There is no atomicity of the deletion and the striped
* object may be left incomplete if an error is returned (metadata
* all present, but some stripes missing)
* However, there is a atomicity of the metadata deletion and
* the deletion can not happen if any I/O is ongoing (it
* will return EBUSY). Identically, no I/O will be able to start
* during deletion (same EBUSY return code)
*/
int remove(const std::string& soid);
int remove(const std::string& soid, int flags);
/**
* asynchronous remove of striped objects
* See synchronous version for comments on (lack of) atomicity
*/
int aio_remove(const std::string& soid, librados::AioCompletion *c);
int aio_remove(const std::string& soid, librados::AioCompletion *c, int flags);
/**
* Resizes a striped object
* the truncation can not happen if any I/O is ongoing (it
* will return EBUSY). Identically, no I/O will be able to start
* during truncation (same EBUSY return code)
*/
int trunc(const std::string& oid, uint64_t size);
/**
* Wait for all currently pending aio writes to be safe.
*
* @returns 0 on success, negative error code on failure
*/
int aio_flush();
/**
* creation of multi aio completion objects
*/
static MultiAioCompletion *multi_aio_create_completion();
static MultiAioCompletion *multi_aio_create_completion(void *cb_arg,
librados::callback_t cb_complete,
librados::callback_t cb_safe);
private:
RadosStriperImpl *rados_striper_impl;
};
}
#endif
|