82 return command_strs[command];
90 std::set<uint64_t> &delivered_events,
bool destroy_session) {
92 header.
flags |= CommHeader::FLAGS_BIT_URGENT;
93 CommBuf *cbuf =
new CommBuf(header, 8 + 4 + (8*delivered_events.size()) + 1);
96 for (
auto event_id : delivered_events)
110 header.
flags |= CommHeader::FLAGS_BIT_URGENT;
128 header.
flags |= CommHeader::FLAGS_BIT_URGENT;
130 cbuf = session_data->serialize_notifications_for_keepalive(header, len);
139 header.
flags |= CommHeader::FLAGS_BIT_URGENT;
150 const std::string &name) {
152 header.
flags |= CommHeader::FLAGS_BIT_URGENT;
167 const std::vector<Attribute> &init_attrs) {
170 for (
size_t i = 0; i < init_attrs.size(); i++)
191 for (
size_t i=0; i<init_attrs.size(); i++) {
193 cbuf->
append_vstr(init_attrs[i].value, init_attrs[i].value_len);
202 header.
gid = (uint32_t)((handle ^ (handle >> 32)) & 0x0FFFFFFFFLL);
209 size_t attrs_len = 4;
211 for (
const auto& attr : *init_attrs)
216 header.
gid = filename_to_group(name);
222 for (
const auto& attr : *init_attrs) {
235 header.
gid = filename_to_group(name);
244 uint32_t oflags,
const std::string &attr,
const void *value,
size_t value_len) {
249 if (name && !name->empty()) {
250 header.
gid = filename_to_group(*name);
258 header.
gid = (uint32_t)((handle ^ (handle >> 32)) & 0x0FFFFFFFFLL);
259 cbuf =
new CommBuf(header, 1 + 8 + attr_len);
271 uint32_t oflags,
const std::vector<Attribute> &attrs) {
272 size_t attrs_len = 4;
273 for (
const auto& attr : attrs)
279 if (name && !name->empty()) {
280 header.
gid = filename_to_group(*name);
288 header.
gid = (uint32_t)((handle ^ (handle >> 32)) & 0x0FFFFFFFFLL);
289 cbuf =
new CommBuf(header, 1 + 8 + attrs_len);
294 for (
const auto& attr : attrs) {
303 const std::string *name,
304 const std::string &attr) {
307 if (name && !name->empty()) {
308 header.
gid = filename_to_group(*name);
315 header.
gid = (uint32_t)((handle ^ (handle >> 32)) & 0x0FFFFFFFFLL);
326 const std::string *name,
327 const std::string &attr) {
330 if (name && !name->empty()) {
331 header.
gid = filename_to_group(*name);
338 header.
gid = (uint32_t)((handle ^ (handle >> 32)) & 0x0FFFFFFFFLL);
350 const std::string *name,
351 const std::vector<std::string> &attrs) {
353 for (
const auto &attr : attrs)
358 if (name && !name->empty()) {
359 header.gid = filename_to_group(*name);
366 header.gid = (uint32_t)((handle ^ (handle >> 32)) & 0x0FFFFFFFFLL);
367 cbuf =
new CommBuf(header, 1 + 8 + 4 + len);
372 for (
const auto &attr : attrs)
380 const std::string &name) {
382 header.
gid = (uint32_t)((handle ^ (handle >> 32)) & 0x0FFFFFFFFLL);
391 const std::string &attr) {
394 header.
gid = (uint32_t)((handle ^ (handle >> 32)) & 0x0FFFFFFFFLL);
404 const std::string &attr) {
407 header.
gid = filename_to_group(name);
419 header.
gid = (uint32_t)((handle ^ (handle >> 32)) & 0x0FFFFFFFFLL);
427 header.
gid = (uint32_t)((handle ^ (handle >> 32)) & 0x0FFFFFFFFLL);
434 const std::string *name,
const std::string &attr,
bool include_sub_entries) {
437 if (name && !name->empty()) {
438 header.
gid = filename_to_group(*name);
445 header.
gid = (uint32_t)((handle ^ (handle >> 32)) & 0x0FFFFFFFFLL);
456 const std::string *name,
const std::string &attr) {
459 if (name && !name->empty()) {
460 header.
gid = filename_to_group(*name);
467 header.
gid = (uint32_t)((handle ^ (handle >> 32)) & 0x0FFFFFFFFLL);
478 header.
gid = filename_to_group(name);
489 header.
gid = (uint32_t)((handle ^ (handle >> 32)) & 0x0FFFFFFFFLL);
500 header.
gid = (uint32_t)((handle ^ (handle >> 32)) & 0x0FFFFFFFFLL);
512 header.
flags |= CommHeader::FLAGS_BIT_URGENT;
static CommBuf * create_lock_request(uint64_t handle, uint32_t mode, bool try_lock)
static CommBuf * create_attr_exists_request(uint64_t handle, const std::string &attr)
Creates attr_exists request message.
static CommBuf * create_handshake_request(uint64_t session_id, const std::string &name)
The FailureInducer simulates errors.
static CommBuf * create_server_keepalive_request(uint64_t session_id, int error)
Declarations for Protocol.
std::shared_ptr< SessionData > SessionDataPtr
static CommBuf * create_readdir_request(uint64_t handle)
size_t encoded_length_vstr(size_t len)
Computes the encoded length of vstr (vint64, data, null)
static CommBuf * create_attr_list_request(uint64_t handle)
static CommBuf * create_attr_set_request(uint64_t handle, const std::string *name, uint32_t oflags, const std::string &attr, const void *value, size_t value_len)
void append_vstr(const char *str)
Appends a c-style string to the primary buffer.
static CommBuf * create_readdir_attr_request(uint64_t handle, const std::string *name, const std::string &attr, bool include_sub_entries)
static CommBuf * create_shutdown_request()
static CommBuf * create_close_request(uint64_t handle)
virtual const char * command_text(uint64_t command)=0
Returns the string representation of a command code.
static CommBuf * create_mkdir_request(const std::string &name, bool create_intermediate, const std::vector< Attribute > *init_attrs)
Compatibility Macros for C/C++.
static CommBuf * create_attr_incr_request(uint64_t handle, const std::string *name, const std::string &attr)
void append_i32(uint32_t ival)
Appends a 32-bit integer to the primary buffer.
Functions to serialize/deserialize primitives to/from a memory buffer.
static const char * command_strs[COMMAND_MAX]
static CommBuf * create_delete_request(const std::string &name)
static CommBuf * create_readpath_attr_request(uint64_t handle, const std::string *name, const std::string &attr)
static CommBuf * create_attrs_get_request(uint64_t handle, const std::string *name, const std::vector< std::string > &attrs)
std::shared_ptr< HandleCallback > HandleCallbackPtr
void append_i64(uint64_t lval)
Appends a 64-bit integer to the primary buffer.
static CommBuf * create_attr_get_request(uint64_t handle, const std::string *name, const std::string &attr)
static CommBuf * create_status_request()
static CommBuf * create_client_keepalive_request(uint64_t session_id, std::set< uint64_t > &delivered_events, bool destroy_session=false)
static CommBuf * create_server_redirect_request(const std::string &host)
#define HT_FAILURE_SIGNALLED(_label_)
Message buffer for holding data to be transmitted over a network.
void append_byte(uint8_t bval)
Appends a byte of data to the primary buffer.
static CommBuf * create_release_request(uint64_t handle)
String extensions and helpers: sets, maps, append operators etc.
Error codes, Exception handling, error logging.
static CommBuf * create_exists_request(const std::string &name)
void append_bool(bool bval)
Appends a boolean value to the primary buffer.
static CommBuf * create_attr_del_request(uint64_t handle, const std::string &name)
Creates attr_del request message.
static CommBuf * create_open_request(const std::string &name, uint32_t flags, HandleCallbackPtr &callback, const std::vector< Attribute > &init_attrs)