Motr  M0
CAS service

Detailed functional specification. More...

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 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 })
 
#define M0_XCA_ENUM   M0_XC_ATTR("enum", "nonce")
 

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

enum m0_cas_op_flags M0_XCA_DOMAIN
 
enum m0_cas_opcode M0_XCA_ENUM
 
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
 

Detailed Description

Detailed functional specification.

Macro Definition Documentation

◆ CRV_F

#define CRV_F   "%" PRIu64 ":%c"

Definition at line 508 of file cas.h.

◆ CRV_P

#define CRV_P (   __crv)    m0_crv_ts(__crv).dts_phys, m0_crv_tbs(__crv) ? 'd' : 'a'

Definition at line 509 of file cas.h.

◆ M0_CRV_INIT_NONE

#define M0_CRV_INIT_NONE   ((struct m0_crv) { .crv_encoded = M0_CRV_VER_NONE })

Definition at line 511 of file cas.h.

◆ M0_XCA_ENUM

enum testbitmask M0_XCA_ENUM   M0_XC_ATTR("enum", "nonce")

Definition at line 54 of file xcode_attr.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
M0_CRV_TBS 
M0_CRV_VER_NONE 
M0_CRV_VER_MAX 
M0_CRV_VER_MIN 

Definition at line 486 of file cas.h.

◆ m0_cas_op_flags

CAS operation flags.

Enumerator
COF_SLANT 

For NEXT operation, allows iteration to start with the smallest key following the start key if the start key is not found.

COF_CREATE 

For PUT operation, instructs it to be a no-op if the record with the given key already exists.

COF_OVERWRITE 

For PUT operation, instructs it to silently overwrite existing record with the same key, if any.

COF_CROW 

For PUT operation, instructs it to create catalogue on record PUT to non-existent catalogue. For DEL operation, instructs it to be a no-op if catalogue to be deleted does not exist.

COF_RESERVE 

Repair is in progress, reserve space.

COF_DEL_LOCK 

For DEL operation, instructs CAS service to take "delete" lock for the record being deleted. It is used by DIX client to handle delete in degraded mode.

COF_EXCLUDE_START_KEY 

For NEXT operation, instructs it to skip record with the given start key.

COF_SYNC_WAIT 

For PUT/DEL operation, instructs it to delay reply from CAS service until BE transaction is persisted.

COF_SKIP_LAYOUT 

For IDX CREATE, IDX DELETE and IDX LOOKUP operation, instructs it to skip layout update operation.

COF_VERSIONED 

Enables version-aware behavior for PUT, DEL, GET, and NEXT requests.

Overview

Versions are taken from m0_cas_op::cg_txd. When this flag is set, the following change happens in the logic of the mentioned request types:

  • PUT does not overwrite "newest" (version-wise) records. Requirements: x COF_OVERWRITE is set. x Transaction descriptor has a valid DTX ID.
  • DEL puts a tombstone instead of an actual removal. In this mode, DEL does not return -ENOENT in the same way as PUT-with-COF_OVERWRITE does not return -EEXIST. Requirements: x Transaction descriptor has a valid DTX ID.
  • GET returns only "alive" entries (without tombstones).
  • NEXT also skips entries with tombstones.

How to enable/disable

This operation mode is enabled only if all the requirements are satisfied (the list above). For example, if m0_cas_op::cg_txd does not have a valid transaction ID then the request is getting executed in the usual manner, without version-aware behavior. Additional restictions may be imposed later on, but at this moment it is as flexible as possible.

Relation with DTM0

The flag should always be enabled if DTM0 is enabled because it enables CRDT-ness for catalogues. If DTM0 is not enabled then this flag may or may not be enabled (for example, the version-related UTs use the flag but they do not depend on enabled DTM0).

COF_SHOW_DEAD 

Makes NEXT return "dead" records (with tombstones) when version-aware behavior is specified (see COF_VERSIONED). By default, COF_VERSIONED does not return dead records for NEXT requests but when both flags are specified (VERSIONED | SHOW_DEAD) then it yields all records whether they are alive or not. It might be used by the client when it wants to analyse the records received from several catalogue services, so that it could properly merge the results of NEXT operations eliminating inconsistencies. In other words, it might be used in degraded mode.

Definition at line 242 of file cas.h.

◆ m0_cas_opcode

Enumerator
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 

Definition at line 343 of file cas.h.

◆ m0_cas_type

Enumerator
CT_META 
CT_BTREE 
CT_DEAD_INDEX 
CT_MEM 

Definition at line 358 of file cas.h.

Function Documentation

◆ cas_in_ut()

M0_INTERNAL bool cas_in_ut ( void  )

Definition at line 220 of file cas.c.

Here is the caller graph for this function:

◆ m0_cas__ut_svc_be_get()

M0_INTERNAL struct m0_be_domain* m0_cas__ut_svc_be_get ( struct m0_reqh_service svc)

Definition at line 553 of file service.c.

Here is the caller graph for this function:

◆ m0_cas__ut_svc_be_set()

M0_INTERNAL void m0_cas__ut_svc_be_set ( struct m0_reqh_service svc,
struct m0_be_domain dom 
)

Definition at line 545 of file service.c.

Here is the caller graph for this function:

◆ m0_cas_fom_spawn()

M0_INTERNAL int m0_cas_fom_spawn ( struct m0_fom lead,
struct m0_fom_thralldom thrall,
struct m0_fop cas_fop,
void(*)(struct m0_fom_thralldom *, struct m0_fom *)  on_fom_complete 
)

Definition at line 2570 of file service.c.

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

◆ m0_cas_id_fini()

M0_INTERNAL void m0_cas_id_fini ( struct m0_cas_id cid)

Definition at line 198 of file cas.c.

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

◆ m0_cas_id_invariant()

M0_INTERNAL bool m0_cas_id_invariant ( const struct m0_cas_id cid)

Definition at line 207 of file cas.c.

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

◆ m0_cas_svc_fini()

M0_INTERNAL void m0_cas_svc_fini ( void  )

Definition at line 529 of file service.c.

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

◆ m0_cas_svc_fop_args()

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 
)

Definition at line 536 of file service.c.

Here is the caller graph for this function:

◆ m0_cas_svc_init()

M0_INTERNAL void m0_cas_svc_init ( void  )

CAS server side is able to compile in user-space only. Use stubs in kernel mode for service initialisation and deinitalisation. Also use NULLs for service-specific fields in CAS FOP types.

Definition at line 515 of file service.c.

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

◆ m0_crv_cmp()

M0_INTERNAL int m0_crv_cmp ( const struct m0_crv left,
const struct m0_crv right 
)

Compare two versions. Note, tombstones are checked at the end which means that if there are two different operations with the same version (for example, PUT@10 and DEL@10) then the operation that sets the tombstone (DEL@10) is always considered to be "newer" than the other one. It helps to ensure operations have the same order on any server despite the order of execution.

Definition at line 275 of file cas.c.

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

◆ m0_crv_init()

M0_INTERNAL void m0_crv_init ( struct m0_crv crv,
const struct m0_dtm0_ts ts,
bool  tbs 
)

Definition at line 251 of file cas.c.

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

◆ m0_crv_is_none()

M0_INTERNAL bool m0_crv_is_none ( const struct m0_crv crv)

Definition at line 282 of file cas.c.

Here is the caller graph for this function:

◆ m0_crv_tbs()

M0_INTERNAL bool m0_crv_tbs ( const struct m0_crv crv)

Definition at line 225 of file cas.c.

Here is the caller graph for this function:

◆ m0_crv_tbs_set()

M0_INTERNAL void m0_crv_tbs_set ( struct m0_crv crv,
bool  tbs 
)

Definition at line 230 of file cas.c.

Here is the caller graph for this function:

◆ m0_crv_ts()

M0_INTERNAL struct m0_dtm0_ts m0_crv_ts ( const struct m0_crv crv)

Definition at line 238 of file cas.c.

Here is the caller graph for this function:

◆ m0_crv_ts_set()

M0_INTERNAL void m0_crv_ts_set ( struct m0_crv crv,
const struct m0_dtm0_ts ts 
)

Definition at line 245 of file cas.c.

Here is the caller graph for this function:

◆ M0_XCA_DOMAIN() [1/2]

struct m0_cas_hint M0_XCA_DOMAIN ( rpc  )

◆ M0_XCA_DOMAIN() [2/2]

struct m0_crv M0_XCA_DOMAIN ( rpc|  be)

Variable Documentation

◆ cas_cur_fopt

M0_EXTERN struct m0_fop_type cas_cur_fopt

Definition at line 444 of file cas.h.

◆ cas_del_fopt

M0_EXTERN struct m0_fop_type cas_del_fopt

Definition at line 443 of file cas.h.

◆ cas_gc_fopt

M0_EXTERN struct m0_fop_type cas_gc_fopt

Definition at line 446 of file cas.h.

◆ cas_get_fopt

M0_EXTERN struct m0_fop_type cas_get_fopt

Definition at line 441 of file cas.h.

◆ cas_put_fopt

M0_EXTERN struct m0_fop_type cas_put_fopt

Definition at line 442 of file cas.h.

◆ cas_rep_fopt

M0_EXTERN struct m0_fop_type cas_rep_fopt

Definition at line 445 of file cas.h.

◆ m0_cas_ctidx_fid

M0_EXTERN const struct m0_fid m0_cas_ctidx_fid

Definition at line 436 of file cas.h.

◆ m0_cas_dead_index_fid

M0_EXTERN const struct m0_fid m0_cas_dead_index_fid

Definition at line 435 of file cas.h.

◆ m0_cas_index_fid_type

M0_EXTERN const struct m0_fid_type m0_cas_index_fid_type

Definition at line 437 of file cas.h.

◆ m0_cas_meta_fid

M0_EXTERN const struct m0_fid m0_cas_meta_fid

Definition at line 434 of file cas.h.

◆ m0_cas_service_type

M0_EXTERN struct m0_reqh_service_type m0_cas_service_type

Definition at line 433 of file cas.h.

◆ m0_cctg_fid_type

M0_EXTERN const struct m0_fid_type m0_cctg_fid_type

Definition at line 439 of file cas.h.

◆ m0_dix_fid_type

M0_EXTERN const struct m0_fid_type m0_dix_fid_type

Definition at line 438 of file cas.h.

◆ m0_fop_fsync_cas_fopt

struct m0_fop_type m0_fop_fsync_cas_fopt

Definition at line 53 of file cas.c.

◆ M0_XCA_DOMAIN

enum { ... } M0_XCA_DOMAIN

◆ M0_XCA_ENUM

enum m0_cas_type M0_XCA_ENUM