Motr  M0
Cas-client

Data Structures

struct  creq_niter
 
struct  m0_cas_req
 
struct  m0_cas_rec_reply
 
struct  m0_cas_ilist_reply
 
struct  m0_cas_get_reply
 
struct  m0_cas_next_reply
 

Macros

#define CASREQ_FOP_DATA(fop)   ((struct m0_cas_op *)m0_fop_data(fop))
 

Enumerations

enum  m0_cas_req_state {
  CASREQ_INVALID, CASREQ_INIT, CASREQ_SENT, CASREQ_FRAGM_SENT,
  CASREQ_ASSEMBLY, CASREQ_FINAL, CASREQ_FAILURE, CASREQ_NR
}
 

Functions

static void cas_req_replied_cb (struct m0_rpc_item *item)
 
static void creq_asmbl_replied_cb (struct m0_rpc_item *item)
 
static int cas_req_fragmentation (struct m0_cas_req *req)
 
static int cas_req_fragment_continue (struct m0_cas_req *req, struct m0_cas_op *op)
 
static void creq_recv_fini (struct m0_cas_recv *recv, bool op_is_meta)
 
static void cas_to_rpc_map (const struct m0_cas_req *creq, const struct m0_rpc_item *item)
 
static bool fid_is_meta (struct m0_fid *fid)
 
static int creq_op_alloc (uint64_t recs_nr, struct m0_cas_op **out)
 
static void creq_op_free (struct m0_cas_op *op)
 
M0_INTERNAL void m0_cas_req_init (struct m0_cas_req *req, struct m0_rpc_session *sess, struct m0_sm_group *grp)
 
static struct m0_rpc_conncreq_rpc_conn (const struct m0_cas_req *req)
 
static struct m0_rpc_machinecreq_rpc_mach (const struct m0_cas_req *req)
 
static struct m0_sm_groupcas_req_smgrp (const struct m0_cas_req *req)
 
M0_INTERNAL void m0_cas_req_lock (struct m0_cas_req *req)
 
M0_INTERNAL void m0_cas_req_unlock (struct m0_cas_req *req)
 
M0_INTERNAL bool m0_cas_req_is_locked (const struct m0_cas_req *req)
 
static void cas_req_state_set (struct m0_cas_req *req, enum m0_cas_req_state state)
 
static void cas_req_reply_fini (struct m0_cas_req *req)
 
static void cas_req_fini (struct m0_cas_req *req)
 
M0_INTERNAL void m0_cas_req_fini (struct m0_cas_req *req)
 
M0_INTERNAL void m0_cas_req_fini_lock (struct m0_cas_req *req)
 
static void creq_kv_hold_down (struct m0_cas_rec *rec)
 
static void creq_fop_destroy (struct m0_cas_req *req)
 
static void creq_fop_release (struct m0_ref *ref)
 
static void creq_asmbl_fop_release (struct m0_ref *ref)
 
static int creq_fop_create (struct m0_cas_req *req, struct m0_fop_type *ftype, struct m0_cas_op *op)
 
static int creq_fop_create_and_prepare (struct m0_cas_req *req, struct m0_fop_type *ftype, struct m0_cas_op *op, enum m0_cas_req_state *next_state)
 
static struct m0_cas_reqitem_to_cas_req (struct m0_rpc_item *item)
 
static struct m0_rpc_itemcas_req_to_item (const struct m0_cas_req *req)
 
static struct m0_cas_repcas_rep (struct m0_rpc_item *reply)
 
M0_INTERNAL int m0_cas_req_generic_rc (const struct m0_cas_req *req)
 
static bool cas_rep_val_is_valid (struct m0_rpc_at_buf *val, struct m0_fid *idx_fid)
 
static int cas_rep__validate (const struct m0_fop_type *ftype, struct m0_cas_op *op, struct m0_cas_rep *rep)
 
static int cas_rep_validate (const struct m0_cas_req *req)
 
static void cas_req_failure (struct m0_cas_req *req, int32_t rc)
 
static void cas_req_failure_ast (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static void cas_req_failure_ast_post (struct m0_cas_req *req, int32_t rc)
 
static void creq_item_prepare (const struct m0_cas_req *req, struct m0_rpc_item *item, const struct m0_rpc_item_ops *ops)
 
static void cas_fop_send (struct m0_cas_req *req)
 
static int creq_kv_buf_add (const struct m0_cas_req *req, const struct m0_bufvec *kv, uint32_t idx, struct m0_rpc_at_buf *buf)
 
static void creq_asmbl_fop_init (struct m0_cas_req *req, struct m0_fop_type *ftype, struct m0_cas_op *op)
 
static int greq_asmbl_add (struct m0_cas_req *req, struct m0_cas_rec *rec, uint64_t idx, uint64_t orig_idx, uint64_t vlen)
 
static uint64_t greq_asmbl_count (const struct m0_cas_req *req)
 
static int greq_asmbl_fill (struct m0_cas_req *req, struct m0_cas_op *op)
 
static bool greq_asmbl_post (struct m0_cas_req *req)
 
static bool creq_niter_invariant (struct creq_niter *it)
 
static void creq_niter_init (struct creq_niter *it, struct m0_cas_op *op, struct m0_cas_rep *rep)
 
static int creq_niter_next (struct creq_niter *it)
 
static void creq_niter_fini (struct creq_niter *it)
 
static int nreq_asmbl_prep (struct m0_cas_req *req, struct m0_cas_op *op)
 
static int nreq_asmbl_fill (struct m0_cas_req *req, struct m0_cas_op *op)
 
static bool nreq_asmbl_post (struct m0_cas_req *req)
 
static void creq_rep_override (struct m0_cas_rec *orig, struct m0_cas_rec *new)
 
static void nreq_asmbl_accept (struct m0_cas_req *req)
 
static void greq_asmbl_accept (struct m0_cas_req *req)
 
static void cas_req_fsync_remid_copy (struct m0_cas_req *req)
 
static int cas_req_reply_handle (struct m0_cas_req *req, bool *fragm_continue)
 
static void creq_asmbl_replied_ast (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static void cas_req_replied_ast (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static int cas_index_op_prepare (const struct m0_cas_req *req, const struct m0_cas_id *cids, uint64_t cids_nr, bool recv_val, uint32_t flags, struct m0_cas_op **out)
 
static void addb2_add_cas_req_attrs (const struct m0_cas_req *req)
 
static int cas_index_req_prepare (struct m0_cas_req *req, const struct m0_cas_id *cids, uint64_t cids_nr, uint64_t max_replies_nr, bool recv_val, uint32_t flags, struct m0_cas_op **op)
 
M0_INTERNAL uint64_t m0_cas_req_nr (const struct m0_cas_req *req)
 
M0_INTERNAL int m0_cas_req_wait (struct m0_cas_req *req, uint64_t states, m0_time_t to)
 
M0_INTERNAL int m0_cas_index_create (struct m0_cas_req *req, const struct m0_cas_id *cids, uint64_t cids_nr, struct m0_dtx *dtx)
 
static void cas_rep_copy (const struct m0_cas_req *req, uint64_t idx, struct m0_cas_rec_reply *rep)
 
M0_INTERNAL void m0_cas_index_create_rep (const struct m0_cas_req *req, uint64_t idx, struct m0_cas_rec_reply *rep)
 
M0_INTERNAL int m0_cas_index_delete (struct m0_cas_req *req, const struct m0_cas_id *cids, uint64_t cids_nr, struct m0_dtx *dtx, uint32_t flags)
 
M0_INTERNAL void m0_cas_index_delete_rep (const struct m0_cas_req *req, uint64_t idx, struct m0_cas_rec_reply *rep)
 
M0_INTERNAL int m0_cas_index_lookup (struct m0_cas_req *req, const struct m0_cas_id *cids, uint64_t cids_nr)
 
M0_INTERNAL void m0_cas_index_lookup_rep (const struct m0_cas_req *req, uint64_t idx, struct m0_cas_rec_reply *rep)
 
M0_INTERNAL int m0_cas_index_list (struct m0_cas_req *req, const struct m0_fid *start_fid, uint32_t indices_nr, uint32_t flags)
 
static int cas_next_rc (int64_t service_rc)
 
M0_INTERNAL void m0_cas_index_list_rep (struct m0_cas_req *req, uint32_t idx, struct m0_cas_ilist_reply *rep)
 
static int cas_records_op_prepare (const struct m0_cas_req *req, const struct m0_cas_id *index, const struct m0_bufvec *keys, const struct m0_bufvec *values, uint32_t flags, struct m0_cas_op **out)
 
static int cas_req_prep (struct m0_cas_req *req, const struct m0_cas_id *index, const struct m0_bufvec *keys, const struct m0_bufvec *values, uint64_t max_replies_nr, uint32_t flags, struct m0_cas_op **op)
 
M0_INTERNAL int m0_cas_put (struct m0_cas_req *req, struct m0_cas_id *index, const struct m0_bufvec *keys, const struct m0_bufvec *values, struct m0_dtx *dtx, uint32_t flags)
 
M0_INTERNAL void m0_cas_put_rep (struct m0_cas_req *req, uint64_t idx, struct m0_cas_rec_reply *rep)
 
static int m0_cas__get (struct m0_cas_req *req, struct m0_cas_id *index, const struct m0_bufvec *keys, int flags)
 
M0_INTERNAL int m0_cas_get (struct m0_cas_req *req, struct m0_cas_id *index, const struct m0_bufvec *keys)
 
M0_INTERNAL int m0_cas_versioned_get (struct m0_cas_req *req, struct m0_cas_id *index, const struct m0_bufvec *keys)
 
M0_INTERNAL void m0_cas_get_rep (const struct m0_cas_req *req, uint64_t idx, struct m0_cas_get_reply *rep)
 
M0_INTERNAL int m0_cas_next (struct m0_cas_req *req, struct m0_cas_id *index, struct m0_bufvec *start_keys, uint32_t *recs_nr, uint32_t flags)
 
M0_INTERNAL void m0_cas_rep_mlock (const struct m0_cas_req *req, uint64_t idx)
 
M0_INTERNAL void m0_cas_next_rep (const struct m0_cas_req *req, uint32_t idx, struct m0_cas_next_reply *rep)
 
M0_INTERNAL int m0_cas_del (struct m0_cas_req *req, struct m0_cas_id *index, struct m0_bufvec *keys, struct m0_dtx *dtx, uint32_t flags)
 
M0_INTERNAL void m0_cas_del_rep (struct m0_cas_req *req, uint64_t idx, struct m0_cas_rec_reply *rep)
 
M0_INTERNAL int m0_cas_sm_conf_init (void)
 
M0_INTERNAL void m0_cas_sm_conf_fini (void)
 

Variables

static const struct m0_rpc_item_ops cas_item_ops
 
static const struct m0_rpc_item_ops asmbl_item_ops
 
static struct m0_sm_state_descr cas_req_states []
 
static struct m0_sm_trans_descr cas_req_trans []
 
struct m0_sm_conf cas_req_sm_conf
 

Detailed Description

CAS client provides an interface to make queries to CAS service. It's a thin layer that hides network communication details with CAS service. CAS client doesn't provide distribution of requests over remote CAS services, user explicitly specify destination of every request.

Request to CAS service instance is represented by m0_cas_req structure. General workflow with the request is:

Available requests:

If one of the functions above returns non-zero return code, then further request processing is impossible and the request should be finalised using m0_cas_req_fini(). All requests are vectorised. CAS client doesn't copy values of vector items for index records, so they should be accessible until the request is processed. It is not needed for requests made for operations over indices.

For every request there is corresponding function to obtain the result of request execution (m0_cas_*_rep() family). After the request is processed, return code can be obtained for operation against every input vector's item. If m0_cas_req_generic_rc() returns 0 for the request, then number and order of items obtained via m0_cas_*_rep() is guaranteed to be the same as in original request. The exceptions are m0_cas_index_list_rep() and m0_cas_next_rep() functions, which can return less records than requested.

Indices are uniquely identified by their FIDs, which are m0_fid values with m0_cas_index_fid_type as a FID type. Note, that FID (0,0) is reserved by implementation and shouldn't be used in requests (see m0_cas_meta_fid).

In order to meet atomicity and durability requirements, modification requests should be executed as part of a distributed transaction.

Request has associated state machine executed in a state machine group provided during initialisation. All requests should be invoked with state machine group mutex held. There are helpers to lock/unlock this state machine group (m0_cas_lock(), m0_cas_unlock()). All request state transitions are done in the context of this state machine group.

There is no restriction on the size of keys and values.

See also
m0_chan, m0_dtx

Macro Definition Documentation

◆ CASREQ_FOP_DATA

#define CASREQ_FOP_DATA (   fop)    ((struct m0_cas_op *)m0_fop_data(fop))

Definition at line 72 of file client.c.

Enumeration Type Documentation

◆ m0_cas_req_state

Possible CAS request states.

Enumerator
CASREQ_INVALID 
CASREQ_INIT 
CASREQ_SENT 
CASREQ_FRAGM_SENT 
CASREQ_ASSEMBLY 
CASREQ_FINAL 
CASREQ_FAILURE 
CASREQ_NR 

Definition at line 109 of file client.h.

Function Documentation

◆ addb2_add_cas_req_attrs()

static void addb2_add_cas_req_attrs ( const struct m0_cas_req req)
static

Definition at line 1262 of file client.c.

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

◆ cas_fop_send()

static void cas_fop_send ( struct m0_cas_req req)
static

Definition at line 576 of file client.c.

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

◆ cas_index_op_prepare()

static int cas_index_op_prepare ( const struct m0_cas_req req,
const struct m0_cas_id cids,
uint64_t  cids_nr,
bool  recv_val,
uint32_t  flags,
struct m0_cas_op **  out 
)
static

Definition at line 1200 of file client.c.

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

◆ cas_index_req_prepare()

static int cas_index_req_prepare ( struct m0_cas_req req,
const struct m0_cas_id cids,
uint64_t  cids_nr,
uint64_t  max_replies_nr,
bool  recv_val,
uint32_t  flags,
struct m0_cas_op **  op 
)
static

Definition at line 1273 of file client.c.

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

◆ cas_next_rc()

static int cas_next_rc ( int64_t  service_rc)
static

Definition at line 1463 of file client.c.

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

◆ cas_records_op_prepare()

static int cas_records_op_prepare ( const struct m0_cas_req req,
const struct m0_cas_id index,
const struct m0_bufvec keys,
const struct m0_bufvec values,
uint32_t  flags,
struct m0_cas_op **  out 
)
static

Definition at line 1569 of file client.c.

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

◆ cas_rep()

static struct m0_cas_rep* cas_rep ( struct m0_rpc_item reply)
static

Definition at line 452 of file client.c.

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

◆ cas_rep__validate()

static int cas_rep__validate ( const struct m0_fop_type ftype,
struct m0_cas_op op,
struct m0_cas_rep rep 
)
static

Definition at line 482 of file client.c.

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

◆ cas_rep_copy()

static void cas_rep_copy ( const struct m0_cas_req req,
uint64_t  idx,
struct m0_cas_rec_reply rep 
)
static

Definition at line 1346 of file client.c.

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

◆ cas_rep_val_is_valid()

static bool cas_rep_val_is_valid ( struct m0_rpc_at_buf val,
struct m0_fid idx_fid 
)
static

Definition at line 476 of file client.c.

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

◆ cas_rep_validate()

static int cas_rep_validate ( const struct m0_cas_req req)
static

Definition at line 531 of file client.c.

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

◆ cas_req_failure()

static void cas_req_failure ( struct m0_cas_req req,
int32_t  rc 
)
static

Definition at line 540 of file client.c.

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

◆ cas_req_failure_ast()

static void cas_req_failure_ast ( struct m0_sm_group grp,
struct m0_sm_ast ast 
)
static

Definition at line 546 of file client.c.

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

◆ cas_req_failure_ast_post()

static void cas_req_failure_ast_post ( struct m0_cas_req req,
int32_t  rc 
)
static

Definition at line 556 of file client.c.

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

◆ cas_req_fini()

static void cas_req_fini ( struct m0_cas_req req)
static

Definition at line 261 of file client.c.

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

◆ cas_req_fragment_continue()

static int cas_req_fragment_continue ( struct m0_cas_req req,
struct m0_cas_op op 
)
static

Definition at line 1552 of file client.c.

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

◆ cas_req_fragmentation()

static int cas_req_fragmentation ( struct m0_cas_req req)
static

Definition at line 1509 of file client.c.

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

◆ cas_req_fsync_remid_copy()

static void cas_req_fsync_remid_copy ( struct m0_cas_req req)
static

Gets transacation identifier information from returned reply fop of an UPDATE op.

Definition at line 1026 of file client.c.

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

◆ cas_req_prep()

static int cas_req_prep ( struct m0_cas_req req,
const struct m0_cas_id index,
const struct m0_bufvec keys,
const struct m0_bufvec values,
uint64_t  max_replies_nr,
uint32_t  flags,
struct m0_cas_op **  op 
)
static

Definition at line 1609 of file client.c.

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

◆ cas_req_replied_ast()

static void cas_req_replied_ast ( struct m0_sm_group grp,
struct m0_sm_ast ast 
)
static

Definition at line 1137 of file client.c.

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

◆ cas_req_replied_cb()

static void cas_req_replied_cb ( struct m0_rpc_item item)
static

Definition at line 1178 of file client.c.

Here is the call graph for this function:

◆ cas_req_reply_fini()

static void cas_req_reply_fini ( struct m0_cas_req req)
static

Definition at line 249 of file client.c.

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

◆ cas_req_reply_handle()

static int cas_req_reply_handle ( struct m0_cas_req req,
bool *  fragm_continue 
)
static

Definition at line 1039 of file client.c.

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

◆ cas_req_smgrp()

static struct m0_sm_group* cas_req_smgrp ( const struct m0_cas_req req)
static

Definition at line 218 of file client.c.

Here is the caller graph for this function:

◆ cas_req_state_set()

static void cas_req_state_set ( struct m0_cas_req req,
enum m0_cas_req_state  state 
)
static

Definition at line 240 of file client.c.

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

◆ cas_req_to_item()

static struct m0_rpc_item* cas_req_to_item ( const struct m0_cas_req req)
static

Definition at line 447 of file client.c.

Here is the caller graph for this function:

◆ cas_to_rpc_map()

static void cas_to_rpc_map ( const struct m0_cas_req creq,
const struct m0_rpc_item item 
)
static

Definition at line 146 of file client.c.

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

◆ creq_asmbl_fop_init()

static void creq_asmbl_fop_init ( struct m0_cas_req req,
struct m0_fop_type ftype,
struct m0_cas_op op 
)
static

Definition at line 607 of file client.c.

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

◆ creq_asmbl_fop_release()

static void creq_asmbl_fop_release ( struct m0_ref ref)
static

Definition at line 380 of file client.c.

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

◆ creq_asmbl_replied_ast()

static void creq_asmbl_replied_ast ( struct m0_sm_group grp,
struct m0_sm_ast ast 
)
static

Definition at line 1089 of file client.c.

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

◆ creq_asmbl_replied_cb()

static void creq_asmbl_replied_cb ( struct m0_rpc_item item)
static

Definition at line 1125 of file client.c.

Here is the call graph for this function:

◆ creq_fop_create()

static int creq_fop_create ( struct m0_cas_req req,
struct m0_fop_type ftype,
struct m0_cas_op op 
)
static

Definition at line 394 of file client.c.

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

◆ creq_fop_create_and_prepare()

static int creq_fop_create_and_prepare ( struct m0_cas_req req,
struct m0_fop_type ftype,
struct m0_cas_op op,
enum m0_cas_req_state next_state 
)
static

Definition at line 414 of file client.c.

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

◆ creq_fop_destroy()

static void creq_fop_destroy ( struct m0_cas_req req)
static

Definition at line 358 of file client.c.

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

◆ creq_fop_release()

static void creq_fop_release ( struct m0_ref ref)
static

Definition at line 368 of file client.c.

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

◆ creq_item_prepare()

static void creq_item_prepare ( const struct m0_cas_req req,
struct m0_rpc_item item,
const struct m0_rpc_item_ops ops 
)
static

Definition at line 565 of file client.c.

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

◆ creq_kv_buf_add()

static int creq_kv_buf_add ( const struct m0_cas_req req,
const struct m0_bufvec kv,
uint32_t  idx,
struct m0_rpc_at_buf buf 
)
static

Definition at line 592 of file client.c.

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

◆ creq_kv_hold_down()

static void creq_kv_hold_down ( struct m0_cas_rec rec)
static

Assigns pointers to record key/value to NULL, so they are not deallocated during RPC AT buffer finalisation. User is responsible for their deallocation.

Definition at line 310 of file client.c.

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

◆ creq_niter_fini()

static void creq_niter_fini ( struct creq_niter it)
static

Definition at line 796 of file client.c.

Here is the caller graph for this function:

◆ creq_niter_init()

static void creq_niter_init ( struct creq_niter it,
struct m0_cas_op op,
struct m0_cas_rep rep 
)
static

Definition at line 757 of file client.c.

Here is the caller graph for this function:

◆ creq_niter_invariant()

static bool creq_niter_invariant ( struct creq_niter it)
static

Definition at line 751 of file client.c.

Here is the caller graph for this function:

◆ creq_niter_next()

static int creq_niter_next ( struct creq_niter it)
static
Todo:
Validate it.

Definition at line 770 of file client.c.

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

◆ creq_op_alloc()

static int creq_op_alloc ( uint64_t  recs_nr,
struct m0_cas_op **  out 
)
static

Definition at line 161 of file client.c.

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

◆ creq_op_free()

static void creq_op_free ( struct m0_cas_op op)
static

Definition at line 186 of file client.c.

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

◆ creq_recv_fini()

static void creq_recv_fini ( struct m0_cas_recv recv,
bool  op_is_meta 
)
static

Finalises CAS record vector that is intended to be sent as part of the CAS request.

Definition at line 329 of file client.c.

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

◆ creq_rep_override()

static void creq_rep_override ( struct m0_cas_rec orig,
struct m0_cas_rec new 
)
static

Definition at line 944 of file client.c.

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

◆ creq_rpc_conn()

static struct m0_rpc_conn* creq_rpc_conn ( const struct m0_cas_req req)
static

Definition at line 208 of file client.c.

Here is the caller graph for this function:

◆ creq_rpc_mach()

static struct m0_rpc_machine* creq_rpc_mach ( const struct m0_cas_req req)
static

Definition at line 213 of file client.c.

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

◆ fid_is_meta()

static bool fid_is_meta ( struct m0_fid fid)
static

Definition at line 155 of file client.c.

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

◆ greq_asmbl_accept()

static void greq_asmbl_accept ( struct m0_cas_req req)
static

Definition at line 995 of file client.c.

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

◆ greq_asmbl_add()

static int greq_asmbl_add ( struct m0_cas_req req,
struct m0_cas_rec rec,
uint64_t  idx,
uint64_t  orig_idx,
uint64_t  vlen 
)
static

Fills outgoing record 'rec' that is a part of an assembly FOP.

Key/value data is assigned from original GET request. Indices of records in original and assembly requests may be different, 'idx' is an index of a record in assembly request and 'orig_idx' is an index of a record in original GET request that should be re-requested.

Definition at line 623 of file client.c.

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

◆ greq_asmbl_count()

static uint64_t greq_asmbl_count ( const struct m0_cas_req req)
static

Returns number of records that should be re-requested via assembly request.

Definition at line 648 of file client.c.

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

◆ greq_asmbl_fill()

static int greq_asmbl_fill ( struct m0_cas_req req,
struct m0_cas_op op 
)
static

Definition at line 673 of file client.c.

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

◆ greq_asmbl_post()

static bool greq_asmbl_post ( struct m0_cas_req req)
static

Definition at line 715 of file client.c.

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

◆ item_to_cas_req()

static struct m0_cas_req* item_to_cas_req ( struct m0_rpc_item item)
static

Definition at line 441 of file client.c.

Here is the caller graph for this function:

◆ m0_cas__get()

static int m0_cas__get ( struct m0_cas_req req,
struct m0_cas_id index,
const struct m0_bufvec keys,
int  flags 
)
static

Definition at line 1695 of file client.c.

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

◆ m0_cas_del()

M0_INTERNAL int m0_cas_del ( struct m0_cas_req req,
struct m0_cas_id index,
struct m0_bufvec keys,
struct m0_dtx dtx,
uint32_t  flags 
)

Deletes records with given keys from the index.

Keys buffers (m0_bufvec::ov_vec[i]) should be accessible until request is processed.

'Flags' argument is a bitmask of m0_cas_op_flags values. COF_DEL_LOCK is the only possible flag for now.

Precondition
m0_cas_req_is_locked(req)
M0_IN(flags, (0, COF_DEL_LOCK))
See also
m0_cas_del_rep()

Definition at line 1842 of file client.c.

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

◆ m0_cas_del_rep()

M0_INTERNAL void m0_cas_del_rep ( struct m0_cas_req req,
uint64_t  idx,
struct m0_cas_rec_reply rep 
)

Gets execution result of m0_cas_del() request.

Precondition
idx < m0_cas_req_nr(req)

Definition at line 1873 of file client.c.

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

◆ m0_cas_get()

M0_INTERNAL int m0_cas_get ( struct m0_cas_req req,
struct m0_cas_id index,
const struct m0_bufvec keys 
)

Gets values for provided keys.

Keys buffers (m0_bufvec::ov_vec[i]) should be accessible until request is processed.

Precondition
m0_cas_req_is_locked(req)
See also
m0_cas_get_rep()

Definition at line 1741 of file client.c.

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

◆ m0_cas_get_rep()

M0_INTERNAL void m0_cas_get_rep ( const struct m0_cas_req req,
uint64_t  idx,
struct m0_cas_get_reply rep 
)

Gets execution result of m0_cas_get() request.

Function fills rep->cge_val. Value data buffer is deallocated in m0_cas_req_fini(), unless m0_cas_rep_mlock() is called by user.

Precondition
idx < m0_cas_req_nr(req)

Definition at line 1755 of file client.c.

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

◆ m0_cas_index_create()

M0_INTERNAL int m0_cas_index_create ( struct m0_cas_req req,
const struct m0_cas_id cids,
uint64_t  cids_nr,
struct m0_dtx dtx 
)

Creates new indices.

It is not needed to keep CAS ids array accessible until request is processed.

Precondition
m0_cas_req_is_locked(req)
See also
m0_cas_index_create_rep()

Definition at line 1321 of file client.c.

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

◆ m0_cas_index_create_rep()

M0_INTERNAL void m0_cas_index_create_rep ( const struct m0_cas_req req,
uint64_t  idx,
struct m0_cas_rec_reply rep 
)

Gets execution result of m0_cas_index_create() request.

Precondition
idx < m0_cas_req_nr(req)

Definition at line 1357 of file client.c.

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

◆ m0_cas_index_delete()

M0_INTERNAL int m0_cas_index_delete ( struct m0_cas_req req,
const struct m0_cas_id cids,
uint64_t  cids_nr,
struct m0_dtx dtx,
uint32_t  flags 
)

Delete indices with all records they contain.

It is not needed to keep CAS ids array accessible until request is processed. Flag m0_cas_op_flags::COF_CROW can be set in flags to be a no-op if the catalogue to be deleted does not exist.

Precondition
m0_cas_req_is_locked(req)
(flags & ~(COF_CROW | COF_DEL_LOCK)) == 0
See also
m0_cas_index_delete_rep()

Definition at line 1366 of file client.c.

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

◆ m0_cas_index_delete_rep()

M0_INTERNAL void m0_cas_index_delete_rep ( const struct m0_cas_req req,
uint64_t  idx,
struct m0_cas_rec_reply rep 
)

Gets execution result of m0_cas_index_delete() request.

Precondition
idx < m0_cas_req_nr(req)

Definition at line 1394 of file client.c.

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

◆ m0_cas_index_list()

M0_INTERNAL int m0_cas_index_list ( struct m0_cas_req req,
const struct m0_fid start_fid,
uint32_t  indices_nr,
uint32_t  flags 
)

Gets identifiers of the next 'indices_nr' indices starting with index having 'start_fid' identifier.

Zero FID (0,0) (see m0_cas_meta_fid) can be used as a 'start_fid' in order to start iteration from the first index. Note, that zero FID is also included in the result.

Precondition
m0_cas_req_is_locked(req)
start_fid != NULL
See also
m0_cas_index_list_rep()

Definition at line 1435 of file client.c.

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

◆ m0_cas_index_list_rep()

M0_INTERNAL void m0_cas_index_list_rep ( struct m0_cas_req req,
uint32_t  idx,
struct m0_cas_ilist_reply rep 
)

Gets execution result of m0_cas_index_list() request.

The fact that there are no more indices to return on CAS service side (end of list is reached) is denoted by special reply record with -ENOENT return code.

Precondition
idx < m0_cas_req_nr(req)

Definition at line 1488 of file client.c.

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

◆ m0_cas_index_lookup()

M0_INTERNAL int m0_cas_index_lookup ( struct m0_cas_req req,
const struct m0_cas_id cids,
uint64_t  cids_nr 
)

Checks whether indices with given identifiers exist.

It is not needed to keep CAS ids array accessible until request is processed.

Precondition
m0_cas_req_is_locked(req)
See also
m0_cas_index_lookup_rep()

Definition at line 1403 of file client.c.

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

◆ m0_cas_index_lookup_rep()

M0_INTERNAL void m0_cas_index_lookup_rep ( const struct m0_cas_req req,
uint64_t  idx,
struct m0_cas_rec_reply rep 
)

Gets execution result of m0_cas_index_lookup() request.

Return code meaning in m0_cas_rec_reply: 0 - index exists; -ENOENT - index doesn't exist; other - some error during request processing.

Precondition
idx < m0_cas_req_nr(req)

Definition at line 1426 of file client.c.

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

◆ m0_cas_next()

M0_INTERNAL int m0_cas_next ( struct m0_cas_req req,
struct m0_cas_id index,
struct m0_bufvec start_keys,
uint32_t *  recs_nr,
uint32_t  flags 
)

Gets next 'recs_nr[i]' records for each i-th key in 'start_keys'.

Size of recs_nr array should be >= start_keys->ov_vec.v_nr.

Requested record ranges may overlap. Duplicates in a result are not filtered.

Records with 'start_keys' keys are also accounted and included in the result unless COF_EXCLUDE_START_KEY flag is specified.

In order to start iteration from the first record user may specify 1-byte zero start key and specify COF_SLANT flag. COF_SLANT flag is also useful if start key may be not found in the index. In this case iteration starts with the smallest key following the start key.

'Flags' argument is a bitmask of m0_cas_op_flags values.

Precondition
start_keys.ov_vec.v_nr > 0
m0_forall(i, start_keys.ov_vec.v_nr, start_keys.ov_buf[i] != NULL)
M0_PRE((flags & ~(COF_SLANT | COF_EXCLUDE_START_KEY)) == 0)
m0_cas_req_is_locked(req)
See also
m0_cas_next_rep()

Definition at line 1775 of file client.c.

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

◆ m0_cas_next_rep()

M0_INTERNAL void m0_cas_next_rep ( const struct m0_cas_req req,
uint32_t  idx,
struct m0_cas_next_reply rep 
)

Gets execution result of m0_cas_next() request.

The fact that there are no more records to return on CAS service side (end of index is reached) is denoted by special reply record with -ENOENT return code.

Function doesn't copy key/value data buffers, only assign pointers to received buffers. They are deallocated in m0_cas_req_fini(), unless m0_cas_rep_mlock() is called by user.

Precondition
idx < m0_cas_req_nr(req)

Definition at line 1825 of file client.c.

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

◆ m0_cas_put()

M0_INTERNAL int m0_cas_put ( struct m0_cas_req req,
struct m0_cas_id index,
const struct m0_bufvec keys,
const struct m0_bufvec values,
struct m0_dtx dtx,
uint32_t  flags 
)

Inserts records to the index.

Keys and values buffers (m0_bufvec::ov_vec[i]) should be accessible until request is processed. Also, it's user responsibility to manage these buffers after request is processed.

'Flags' argument is a bitmask of m0_cas_op_flags values. COF_CREATE and COF_OVERWRITE flags can't be specified together.

Precondition
!(flags & COF_CREATE) || !(flags & COF_OVERWRITE)
(flags & ~(COF_CREATE | COF_OVERWRITE | COF_CROW)) == 0
m0_cas_req_is_locked(req)
See also
m0_cas_put_rep()

Definition at line 1643 of file client.c.

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

◆ m0_cas_put_rep()

M0_INTERNAL void m0_cas_put_rep ( struct m0_cas_req req,
uint64_t  idx,
struct m0_cas_rec_reply rep 
)

Gets execution result of m0_cas_put() request.

Precondition
idx < m0_cas_req_nr(req)

Definition at line 1685 of file client.c.

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

◆ m0_cas_rep_mlock()

M0_INTERNAL void m0_cas_rep_mlock ( const struct m0_cas_req req,
uint64_t  idx 
)

Prevents deallocation of key/value buffers during request finalisation.

Applicable only for GET, NEXT requests. In case of GET request m0_cas_get_reply::cge_val::b_addr pointer, obtained by corresponding 'idx' will be locked in memory and user is responsible to deallocate it afterwards. In case of NEXT request both key and value buffers in m0_cas_next_reply buffer are locked and user is responsible to deallocate them.

Precondition
idx < m0_cas_req_nr(req)
See also
m0_cas_get_rep(), m0_cas_next_rep()

Definition at line 1816 of file client.c.

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

◆ m0_cas_req_fini()

M0_INTERNAL void m0_cas_req_fini ( struct m0_cas_req req)

Finalises CAS client request.

It's not allowed to call it when request is in progress. Once one of request functions is called, user should wait until SM reaches CASREQ_FINAL or CASREQ_FAILURE state. There is no way to cancel current operation.

Precondition
M0_IN(req->ccr_sm.sm_state, (CASREQ_INIT, CASREQ_FINAL, CASREQ_FAILURE))
m0_cas_req_is_locked(req)
Postcondition
M0_IS0(req)

Definition at line 288 of file client.c.

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

◆ m0_cas_req_fini_lock()

M0_INTERNAL void m0_cas_req_fini_lock ( struct m0_cas_req req)

The same as m0_cas_req_fini(), but takes CAS request lock internally.

Precondition
M0_IN(req->ccr_sm.sm_state, (CASREQ_INIT, CASREQ_FINAL, CASREQ_FAILURE))
Postcondition
M0_IS0(req)

Definition at line 295 of file client.c.

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

◆ m0_cas_req_generic_rc()

M0_INTERNAL int m0_cas_req_generic_rc ( const struct m0_cas_req req)

Gets request execution return code.

Should be called only after request processing is finished, i.e. CAS request is in CASREQ_FINAL or CASREQ_FAILURE state.

This return code is generic in sense that it doesn't take into account return codes of operations on individual request records. These codes can be obtained via m0_cas_*_rep() functions.

Definition at line 457 of file client.c.

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

◆ m0_cas_req_init()

M0_INTERNAL void m0_cas_req_init ( struct m0_cas_req req,
struct m0_rpc_session sess,
struct m0_sm_group grp 
)

Initialises CAS client request.

Initialisation should be done always before sending specific request. RPC session 'sess' to CAS service should be already established.

Precondition
M0_IS0(req)

Definition at line 195 of file client.c.

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

◆ m0_cas_req_is_locked()

M0_INTERNAL bool m0_cas_req_is_locked ( const struct m0_cas_req req)

Checks whether CAS request state machine group is locked.

Definition at line 235 of file client.c.

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

◆ m0_cas_req_lock()

M0_INTERNAL void m0_cas_req_lock ( struct m0_cas_req req)

Locks state machine group that is used by CAS request.

Definition at line 223 of file client.c.

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

◆ m0_cas_req_nr()

M0_INTERNAL uint64_t m0_cas_req_nr ( const struct m0_cas_req req)

Returns the number of results.

For the following requests it's guaranteed that if m0_cas_req_generic_rc(req) == 0, then m0_cas_req_nr() equals to the number of requested items:

Definition at line 1308 of file client.c.

Here is the caller graph for this function:

◆ m0_cas_req_unlock()

M0_INTERNAL void m0_cas_req_unlock ( struct m0_cas_req req)

Unlocks state machine group that is used by CAS request.

Definition at line 229 of file client.c.

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

◆ m0_cas_req_wait()

M0_INTERNAL int m0_cas_req_wait ( struct m0_cas_req req,
uint64_t  states,
m0_time_t  to 
)

Synchronously waits until CAS request reaches a desired state.

The 'states' argument is a bitmask based on m0_cas_req_state. M0_BITS() macro should be used to build a bitmask.

Precondition
m0_cas_req_is_locked(req)
Parameters
toabsolute timeout to wait.

Definition at line 1313 of file client.c.

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

◆ m0_cas_sm_conf_fini()

M0_INTERNAL void m0_cas_sm_conf_fini ( void  )

Definition at line 1891 of file client.c.

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

◆ m0_cas_sm_conf_init()

M0_INTERNAL int m0_cas_sm_conf_init ( void  )

Definition at line 1883 of file client.c.

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

◆ m0_cas_versioned_get()

M0_INTERNAL int m0_cas_versioned_get ( struct m0_cas_req req,
struct m0_cas_id index,
const struct m0_bufvec keys 
)

A version-aware version of m0_cas_get. It returns the values associated with the given keys only if this values do not have tombstones set (i.e., they have not been removed). See COF_VERSIONED.

TODO: This function may be disolved if m0_cas_get gets an extra argument (flags).

Definition at line 1748 of file client.c.

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

◆ nreq_asmbl_accept()

static void nreq_asmbl_accept ( struct m0_cas_req req)
static
Todo:
validate it

Definition at line 960 of file client.c.

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

◆ nreq_asmbl_fill()

static int nreq_asmbl_fill ( struct m0_cas_req req,
struct m0_cas_op op 
)
static

Definition at line 838 of file client.c.

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

◆ nreq_asmbl_post()

static bool nreq_asmbl_post ( struct m0_cas_req req)
static

Definition at line 892 of file client.c.

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

◆ nreq_asmbl_prep()

static int nreq_asmbl_prep ( struct m0_cas_req req,
struct m0_cas_op op 
)
static

Sets starting keys and allocates space for key/values AT buffers expected in reply.

Definition at line 805 of file client.c.

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

Variable Documentation

◆ asmbl_item_ops

const struct m0_rpc_item_ops asmbl_item_ops
static
Initial value:
= {
.rio_sent = NULL,
.rio_replied = creq_asmbl_replied_cb
}
#define NULL
Definition: misc.h:38
static void creq_asmbl_replied_cb(struct m0_rpc_item *item)
Definition: client.c:1125

Definition at line 83 of file client.c.

◆ cas_item_ops

const struct m0_rpc_item_ops cas_item_ops
static
Initial value:
= {
.rio_sent = NULL,
.rio_replied = cas_req_replied_cb
}
#define NULL
Definition: misc.h:38
static void cas_req_replied_cb(struct m0_rpc_item *item)
Definition: client.c:1178

Definition at line 76 of file client.c.

◆ cas_req_sm_conf

struct m0_sm_conf cas_req_sm_conf
Initial value:
= {
.scf_name = "cas_req",
.scf_nr_states = ARRAY_SIZE(cas_req_states),
.scf_state = cas_req_states,
.scf_trans_nr = ARRAY_SIZE(cas_req_trans),
.scf_trans = cas_req_trans
}
static struct m0_sm_trans_descr cas_req_trans[]
Definition: client.c:119
static struct m0_sm_state_descr cas_req_states[]
Definition: client.c:88
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 133 of file client.c.

◆ cas_req_states

struct m0_sm_state_descr cas_req_states[]
static
Initial value:
= {
.sd_name = "init",
},
.sd_name = "request-sent",
},
.sd_name = "request-fragment-sent",
},
.sd_name = "assembly",
},
.sd_name = "final",
.sd_flags = M0_SDF_TERMINAL,
},
.sd_name = "failure",
}
}
#define M0_BITS(...)
Definition: misc.h:236

Definition at line 88 of file client.c.

◆ cas_req_trans

struct m0_sm_trans_descr cas_req_trans[]
static
Initial value:
= {
{ "send-over-rpc", CASREQ_INIT, CASREQ_SENT },
{ "send-fragm-over-rpc", CASREQ_INIT, CASREQ_FRAGM_SENT },
{ "rpc-failure", CASREQ_SENT, CASREQ_FAILURE },
{ "assembly", CASREQ_SENT, CASREQ_ASSEMBLY },
{ "req-processed", CASREQ_SENT, CASREQ_FINAL },
{ "rpc-failure", CASREQ_FRAGM_SENT, CASREQ_FAILURE },
{ "fragm-assembly", CASREQ_FRAGM_SENT, CASREQ_ASSEMBLY },
{ "req-processed", CASREQ_FRAGM_SENT, CASREQ_FINAL },
{ "assembly-fail", CASREQ_ASSEMBLY, CASREQ_FAILURE },
{ "assembly-done", CASREQ_ASSEMBLY, CASREQ_FINAL },
{ "assembly-fragm", CASREQ_ASSEMBLY, CASREQ_FRAGM_SENT },
}

Definition at line 119 of file client.c.