Skip to content
Snippets Groups Projects
Commit 23bf2b2b authored by Dmitry Simonenko's avatar Dmitry Simonenko
Browse files

connector/c: removed old headers

parent f375127e
No related merge requests found
#ifndef TNT_PROTO_H_INCLUDED
#define TNT_PROTO_H_INCLUDED
/*
* Copyright (C) 2011 Mail.RU
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#define TNT_PROTO_TYPE_INSERT 13
#define TNT_PROTO_TYPE_SELECT 17
#define TNT_PROTO_TYPE_UPDATE 19
#define TNT_PROTO_TYPE_DELETE 20
#define TNT_PROTO_TYPE_PING 65280
struct tnt_proto_header {
uint32_t type;
uint32_t len;
uint32_t reqid;
};
#define TNT_PROTO_IS_OK(V) ((V) == 0x0)
struct tnt_proto_header_resp {
struct tnt_proto_header hdr;
uint32_t code;
};
struct tnt_proto_tuple {
uint32_t card;
unsigned char field[];
};
#define TNT_PROTO_FLAG_RETURN 0x01
#define TNT_PROTO_FLAG_ADD 0x02
#define TNT_PROTO_FLAG_REPLACE 0x04
#define TNT_PROTO_FLAG_BOX_QUIET 0x08
#define TNT_PROTO_FLAG_NOT_STORE 0x10
struct tnt_proto_insert {
uint32_t ns;
uint32_t flags;
/* tuple data */
};
#define TNT_PROTO_UPDATE_ASSIGN 0
#define TNT_PROTO_UPDATE_ADD 1
#define TNT_PROTO_UPDATE_AND 2
#define TNT_PROTO_UPDATE_XOR 3
#define TNT_PROTO_UPDATE_OR 4
#define TNT_PROTO_UPDATE_SPLICE 5
#define TNT_PROTO_UPDATE_DELETE_FIELD 6
struct tnt_proto_update {
uint32_t ns;
uint32_t flags;
/* tuple data */
/* count */
/* operation */
};
struct tnt_proto_update_op {
uint32_t field;
unsigned char op;
/* op_arg */
};
struct tnt_proto_delete {
uint32_t ns;
/* tuple data */
};
struct tnt_proto_select {
uint32_t ns;
uint32_t index;
uint32_t offset;
uint32_t limit;
/* tuple data */
};
#endif /* TNT_PROTO_H_INCLUDED */
#ifndef TNT_UPDATE_H_INCLUDED
#define TNT_UPDATE_H_INCLUDED
/*
* Copyright (C) 2011 Mail.RU
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/**
* @defgroup Update
* @ingroup Operations
* @brief Update operation
*/
enum tnt_update_type {
TNT_UPDATE_NONE,
TNT_UPDATE_ASSIGN,
TNT_UPDATE_ADD,
TNT_UPDATE_AND,
TNT_UPDATE_XOR,
TNT_UPDATE_OR,
TNT_UPDATE_SPLICE,
TNT_UPDATE_DELETE_FIELD
};
/** @} */
struct tnt_update_op {
uint8_t op;
uint32_t field;
char *data;
uint32_t size;
uint32_t size_leb;
STAILQ_ENTRY(tnt_update_op) next;
};
struct tnt_update {
uint32_t count;
uint32_t size_enc;
STAILQ_HEAD(,tnt_update_op) list;
};
/**
* @defgroup Handler
* @ingroup Update
* @brief Update handler initizalization and operations
*
* @{
*/
void tnt_update_init(struct tnt_update *update);
void tnt_update_free(struct tnt_update *update);
enum tnt_error
tnt_update_assign(struct tnt_update *update, int field,
char *value, int value_size);
enum tnt_error
tnt_update_arith(struct tnt_update *update, int field,
enum tnt_update_type op, int value);
enum tnt_error
tnt_update_splice(struct tnt_update *update, int field,
int offset, int length, char *list, int list_size);
enum tnt_error
tnt_update_delete_field(struct tnt_update *update, int field);
/** @} */
/**
* @defgroup Operation
* @ingroup Update
* @brief Update operation
*
* @{
*/
/**
* Update operation with tuple.
*
* If bufferization is in use, then request would be placed in
* internal buffer for later sending. Otherwise, operation
* would be processed immediately.
*
* @param t handler pointer
* @param reqid user supplied integer value
* @param ns namespace number
* @param flags update operation flags
* @param key tuple object pointer
* @param update update handler
* @returns 0 on success, -1 on error
*/
int tnt_update_tuple(struct tnt *t, int reqid, int ns, int flags,
struct tnt_tuple *key, struct tnt_update *update);
/**
* Update operation.
*
* If bufferization is in use, then request would be placed in
* internal buffer for later sending. Otherwise, operation
* would be processed immediately.
*
* @param t handler pointer
* @param reqid user supplied integer value
* @param ns namespace number
* @param flags update operation flags
* @param key key data
* @param key key data size
* @param update update handler
* @returns 0 on success, -1 on error
*/
int tnt_update(struct tnt *t, int reqid, int ns, int flags,
char *key, int key_size, struct tnt_update *update);
/** @} */
#endif /* TNT_UPDATE_H_INCLUDED */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment