Motr  M0
cas.h File Reference
#include "xcode/xcode_attr.h"
#include "fid/fid.h"
#include "fid/fid_xc.h"
#include "lib/types.h"
#include "lib/buf.h"
#include "lib/buf_xc.h"
#include "lib/cookie.h"
#include "lib/cookie_xc.h"
#include "rpc/at.h"
#include "rpc/at_xc.h"
#include "fop/fom_generic.h"
#include "fop/fom_generic_xc.h"
#include "fop/fom_interpose.h"
#include "dix/layout.h"
#include "dix/layout_xc.h"
#include "dtm0/tx_desc.h"
#include "dtm0/tx_desc_xc.h"
Include dependency graph for cas.h:

Go to the source code of this file.

Data Structures

struct  m0_cas_hint
 
struct  m0_cas_id
 
struct  m0_cas_kv
 
struct  m0_cas_kv_vec
 
struct  m0_crv
 
struct  m0_cas_rec
 
struct  m0_cas_recv
 
struct  m0_cas_op
 
struct  m0_cas_rep
 

Macros

#define __MOTR_CAS_CAS_H__
 
#define CRV_F   "%" PRIu64 ":%c"
 
#define CRV_P(__crv)   m0_crv_ts(__crv).dts_phys, m0_crv_tbs(__crv) ? 'd' : 'a'
 
#define M0_CRV_INIT_NONE   ((struct m0_crv) { .crv_encoded = M0_CRV_VER_NONE })
 

Enumerations

enum  m0_cas_op_flags {
  COF_SLANT = 1 << 0, COF_CREATE = 1 << 1, COF_OVERWRITE = 1 << 2, COF_CROW = 1 << 3,
  COF_RESERVE = 1 << 4, COF_DEL_LOCK = 1 << 5, COF_EXCLUDE_START_KEY = 1 << 6, COF_SYNC_WAIT = 1 << 7,
  COF_SKIP_LAYOUT = 1 << 8, COF_VERSIONED = 1 << 9, COF_SHOW_DEAD = 1 << 10
}
 
enum  m0_cas_opcode {
  CO_GET, CO_PUT, CO_DEL, CO_CUR,
  CO_REP, CO_GC, CO_MIN, CO_TRUNC,
  CO_DROP, CO_MEM_PLACE, CO_MEM_FREE, CO_NR
}
 
enum  m0_cas_type { CT_META, CT_BTREE, CT_DEAD_INDEX, CT_MEM }
 
enum  { M0_CRV_TBS = 1L << (sizeof(uint64_t) * CHAR_BIT - 1), M0_CRV_VER_NONE = 0, M0_CRV_VER_MAX = (UINT64_MAX & ~M0_CRV_TBS) - 1, M0_CRV_VER_MIN = M0_CRV_VER_NONE + 1 }
 

Functions

struct m0_cas_hint M0_XCA_DOMAIN (rpc)
 
struct m0_crv M0_XCA_DOMAIN (rpc|be)
 
M0_INTERNAL void m0_cas_svc_init (void)
 
M0_INTERNAL void m0_cas_svc_fini (void)
 
M0_INTERNAL void m0_cas_svc_fop_args (struct m0_sm_conf **sm_conf, const struct m0_fom_type_ops **fom_ops, struct m0_reqh_service_type **svctype)
 
M0_INTERNAL void m0_cas__ut_svc_be_set (struct m0_reqh_service *svc, struct m0_be_domain *dom)
 
M0_INTERNAL struct m0_be_domainm0_cas__ut_svc_be_get (struct m0_reqh_service *svc)
 
M0_INTERNAL int m0_cas_fom_spawn (struct m0_fom *lead, struct m0_fom_thralldom *thrall, struct m0_fop *cas_fop, void(*on_fom_complete)(struct m0_fom_thralldom *, struct m0_fom *))
 
M0_INTERNAL void m0_cas_id_fini (struct m0_cas_id *cid)
 
M0_INTERNAL bool m0_cas_id_invariant (const struct m0_cas_id *cid)
 
M0_INTERNAL bool cas_in_ut (void)
 
M0_INTERNAL void m0_crv_init (struct m0_crv *crv, const struct m0_dtm0_ts *ts, bool tbs)
 
M0_INTERNAL bool m0_crv_is_none (const struct m0_crv *crv)
 
M0_INTERNAL int m0_crv_cmp (const struct m0_crv *left, const struct m0_crv *right)
 
M0_INTERNAL bool m0_crv_tbs (const struct m0_crv *crv)
 
M0_INTERNAL void m0_crv_tbs_set (struct m0_crv *crv, bool tbs)
 
M0_INTERNAL struct m0_dtm0_ts m0_crv_ts (const struct m0_crv *crv)
 
M0_INTERNAL void m0_crv_ts_set (struct m0_crv *crv, const struct m0_dtm0_ts *ts)
 

Variables

struct m0_cookie ch_cookie
 
uint64_t ch_index
 
struct m0_fid ci_fid
 
struct m0_cas_hint ci_hint
 
struct m0_dix_layout ci_layout
 
struct m0_rpc_at_buf ck_key
 
struct m0_rpc_at_buf ck_val
 
uint64_t cv_nr
 
struct m0_cas_kvcv_rec
 
uint64_t crv_encoded
 
struct m0_rpc_at_buf cr_key
 
struct m0_rpc_at_buf cr_val
 
struct m0_cas_kv_vec cr_kv_bufs
 
struct m0_cas_hint cr_hint
 
uint64_t cr_rc
 
struct m0_crv cr_ver
 
uint64_t cr_nr
 
struct m0_cas_reccr_rec
 
enum m0_cas_op_flags M0_XCA_DOMAIN
 
enum m0_cas_opcode M0_XCA_ENUM
 
struct m0_cas_id cg_id
 
struct m0_cas_recv cg_rec
 
uint32_t cg_flags
 
struct m0_dtm0_tx_desc cg_txd
 
int32_t cgr_rc
 
struct m0_cas_recv cgr_rep
 
struct m0_fop_mod_rep cgr_mod_rep
 
M0_EXTERN struct m0_reqh_service_type m0_cas_service_type
 
M0_EXTERN const struct m0_fid m0_cas_meta_fid
 
M0_EXTERN const struct m0_fid m0_cas_dead_index_fid
 
M0_EXTERN const struct m0_fid m0_cas_ctidx_fid
 
M0_EXTERN const struct m0_fid_type m0_cas_index_fid_type
 
M0_EXTERN const struct m0_fid_type m0_dix_fid_type
 
M0_EXTERN const struct m0_fid_type m0_cctg_fid_type
 
M0_EXTERN struct m0_fop_type cas_get_fopt
 
M0_EXTERN struct m0_fop_type cas_put_fopt
 
M0_EXTERN struct m0_fop_type cas_del_fopt
 
M0_EXTERN struct m0_fop_type cas_cur_fopt
 
M0_EXTERN struct m0_fop_type cas_rep_fopt
 
M0_EXTERN struct m0_fop_type cas_gc_fopt
 
struct m0_fop_type m0_fop_fsync_cas_fopt
 

Macro Definition Documentation

◆ __MOTR_CAS_CAS_H__

#define __MOTR_CAS_CAS_H__

Definition at line 26 of file cas.h.

Variable Documentation

◆ cg_flags

uint32_t cg_flags

CAS operation flags.

It's a bitmask of flags from m0_cas_op_flags enumeration.

Definition at line 301 of file cas.h.

◆ cg_id

struct m0_cas_id cg_id

Index to make operation in.

Definition at line 284 of file cas.h.

◆ cg_rec

struct m0_cas_recv cg_rec

Array of input records.

For CAS-GET, CAS-DEL and CAS-CUR this describes input keys. For CAS-PUT this describes input keys and values.

Array should be non-empty.

Definition at line 294 of file cas.h.

◆ cg_txd

struct m0_dtm0_tx_desc cg_txd

Transaction descriptor associated with CAS operation.

Definition at line 306 of file cas.h.

◆ cgr_mod_rep

struct m0_fop_mod_rep cgr_mod_rep

Returned values for an UPDATE operation, such as CAS-PUT.

Definition at line 306 of file cas.h.

◆ cgr_rc

int32_t cgr_rc

Status code of operation. If code != 0, then no input record from request is processed successfully and contents of m0_cas_rep::cgr_rep field is undefined.

Zero status code means that at least one input record is processed successfully. Operation status code of individual input record can be obtained through m0_cas_rep::cgr_rep::cg_rec::cr_rc.

Definition at line 292 of file cas.h.

◆ cgr_rep

struct m0_cas_recv cgr_rep

Array of operation results for each input record.

For CAS-GET this describes output values.

For CAS-PUT and, CAS-DEL this describes return codes.

For CAS-CUR this describes next records.

Definition at line 303 of file cas.h.

◆ ch_cookie

struct m0_cookie ch_cookie

Cookie of the leaf node.

Definition at line 284 of file cas.h.

◆ ch_index

uint64_t ch_index

Position of the record within the node.

Definition at line 286 of file cas.h.

◆ ci_fid

struct m0_fid ci_fid

Catalogue fid. This is always present and can be of two types:

  • general (m0_cas_index_fid_type);
  • component catalogue (m0_cctg_fid_type).

Definition at line 288 of file cas.h.

◆ ci_hint

struct m0_cas_hint ci_hint

Cookie, when present is used instead of fid.

Definition at line 290 of file cas.h.

◆ ci_layout

struct m0_dix_layout ci_layout

Distributed index layout. Valid if type of ci_fid is component catalogue.

Definition at line 295 of file cas.h.

◆ ck_key

struct m0_rpc_at_buf ck_key

Definition at line 283 of file cas.h.

◆ ck_val

struct m0_rpc_at_buf ck_val

Definition at line 284 of file cas.h.

◆ cr_hint

struct m0_cas_hint cr_hint

Optional hint to speed up access.

Definition at line 318 of file cas.h.

◆ cr_key

struct m0_rpc_at_buf cr_key

Record key.

Should be filled for GET, DEL, PUT, CUR requests. It's empty in replies for GET, DEL, PUT requests and non-empty for CUR reply.

Definition at line 290 of file cas.h.

◆ cr_kv_bufs

struct m0_cas_kv_vec cr_kv_bufs

Vector of AT buffers to request key/value buffers in CUR request.

CUR request only specifies the starting key in cr_key. If several keys/values from reply should be transferred via bulk, then request should have descriptors for them => vector is required.

For now, vector size is either 0 (inline transmission is requested for all records) or equals to cr_rc (individual AT transmission method for every key/value).

Definition at line 313 of file cas.h.

◆ cr_nr

uint64_t cr_nr

Definition at line 283 of file cas.h.

◆ cr_rc

uint64_t cr_rc

In GET, DEL, PUT replies, return code for the operation on this record. In CUR request, the number of consecutive records to return.

In CUR reply, the consecutive number of the record for the current key. For example, if there are two records in CUR request requesting 2 and 3 next records respectively, then cr_rc values in reply records will be: 1,2,1,2,3.

Also, CAS service stops iteration for the current CAS-CUR key on error and proceed with the next key in the input vector. Suppose there is a CUR request, requesting 10 records starting from K0 and 10 records starting with K1. Suppose iteration failed on the fifth record after K0 and all K1 records were processed successfully. In this case, the reply would contain at least 15 records. First 5 will be for K0, the last of which would contain errno, the next 10 records will be for K1. Current implementation will add final 5 zeroed records.

Definition at line 339 of file cas.h.

◆ cr_rec

struct m0_cas_rec* cr_rec

Definition at line 284 of file cas.h.

◆ cr_val

struct m0_rpc_at_buf cr_val

Record value.

Should be empty for GET, DEL, CUR requests. For PUT request it should be empty if record is inserted in meta-index and filled otherwise. If operation is successful then replies for non-meta GET, CUR have this field set.

Definition at line 300 of file cas.h.

◆ cr_ver

struct m0_crv cr_ver

Optional version of this record. The version is returned as a reply to GET and NEXT requests when COF_VERSIONED is specified in the request.

Definition at line 346 of file cas.h.

◆ crv_encoded

uint64_t crv_encoded

Definition at line 283 of file cas.h.

◆ cv_nr

uint64_t cv_nr

Definition at line 283 of file cas.h.

◆ cv_rec

struct m0_cas_kv* cv_rec

Definition at line 284 of file cas.h.