Motr  M0
idx.c File Reference
#include "lib/trace.h"
#include "motr/client.h"
#include "motr/st/st.h"
#include "motr/st/st_misc.h"
#include "motr/st/st_assert.h"
#include "lib/memory.h"
Include dependency graph for idx.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CLIENT
 
#define ST_VAL_STRING   ("Client Index Test.")
 
#define idx_query_exec(idx_id, opcode, keys, vals, rcs, flag, exp)
 
#define idx_query_exp_success(idx_id, opcode, keys, vals, rcs, flag)   idx_query_exec(idx_id, opcode, keys, vals, rcs, flag, ==)
 
#define idx_query_exp_fail(idx_id, opcode, keys, vals, rcs, flag)   idx_query_exec(idx_id, opcode, keys, vals, rcs, flag, !=)
 

Enumerations

enum  {
  ST_MAX_INDEX_NUM = 1, ST_MAX_KEY_LEN = 64, ST_SMALL_KV_PAIR_NUM = 20, ST_MEDIUM_KV_PAIR_NUM = 100,
  ST_LARGE_KV_PAIR_NUM = 1000
}
 

Functions

static int get_max_nr_kv_pairs (int idx_door_no)
 
static void idx_bufvec_free (struct m0_bufvec *bv)
 
static struct m0_bufvecidx_bufvec_alloc (int nr)
 
static bool is_kv_pair_deleted (int idx_door_no, int key_no)
 
static int idx_pick_keys (int idx_door_no, struct m0_bufvec *keys, int *key_no_arr)
 
static int idx_fill_kv_pairs (struct m0_uint128 id, int start, struct m0_bufvec *keys, struct m0_bufvec *vals)
 
static int idx_do_insert_kv_pairs (struct m0_uint128 id, struct m0_bufvec *keys, struct m0_bufvec *vals, int *rcs)
 
static int idx_insert_kv_pairs (struct m0_uint128 id, int nr_kvp)
 
static int idx_create_one (struct m0_uint128 id)
 
static int idx_delete_one (struct m0_uint128 id)
 
static int idx_test_prepare (void)
 
static void idx_query_get (void)
 
static void idx_query_get_cancel (void)
 
static void idx_query_get_nonexist (void)
 
static void idx_query_get_non_existing_index (void)
 
static void idx_query_del (void)
 
static void idx_query_next (void)
 
static void idx_query_next_exclude_start (void)
 
static void mock_op_cb_stable (struct m0_op *op)
 
static void mock_op_cb_failed (struct m0_op *op)
 
static void idx_query_callbacks (void)
 
static void idx_query_empty_next (void)
 
static void idx_query_next_not_exist_index (void)
 
static void idx_query_drop_index (void)
 
static void idx_query_put_not_existent_index (void)
 
static int st_idx_suite_init (void)
 
static int st_idx_suite_fini (void)
 

Variables

static struct m0_container st_idx_container
 
static struct m0_uint128 test_index_ids [ST_MAX_INDEX_NUM]
 
static bool * deleted_kv_pairs
 
struct st_suite st_suite_idx
 

Macro Definition Documentation

◆ idx_query_exec

#define idx_query_exec (   idx_id,
  opcode,
  keys,
  vals,
  rcs,
  flag,
  exp 
)
Value:
do { \
int rc; \
struct m0_idx idx; \
struct m0_op *ops[1] = {NULL}; \
\
/* Launch DEL query. */ \
memset(&idx, 0, sizeof idx); \
ops[0] = NULL; \
st_idx_init(&idx, \
&st_idx_container.co_realm, &idx_id); \
st_idx_op(&idx, opcode, keys, vals, rcs, flag, &ops[0]); \
rc = st_op_wait(ops[0], \
ST_ASSERT_FATAL(rc == 0); \
ST_ASSERT_FATAL( \
ops[0]->op_sm.sm_state == M0_OS_STABLE);\
ST_ASSERT_FATAL(ops[0]->op_rc exp 0); \
\
/* fini and release */ \
st_op_fini(ops[0]); \
st_op_free(ops[0]); \
st_entity_fini(&idx.in_entity); \
} while(0)
void st_idx_init(struct m0_idx *idx, struct m0_realm *parent, const struct m0_uint128 *id)
Definition: api.c:56
Definition: client.h:835
#define NULL
Definition: misc.h:38
const m0_time_t M0_TIME_NEVER
Definition: time.c:108
#define M0_BITS(...)
Definition: misc.h:236
static struct m0_container st_idx_container
Definition: idx.c:43
int opcode
Definition: crate.c:301
struct m0_realm co_realm
Definition: client.h:881
Definition: client.h:641
static bool flag
Definition: nucleus.c:266
void st_op_launch(struct m0_op **op, uint32_t nr)
Definition: api.c:129
struct m0_fom_ops ops
Definition: io_foms.c:623
int32_t st_op_wait(struct m0_op *op, uint64_t bits, m0_time_t to)
Definition: api.c:136
int32_t rc
Definition: trigger_fop.h:47

Definition at line 444 of file idx.c.

◆ idx_query_exp_fail

#define idx_query_exp_fail (   idx_id,
  opcode,
  keys,
  vals,
  rcs,
  flag 
)    idx_query_exec(idx_id, opcode, keys, vals, rcs, flag, !=)

Definition at line 477 of file idx.c.

◆ idx_query_exp_success

#define idx_query_exp_success (   idx_id,
  opcode,
  keys,
  vals,
  rcs,
  flag 
)    idx_query_exec(idx_id, opcode, keys, vals, rcs, flag, ==)

Definition at line 474 of file idx.c.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CLIENT

Definition at line 23 of file idx.c.

◆ ST_VAL_STRING

#define ST_VAL_STRING   ("Client Index Test.")

Definition at line 33 of file idx.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
ST_MAX_INDEX_NUM 
ST_MAX_KEY_LEN 
ST_SMALL_KV_PAIR_NUM 
ST_MEDIUM_KV_PAIR_NUM 
ST_LARGE_KV_PAIR_NUM 

Definition at line 35 of file idx.c.

Function Documentation

◆ get_max_nr_kv_pairs()

static int get_max_nr_kv_pairs ( int  idx_door_no)
static

Definition at line 47 of file idx.c.

Here is the caller graph for this function:

◆ idx_bufvec_alloc()

static struct m0_bufvec* idx_bufvec_alloc ( int  nr)
static

Definition at line 80 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_bufvec_free()

static void idx_bufvec_free ( struct m0_bufvec bv)
static

Definition at line 64 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_create_one()

static int idx_create_one ( struct m0_uint128  id)
static

Definition at line 340 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_delete_one()

static int idx_delete_one ( struct m0_uint128  id)
static

Definition at line 372 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_do_insert_kv_pairs()

static int idx_do_insert_kv_pairs ( struct m0_uint128  id,
struct m0_bufvec keys,
struct m0_bufvec vals,
int *  rcs 
)
static

Definition at line 254 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_fill_kv_pairs()

static int idx_fill_kv_pairs ( struct m0_uint128  id,
int  start,
struct m0_bufvec keys,
struct m0_bufvec vals 
)
static

Definition at line 189 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_insert_kv_pairs()

static int idx_insert_kv_pairs ( struct m0_uint128  id,
int  nr_kvp 
)
static

Definition at line 287 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_pick_keys()

static int idx_pick_keys ( int  idx_door_no,
struct m0_bufvec keys,
int *  key_no_arr 
)
static

Definition at line 112 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_query_callbacks()

static void idx_query_callbacks ( void  )
static

Definition at line 1015 of file idx.c.

Here is the call graph for this function:

◆ idx_query_del()

static void idx_query_del ( void  )
static

Definition at line 815 of file idx.c.

Here is the call graph for this function:

◆ idx_query_drop_index()

static void idx_query_drop_index ( void  )
static

Definition at line 1153 of file idx.c.

Here is the call graph for this function:

◆ idx_query_empty_next()

static void idx_query_empty_next ( void  )
static

Definition at line 1072 of file idx.c.

Here is the call graph for this function:

◆ idx_query_get()

static void idx_query_get ( void  )
static

Definition at line 480 of file idx.c.

Here is the call graph for this function:

◆ idx_query_get_cancel()

static void idx_query_get_cancel ( void  )
static

Cancel launched operation.

Definition at line 549 of file idx.c.

Here is the call graph for this function:

◆ idx_query_get_non_existing_index()

static void idx_query_get_non_existing_index ( void  )
static

Definition at line 747 of file idx.c.

Here is the call graph for this function:

◆ idx_query_get_nonexist()

static void idx_query_get_nonexist ( void  )
static

Definition at line 684 of file idx.c.

Here is the call graph for this function:

◆ idx_query_next()

static void idx_query_next ( void  )
static

Definition at line 865 of file idx.c.

Here is the call graph for this function:

◆ idx_query_next_exclude_start()

static void idx_query_next_exclude_start ( void  )
static

PHASE 1: Fetch nr_kvp KV.



Use last key as the starting point of NEXT Op.


Store the last key for compariosn.

PHASE 2: Fetch next nr_kvp KV.
Result should not contain a stored key.

Definition at line 917 of file idx.c.

Here is the call graph for this function:

◆ idx_query_next_not_exist_index()

static void idx_query_next_not_exist_index ( void  )
static

Definition at line 1116 of file idx.c.

Here is the call graph for this function:

◆ idx_query_put_not_existent_index()

static void idx_query_put_not_existent_index ( void  )
static

Definition at line 1250 of file idx.c.

Here is the call graph for this function:

◆ idx_test_prepare()

static int idx_test_prepare ( void  )
static

Definition at line 404 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_kv_pair_deleted()

static bool is_kv_pair_deleted ( int  idx_door_no,
int  key_no 
)
static

Definition at line 104 of file idx.c.

Here is the caller graph for this function:

◆ mock_op_cb_failed()

static void mock_op_cb_failed ( struct m0_op op)
static

Definition at line 1005 of file idx.c.

Here is the caller graph for this function:

◆ mock_op_cb_stable()

static void mock_op_cb_stable ( struct m0_op op)
static

Definition at line 997 of file idx.c.

Here is the caller graph for this function:

◆ st_idx_suite_fini()

static int st_idx_suite_fini ( void  )
static

Finalises the idx suite's environment.

Definition at line 1317 of file idx.c.

◆ st_idx_suite_init()

static int st_idx_suite_init ( void  )
static

Initialises the index suite's environment.

Definition at line 1289 of file idx.c.

Here is the call graph for this function:

Variable Documentation

◆ deleted_kv_pairs

bool* deleted_kv_pairs
static

Definition at line 45 of file idx.c.

◆ st_idx_container

struct m0_container st_idx_container
static

Definition at line 43 of file idx.c.

◆ st_suite_idx

struct st_suite st_suite_idx

This is the place to add test suites

Definition at line 1322 of file idx.c.

◆ test_index_ids

struct m0_uint128 test_index_ids[ST_MAX_INDEX_NUM]
static

Definition at line 44 of file idx.c.