Motr  M0
client_ut.c File Reference
#include "lib/trace.h"
#include "rpc/rpclib.h"
#include "lib/finject.h"
#include "lib/memory.h"
#include "ut/misc.h"
#include "ut/ut.h"
#include "cas/client.h"
#include "cas/ctg_store.h"
#include "dtm0/dtx.h"
#include "cas/cas.h"
Include dependency graph for client_ut.c:

Go to the source code of this file.

Data Structures

struct  async_wait
 
struct  cl_ctx
 
struct  cas_ver_op
 
struct  put_del_ver_case
 

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CAS
 
#define SERVER_LOG_FILE_NAME   "cas_server.log"
 
#define IFID(x, y)   M0_FID_TINIT('i', (x), (y))
 
#define M0_BUFVEC_SLICE(__bufvec, __idx)
 
#define BEFORE(_what, _when)
 
#define AFTER(_what, _when)
 

Enumerations

enum  { COUNT = 24, COUNT_TREE = 10, COUNT_VAL_BYTES = 4096, COUNT_META_ENTRIES = 3 }
 
enum  idx_operation { IDX_CREATE, IDX_DELETE }
 
enum  { MAX_RPCS_IN_FLIGHT = 10 }
 
enum  named_version { PAST = 2, FUTURE = 3 }
 
enum  named_outcome { TOMBSTONE, PRESERVED, OVERWRITTEN }
 
enum  named_op { NOP, PUT, DEL }
 

Functions

 M0_BASSERT (COUNT % 2==0)
 
static int bufvec_empty_alloc (struct m0_bufvec *bufvec, uint32_t num_segs)
 
static int bufvec_cmp (const struct m0_bufvec *left, const struct m0_bufvec *right)
 
static void value_create (int size, int num, char *buf)
 
static void vals_create (int count, int size, struct m0_bufvec *vals)
 
static void vals_mix_create (int count, int large_size, struct m0_bufvec *vals)
 
static int cas_client_init (struct cl_ctx *cctx, const char *cl_ep_addr, const char *srv_ep_addr, const char *dbname, struct m0_net_xprt *xprt)
 
static void cas_client_fini (struct cl_ctx *cctx)
 
static void casc_ut_init (struct m0_rpc_server_ctx *sctx, struct cl_ctx *cctx)
 
static void casc_ut_fini (struct m0_rpc_server_ctx *sctx, struct cl_ctx *cctx)
 
static bool casc_chan_cb (struct m0_clink *clink)
 
static int ut_idx_crdel_wrp (enum idx_operation op, struct cl_ctx *cctx, const struct m0_fid *ids, uint64_t ids_nr, m0_chan_cb_t cb, struct m0_cas_rec_reply *rep, uint32_t flags)
 
static int ut_idx_create_async (struct cl_ctx *cctx, const struct m0_fid *ids, uint64_t ids_nr, m0_chan_cb_t cb, struct m0_cas_rec_reply *rep)
 
static int ut_idx_create (struct cl_ctx *cctx, const struct m0_fid *ids, uint64_t ids_nr, struct m0_cas_rec_reply *rep)
 
static int ut_lookup_idx (struct cl_ctx *cctx, const struct m0_fid *ids, uint64_t ids_nr, struct m0_cas_rec_reply *rep)
 
static int ut_idx_flagged_delete (struct cl_ctx *cctx, const struct m0_fid *ids, uint64_t ids_nr, struct m0_cas_rec_reply *rep, uint32_t flags)
 
static int ut_idx_delete (struct cl_ctx *cctx, const struct m0_fid *ids, uint64_t ids_nr, struct m0_cas_rec_reply *rep)
 
static int ut_idx_list (struct cl_ctx *cctx, const struct m0_fid *start_fid, uint64_t ids_nr, uint64_t *rep_count, struct m0_cas_ilist_reply *rep)
 
static void ut_dtx_init (struct m0_dtx **out, uint64_t version)
 
static void ut_dtx_fini (struct m0_dtx *dtx)
 
static int ut_rec_common_put (struct cl_ctx *cctx, struct m0_cas_id *index, const struct m0_bufvec *keys, const struct m0_bufvec *values, struct m0_dtx *dtx, struct m0_cas_rec_reply *rep, uint32_t flags)
 
int ut_rec_common_put_seq (struct cl_ctx *cctx, struct m0_cas_id *index, const struct m0_bufvec *keys, const struct m0_bufvec *values, struct m0_dtx *dtx, struct m0_cas_rec_reply *rep, uint32_t flags)
 
static int ut_rec_put (struct cl_ctx *cctx, struct m0_cas_id *index, const struct m0_bufvec *keys, const struct m0_bufvec *values, struct m0_cas_rec_reply *rep, uint32_t flags)
 
static void ut_get_rep_clear (struct m0_cas_get_reply *rep, uint32_t nr)
 
static int ut_rec__get (struct cl_ctx *cctx, struct m0_cas_id *index, const struct m0_bufvec *keys, struct m0_cas_get_reply *rep, uint64_t flags)
 
static int ut_rec_get (struct cl_ctx *cctx, struct m0_cas_id *index, const struct m0_bufvec *keys, struct m0_cas_get_reply *rep)
 
static void ut_next_rep_clear (struct m0_cas_next_reply *rep, uint64_t nr)
 
static int ut_next_rec (struct cl_ctx *cctx, struct m0_cas_id *index, struct m0_bufvec *start_keys, uint32_t *recs_nr, struct m0_cas_next_reply *rep, uint64_t *count, uint32_t flags)
 
static int ut_rec_common_del (struct cl_ctx *cctx, struct m0_cas_id *index, const struct m0_bufvec *keys, struct m0_dtx *dtx, struct m0_cas_rec_reply *rep, uint64_t flags)
 
static int ut_rec_common_del_seq (struct cl_ctx *cctx, struct m0_cas_id *index, const struct m0_bufvec *keys, struct m0_dtx *dtx, struct m0_cas_rec_reply *rep, uint64_t flags)
 
static int ut_rec_del (struct cl_ctx *cctx, struct m0_cas_id *index, const struct m0_bufvec *keys, struct m0_cas_rec_reply *rep, uint64_t flags)
 
static void idx_create (void)
 
static void idx_create_fail (void)
 
static void idx_create_a (void)
 
static void idx_create_n (void)
 
static void idx_delete (void)
 
static void idx_delete_fail (void)
 
static void idx_delete_non_exist (void)
 
static void idx_delete_n (void)
 
static void idx_tree_insert (void)
 
static void idx_tree_delete (void)
 
static void idx_tree_delete_fail (void)
 
static void idx_list (void)
 
static void idx_list_fail (void)
 
static bool next_rep_equals (const struct m0_cas_next_reply *rep, void *key, void *val)
 
static void next_common (struct m0_bufvec *keys, struct m0_bufvec *values, uint32_t flags)
 
static int get_reply2bufvec (struct m0_cas_get_reply *get_rep, m0_bcount_t nr, struct m0_bufvec *out)
 
static bool has_values (struct m0_cas_id *index, const struct m0_bufvec *keys, const struct m0_bufvec *expected_values, uint64_t flags)
 
static bool has_versions (struct m0_cas_id *index, const struct m0_bufvec *keys, uint64_t version, uint64_t flags)
 
static bool has_tombstones (struct m0_cas_id *index, const struct m0_bufvec *keys)
 
static void next_reply_breakdown (struct m0_cas_next_reply *next_rep, m0_bcount_t nr, struct m0_bufvec *out_key, struct m0_bufvec *out_val, struct m0_crv **out_ver)
 
static void next_records_verified (struct m0_cas_id *index, struct m0_bufvec *start_key, uint32_t requested_keys_nr, struct m0_bufvec *expected_keys, struct m0_bufvec *expected_values, struct m0_crv *expected_versions, int flags)
 
static void next_keys_verified (struct m0_cas_id *index, struct m0_bufvec *start_key, uint32_t requested_keys_nr, struct m0_bufvec *expected_keys, int flags)
 
static void ut_rec_common_put_verified (struct m0_cas_id *index, const struct m0_bufvec *keys, const struct m0_bufvec *values, uint64_t version, uint64_t flags)
 
static void ut_rec_common_del_verified (struct m0_cas_id *index, const struct m0_bufvec *keys, uint64_t version, uint64_t flags)
 
static void put_get_verified (struct m0_cas_id *index, struct m0_bufvec *keys, struct m0_bufvec *values, struct m0_bufvec *expected_values, uint64_t version, int put_flags, int get_flags)
 
static void del_get_verified (struct m0_cas_id *index, struct m0_bufvec *keys, uint64_t version, uint64_t del_flags, uint64_t get_flags)
 
static void next_ver (void)
 
static void next_ver_exposed (void)
 
static void next (void)
 
static void next_bulk (void)
 
static void next_fail (void)
 
static void next_multi_common (struct m0_bufvec *keys, struct m0_bufvec *values)
 
static void next_multi (void)
 
static void next_multi_bulk (void)
 
static void put_common_with_ver (struct m0_bufvec *keys, struct m0_bufvec *values, uint64_t version)
 
static void put_common (struct m0_bufvec *keys, struct m0_bufvec *values)
 
static void put_overwrite_ver (void)
 
static void put_ver (void)
 
static void put (void)
 
static void recs_fragm (void)
 
static void recs_fragm_fail (void)
 
static void put_bulk (void)
 
static void put_save_common (uint32_t flags)
 
static void put_create (void)
 
static void put_overwrite (void)
 
static void put_crow (void)
 
static void put_crow_fail (void)
 
static void put_fail_common (struct m0_bufvec *keys, struct m0_bufvec *values)
 
static void put_fail (void)
 
static void put_bulk_fail (void)
 
static void upd (void)
 
static void del_common (struct m0_bufvec *keys, struct m0_bufvec *values, uint64_t version, uint64_t put_flags, uint64_t del_flags, uint64_t get_flags)
 
static void del_ver (void)
 
static void get_ver_exposed (void)
 
static void del (void)
 
static void del_bulk (void)
 
static void del_fail (void)
 
static void del_n (void)
 
static void null_value (void)
 
static void get_common (struct m0_bufvec *keys, struct m0_bufvec *values)
 
static void get (void)
 
static void get_bulk (void)
 
static void get_fail (void)
 
static void recs_count (void)
 
static void reply_too_large (void)
 
static void cas_ver_op_execute (const struct cas_ver_op *cvop, struct m0_cas_id *index)
 
static void put_del_ver_case_execute (const struct put_del_ver_case *c, struct m0_cas_id *index)
 
static void verify_version_properties (struct m0_cas_id *index, const struct m0_bufvec *keys, uint64_t version)
 
static enum named_outcome outcome (const struct put_del_ver_case *c)
 
static void put_del_ver_case_verify (const struct put_del_ver_case *c, struct m0_cas_id *index)
 
static void put_del_ver (void)
 

Variables

const struct m0_tl_descr ndoms_descr
 
static char * cas_startup_cmd []
 
static const char * cdbnames [] = { "cas1" }
 
static const char * cl_ep_addrs [] = { "0@lo:12345:34:2" }
 
static const char * srv_ep_addrs [] = { "0@lo:12345:34:1" }
 
static struct cl_ctx casc_ut_cctx
 
static struct m0_rpc_server_ctx casc_ut_sctx
 
struct m0_ut_suite cas_client_ut
 

Macro Definition Documentation

◆ AFTER

#define AFTER (   _what,
  _when 
)
Value:
.after = { \
.ver = _when, \
.op = _what, \
.keys = &keys, \
.values = &after_values, \
},

◆ BEFORE

#define BEFORE (   _what,
  _when 
)
Value:
.before = { \
.ver = _when, \
.op = _what, \
.keys = &keys, \
.values = &before_values, \
},