Motr  M0
Cas-ctg-store

Data Structures

struct  m0_cas_ctg
 
struct  m0_cas_state
 
struct  m0_ctg_op
 

Macros

#define CTG_OP_COMBINE(opc, ct)   (((uint64_t)(opc)) | ((ct) << 16))
 

Enumerations

enum  m0_cas_ctg_format_version { M0_CAS_CTG_FORMAT_VERSION_1 = 1, M0_CAS_CTG_FORMAT_VERSION_2, M0_CAS_CTG_FORMAT_VERSION = M0_CAS_CTG_FORMAT_VERSION_2 }
 
enum  m0_cas_state_format_version { M0_CAS_STATE_FORMAT_VERSION_1 = 1, M0_CAS_STATE_FORMAT_VERSION = M0_CAS_STATE_FORMAT_VERSION_1 }
 
enum  { M0_CAS_CTG_VAL_HDR_SIZE = sizeof(uint64_t) + sizeof(uint64_t), M0_CAS_CTG_KEY_HDR_SIZE = sizeof(uint64_t) }
 

Functions

struct m0_cas_ctg M0_XCA_DOMAIN (be)
 
M0_INTERNAL int m0_ctg_store_init (struct m0_be_domain *dom)
 
M0_INTERNAL void m0_ctg_store_fini (void)
 
M0_INTERNAL struct m0_cas_ctgm0_ctg_meta (void)
 
M0_INTERNAL struct m0_cas_ctgm0_ctg_dead_index (void)
 
M0_INTERNAL struct m0_cas_ctgm0_ctg_ctidx (void)
 
M0_INTERNAL void m0_ctg_op_init (struct m0_ctg_op *ctg_op, struct m0_fom *fom, uint32_t flags)
 
M0_INTERNAL int m0_ctg_op_rc (struct m0_ctg_op *ctg_op)
 
M0_INTERNAL void m0_ctg_op_fini (struct m0_ctg_op *ctg_op)
 
M0_INTERNAL int m0_ctg_meta_insert (struct m0_ctg_op *ctg_op, const struct m0_fid *fid, int next_phase)
 
M0_INTERNAL int m0_ctg_gc_wait (struct m0_ctg_op *ctg_op, int next_phase)
 
M0_INTERNAL int m0_ctg_dead_index_insert (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, int next_phase)
 
M0_INTERNAL int m0_ctg_meta_lookup (struct m0_ctg_op *ctg_op, const struct m0_fid *fid, int next_phase)
 
M0_INTERNAL struct m0_cas_ctgm0_ctg_meta_lookup_result (struct m0_ctg_op *ctg_op)
 
M0_INTERNAL int m0_ctg_meta_delete (struct m0_ctg_op *ctg_op, const struct m0_fid *fid, int next_phase)
 
M0_INTERNAL int m0_ctg_insert (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, const struct m0_buf *key, const struct m0_buf *val, int next_phase)
 
M0_INTERNAL int m0_ctg_lookup_delete (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, const struct m0_buf *key, struct m0_buf *val, int flags, int next_phase)
 
M0_INTERNAL int m0_ctg_delete (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, const struct m0_buf *key, int next_phase)
 
M0_INTERNAL int m0_ctg_lookup (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, const struct m0_buf *key, int next_phase)
 
M0_INTERNAL void m0_ctg_lookup_result (struct m0_ctg_op *ctg_op, struct m0_buf *buf)
 
M0_INTERNAL void m0_ctg_op_get_ver (struct m0_ctg_op *ctg_op, struct m0_crv *out)
 
M0_INTERNAL int m0_ctg_minkey (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, int next_phase)
 
M0_INTERNAL int m0_ctg_truncate (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, m0_bcount_t limit, int next_phase)
 
M0_INTERNAL int m0_ctg_drop (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, int next_phase)
 
M0_INTERNAL void m0_ctg_meta_cursor_init (struct m0_ctg_op *ctg_op)
 
M0_INTERNAL int m0_ctg_meta_cursor_get (struct m0_ctg_op *ctg_op, const struct m0_fid *fid, int next_phase)
 
M0_INTERNAL int m0_ctg_meta_cursor_next (struct m0_ctg_op *ctg_op, int next_phase)
 
M0_INTERNAL void m0_ctg_cursor_init (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg)
 
M0_INTERNAL bool m0_ctg_cursor_is_initialised (struct m0_ctg_op *ctg_op)
 
M0_INTERNAL int m0_ctg_cursor_get (struct m0_ctg_op *ctg_op, const struct m0_buf *key, int next_phase)
 
M0_INTERNAL int m0_ctg_cursor_next (struct m0_ctg_op *ctg_op, int next_phase)
 
M0_INTERNAL void m0_ctg_cursor_kv_get (struct m0_ctg_op *ctg_op, struct m0_buf *key, struct m0_buf *val)
 
M0_INTERNAL void m0_ctg_cursor_put (struct m0_ctg_op *ctg_op)
 
M0_INTERNAL void m0_ctg_cursor_fini (struct m0_ctg_op *ctg_op)
 
M0_INTERNAL void m0_ctg_insert_credit (struct m0_cas_ctg *ctg, m0_bcount_t knob, m0_bcount_t vnob, struct m0_be_tx_credit *accum)
 
M0_INTERNAL void m0_ctg_delete_credit (struct m0_cas_ctg *ctg, m0_bcount_t knob, m0_bcount_t vnob, struct m0_be_tx_credit *accum)
 
M0_INTERNAL void m0_ctg_ctidx_insert_credits (struct m0_cas_id *cid, struct m0_be_tx_credit *accum)
 
M0_INTERNAL void m0_ctg_drop_credit (struct m0_fom *fom, struct m0_be_tx_credit *accum, struct m0_cas_ctg *ctg, m0_bcount_t *limit)
 
M0_INTERNAL void m0_ctg_try_init (struct m0_cas_ctg *ctg)
 
M0_INTERNAL void m0_ctg_fini (struct m0_fom *fom0, struct m0_cas_ctg *ctg)
 
M0_INTERNAL void m0_ctg_mark_deleted_credit (struct m0_be_tx_credit *accum)
 
M0_INTERNAL void m0_ctg_create_credit (struct m0_be_tx_credit *accum)
 
M0_INTERNAL void m0_ctg_dead_clean_credit (struct m0_be_tx_credit *accum)
 
M0_INTERNAL void m0_ctg_ctidx_delete_credits (struct m0_cas_id *cid, struct m0_be_tx_credit *accum)
 
M0_INTERNAL int m0_ctg_ctidx_insert_sync (const struct m0_cas_id *cid, struct m0_be_tx *tx)
 
M0_INTERNAL int m0_ctg_ctidx_delete_sync (const struct m0_cas_id *cid, struct m0_be_tx *tx)
 
M0_INTERNAL int m0_ctg_ctidx_lookup_sync (const struct m0_fid *fid, struct m0_dix_layout **layout)
 
M0_INTERNAL int m0_ctg_mem_place (struct m0_ctg_op *ctg_op, const struct m0_buf *buf, int next_phase)
 
M0_INTERNAL void m0_ctg_mem_place_get (struct m0_ctg_op *ctg_op, struct m0_buf *buf)
 
M0_INTERNAL int m0_ctg_mem_free (struct m0_ctg_op *ctg_op, void *area, int next_phase)
 
M0_INTERNAL uint64_t m0_ctg_rec_nr (void)
 
M0_INTERNAL uint64_t m0_ctg_rec_size (void)
 
M0_INTERNAL struct m0_long_lockm0_ctg_del_lock (void)
 
M0_INTERNAL struct m0_long_lockm0_ctg_lock (struct m0_cas_ctg *ctg)
 
M0_INTERNAL int m0_ctg_create (struct m0_be_seg *seg, struct m0_be_tx *tx, struct m0_cas_ctg **out, const struct m0_fid *cas_fid)
 
M0_INTERNAL int m0_ctg__meta_insert (struct m0_be_btree *meta, const struct m0_fid *fid, struct m0_cas_ctg *ctg, struct m0_be_tx *tx)
 
M0_INTERNAL int m0_ctg_meta_find_ctg (struct m0_cas_ctg *meta, const struct m0_fid *ctg_fid, struct m0_cas_ctg **ctg)
 
M0_INTERNAL const struct m0_be_btree_kv_opsm0_ctg_btree_ops (void)
 
M0_INTERNAL void m0_ctg_state_inc_update (struct m0_be_tx *tx, uint64_t size)
 
M0_INTERNAL int ctgdump (struct m0_motr *motr_ctx, char *fidstr, char *dump_in_hex_str)
 

Variables

enum m0_cas_ctg_format_version M0_XCA_DOMAIN
 

Detailed Description

CAS catalogue store provides an interface to operate with catalogues. It's a thin layer that hides B-tree implementation details. Most of operations are asynchronous. For usability CAS catalogue store provides separate interfaces for operations over meta, catalogue-index and catalogues created by user.

Note
All operations over catalogue-index catalogue are synchronous.

For now CAS catalogue store has two users: CAS service and DIX repair/rebalance service.

Note
CAS catalogue store is a singleton in scope of single process. Every user of CAS catalogue store must call m0_ctg_store_init() to initialize static inner structures if the user needs this store to operate. This call is thread-safe. If catalogue store is already initialized then m0_ctg_store_init() does nothing but incrementing inner reference counter.

Every user of CAS catalogue store must call m0_ctg_store_fini() if it does not need this store anymore. This call is thread-safe. When m0_ctg_store_fini() is called the inner reference counter is atomically decremented. If the last user of CAS catalogue store calls m0_ctg_store_fini() then release of CAS catalogue store inner structures is initiated.

*
*     +-----------------+            +------------------+
*     |                 |            |       DIX        |
*     |   CAS Service   |            | repair/rebalance |
*     |                 |            |     service      |
*     +-----------------+            +------------------+
*              |                              |
*              +-----------+      +-----------+
*                          |      |
*                          |      |
*                          V      V
*                    +------------------+
*                    |       CAS        |
*                    |    catalogue     |
*                    |      store       |
*                    +------------------+
*
* 

The interface of CAS catalogue store is FOM-oriented. For operations that may be done asynchronous the next phase of FOM should be provided. Corresponding functions return the result that shows whether the FOM should wait or can continue immediately. Every user should take care about locking of CAS catalogues.

Macro Definition Documentation

◆ CTG_OP_COMBINE

#define CTG_OP_COMBINE (   opc,
  ct 
)    (((uint64_t)(opc)) | ((ct) << 16))

Definition at line 241 of file ctg_store.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
M0_CAS_CTG_VAL_HDR_SIZE 

Every value has a header that holds its size and the version of the key-value record.

M0_CAS_CTG_KEY_HDR_SIZE 

Every key has a header that holds the size of the key.

Definition at line 141 of file ctg_store.h.

◆ m0_cas_ctg_format_version

Enumerator
M0_CAS_CTG_FORMAT_VERSION_1 
M0_CAS_CTG_FORMAT_VERSION_2 
M0_CAS_CTG_FORMAT_VERSION 

Current version, should point to the latest version present

Definition at line 115 of file ctg_store.h.

◆ m0_cas_state_format_version

Enumerator
M0_CAS_STATE_FORMAT_VERSION_1 
M0_CAS_STATE_FORMAT_VERSION 

Current version, should point to the latest version present

Definition at line 130 of file ctg_store.h.

Function Documentation

◆ ctgdump()

M0_INTERNAL int ctgdump ( struct m0_motr motr_ctx,
char *  fidstr,
char *  dump_in_hex_str 
)

Definition at line 2235 of file ctg_store.c.

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

◆ m0_ctg__meta_insert()

M0_INTERNAL int m0_ctg__meta_insert ( struct m0_be_btree meta,
const struct m0_fid fid,
struct m0_cas_ctg ctg,
struct m0_be_tx tx 
)

Insert record into meta catalogue.

Definition at line 528 of file ctg_store.c.

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

◆ m0_ctg_btree_ops()

M0_INTERNAL const struct m0_be_btree_kv_ops* m0_ctg_btree_ops ( void  )

Get btree ops for ctg tree.

Definition at line 2167 of file ctg_store.c.

Here is the caller graph for this function:

◆ m0_ctg_create()

M0_INTERNAL int m0_ctg_create ( struct m0_be_seg seg,
struct m0_be_tx tx,
struct m0_cas_ctg **  out,
const struct m0_fid cas_fid 
)

Creates catalogue store on the segment.

Definition at line 441 of file ctg_store.c.

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

◆ m0_ctg_create_credit()

M0_INTERNAL void m0_ctg_create_credit ( struct m0_be_tx_credit accum)

Calculates credits necessary to allocate new catalogue and add it to the meta catalogue.

Definition at line 1823 of file ctg_store.c.

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

◆ m0_ctg_ctidx()

M0_INTERNAL struct m0_cas_ctg* m0_ctg_ctidx ( void  )

Returns a pointer to catalogue-index catalogue context.

Definition at line 2135 of file ctg_store.c.

Here is the caller graph for this function:

◆ m0_ctg_ctidx_delete_credits()

M0_INTERNAL void m0_ctg_ctidx_delete_credits ( struct m0_cas_id cid,
struct m0_be_tx_credit accum 
)

Calculates credits for deletion from catalogue-index catalogue.

Parameters
accumAccumulated credits.

Definition at line 1971 of file ctg_store.c.

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

◆ m0_ctg_ctidx_delete_sync()

M0_INTERNAL int m0_ctg_ctidx_delete_sync ( const struct m0_cas_id cid,
struct m0_be_tx tx 
)

Synchronous record deletion from catalogue-index catalogue.

Parameters
cidCAS ID containing FID/layout to be deleted.
txBE transaction.

0 on success or negative error code.

Todo:
Make it asynchronous.
Todo:
Make it asynchronous.

Definition at line 2060 of file ctg_store.c.

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

◆ m0_ctg_ctidx_insert_credits()

M0_INTERNAL void m0_ctg_ctidx_insert_credits ( struct m0_cas_id cid,
struct m0_be_tx_credit accum 
)

Calculates credits for insertion into catalogue-index catalogue.

Parameters
accumAccumulated credits.

Definition at line 1962 of file ctg_store.c.

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

◆ m0_ctg_ctidx_insert_sync()

M0_INTERNAL int m0_ctg_ctidx_insert_sync ( const struct m0_cas_id cid,
struct m0_be_tx tx 
)

Synchronous record insertion into catalogue-index catalogue.

Parameters
cidCAS ID containing FID/layout to be inserted.
txBE transaction.

0 on success or negative error code.

Todo:
Make it asynchronous.
Todo:
Make it asynchronous.

Definition at line 2010 of file ctg_store.c.

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

◆ m0_ctg_ctidx_lookup_sync()

M0_INTERNAL int m0_ctg_ctidx_lookup_sync ( const struct m0_fid fid,
struct m0_dix_layout **  layout 
)

Synchronous record lookup in catalogue-index catalogue.

Parameters
[in]fidFID of component catalogue.
[out]layoutLayout of index which component catalogue with FID belongs to.

0 on success or negative error code.

Todo:
Make it asynchronous.

Definition at line 1980 of file ctg_store.c.

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

◆ m0_ctg_cursor_fini()

M0_INTERNAL void m0_ctg_cursor_fini ( struct m0_ctg_op ctg_op)

Finalises catalogue cursor.

Parameters
ctg_opCatalogue operation context.

Definition at line 1749 of file ctg_store.c.

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

◆ m0_ctg_cursor_get()

M0_INTERNAL int m0_ctg_cursor_get ( struct m0_ctg_op ctg_op,
const struct m0_buf key,
int  next_phase 
)

Positions cursor on record with key . Should be called after m0_ctg_cursor_init().

Parameters
ctg_opCatalogue operation context.
keyKey for cursor positioning.
next_phaseNext phase of caller FOM.
See also
m0_ctg_cursor_init()

Definition at line 1660 of file ctg_store.c.

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

◆ m0_ctg_cursor_init()

M0_INTERNAL void m0_ctg_cursor_init ( struct m0_ctg_op ctg_op,
struct m0_cas_ctg ctg 
)

Initialises cursor for catalogue .

Note
Passed catalogue operation must be initialised using m0_ctg_op_init() before calling of this function.
Parameters
ctg_opCatalogue operation context.
ctgCatalogue context.

Definition at line 1640 of file ctg_store.c.

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

◆ m0_ctg_cursor_is_initialised()

M0_INTERNAL bool m0_ctg_cursor_is_initialised ( struct m0_ctg_op ctg_op)

Checks whether catalogue cursor is initialised.

Parameters
ctg_opCatalogue operation context.
See also
m0_ctg_meta_cursor_init()
m0_ctg_cursor_init()

Definition at line 1633 of file ctg_store.c.

Here is the caller graph for this function:

◆ m0_ctg_cursor_kv_get()

M0_INTERNAL void m0_ctg_cursor_kv_get ( struct m0_ctg_op ctg_op,
struct m0_buf key,
struct m0_buf val 
)

Gets current key/value under cursor.

Note
Key/value data pointers are set to actual record placed in tree.
Parameters
[in]ctg_opCatalogue operation context.
[out]keyKey buffer.
[out]valValue buffer.

Definition at line 1708 of file ctg_store.c.

Here is the caller graph for this function:

◆ m0_ctg_cursor_next()

M0_INTERNAL int m0_ctg_cursor_next ( struct m0_ctg_op ctg_op,
int  next_phase 
)

Moves catalogue cursor to the next record.

Parameters
ctg_opCatalogue operation context.
next_phaseNext phase of caller FOM.

Definition at line 1680 of file ctg_store.c.

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

◆ m0_ctg_cursor_put()

M0_INTERNAL void m0_ctg_cursor_put ( struct m0_ctg_op ctg_op)

Releases catalogue cursor, should be called before m0_ctg_cursor_fini().

Parameters
ctg_opCatalogue operation context.
See also
m0_ctg_cursor_fini()

Definition at line 1744 of file ctg_store.c.

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

◆ m0_ctg_dead_clean_credit()

M0_INTERNAL void m0_ctg_dead_clean_credit ( struct m0_be_tx_credit accum)

Calculates credits necessary to delete catalogue from "dead index" catalogue and to deallocate it.

Definition at line 1887 of file ctg_store.c.

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

◆ m0_ctg_dead_index()

M0_INTERNAL struct m0_cas_ctg* m0_ctg_dead_index ( void  )

Returns a pointer to "dead index" catalogue context.

Definition at line 2140 of file ctg_store.c.

Here is the caller graph for this function:

◆ m0_ctg_dead_index_insert()

M0_INTERNAL int m0_ctg_dead_index_insert ( struct m0_ctg_op ctg_op,
struct m0_cas_ctg ctg,
int  next_phase 
)

Inserts 'ctg' into "dead index" catalogue, therefore scheduling 'ctg' for deletion by index garbage collector.

Parameters
ctg_opCatalogue operation context.
ctgCatalogue to be inserted in "dead index" catalogue.
next_phaseNext phase of caller FOM.

Definition at line 1405 of file ctg_store.c.

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

◆ m0_ctg_del_lock()

M0_INTERNAL struct m0_long_lock* m0_ctg_del_lock ( void  )

Returns a reference to the catalogue store "delete" long lock.

This lock is used to protect DIX CM iterator current record from concurrent deletion by the client. Iterator holds this lock when some record is in processing and releases it when this record is fully processed, i.e. when a reply from remote copy machine is received. See dix/client.h, "Operation in degraded mode" for more info.

Theoretically, catalogue lock m0_cas_ctg::cc_lock may be used for this purpose, but it leads to a deadlock during repair in the following case: Node 1 Node 2 Iterator gets the catalogue lock Iterator gets the catalogue lock Iterator sends the record to Node 2 Iterator sends the record to Node 1 Iterator waits for a reply Iterator waits for a reply Copy packet foms on both nodes have no chance to insert incoming record into local catalogue, because the catalogue lock is held by the iterator.

This lock is also used exactly the same way when client deletes the whole catalogue in degraded mode.

Definition at line 2157 of file ctg_store.c.

Here is the caller graph for this function:

◆ m0_ctg_delete()

M0_INTERNAL int m0_ctg_delete ( struct m0_ctg_op ctg_op,
struct m0_cas_ctg ctg,
const struct m0_buf key,
int  next_phase 
)

Deletes a key/value record from catalogue.

Note
Key is copied before execution of operation, user does not need to keep it since this function is called.
Parameters
ctg_opCatalogue operation context.
ctgContext of catalogue for record deletion.
keyKey of record to be inserted.
next_phaseNext phase of caller FOM.

M0_FSO_AGAIN or M0_FSO_WAIT.

Definition at line 1540 of file ctg_store.c.

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

◆ m0_ctg_delete_credit()

M0_INTERNAL void m0_ctg_delete_credit ( struct m0_cas_ctg ctg,
m0_bcount_t  knob,
m0_bcount_t  vnob,
struct m0_be_tx_credit accum 
)

Calculates credits for deletion of record from catalogue.

Parameters
ctgCatalogue context.
knobKey length.
knobValue length.
accumAccumulated credits.

Definition at line 1913 of file ctg_store.c.

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

◆ m0_ctg_drop()

M0_INTERNAL int m0_ctg_drop ( struct m0_ctg_op ctg_op,
struct m0_cas_ctg ctg,
int  next_phase 
)

Destroys B-tree associated with a catalogue. B-tree should be empty.

Definition at line 1620 of file ctg_store.c.

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

◆ m0_ctg_drop_credit()

M0_INTERNAL void m0_ctg_drop_credit ( struct m0_fom fom,
struct m0_be_tx_credit accum,
struct m0_cas_ctg ctg,
m0_bcount_t limit 
)

Calculates credits for destroying catalogue records.

If it's not possible to destroy the catalogue in one BE transaction, then 'accum' contains credits that are necessary to delete 'limit' number of records. 'limit' is a maximum number of records that can be deleted in one BE transaction.

Take only a half of maximum number of credits, and rely on the number of credits for nodes which has to be less than number of credits for the records to be deleted. So that we leave the room for the credits required for nodes deletion.

Credits for all nodes are being calculated inside m0_be_btree_clear_credit(). This is too much and can exceed allowed credits limit. Here, all nodes credits are being adjusted respectively to the number of records used during deletion (records_ok). Statistically the number of node credits after such adjustment has to be reasonable. In general, the following relation is fair: deleted_nodes_nr / all_nodes_nr == records_ok / records_nr.

Definition at line 1841 of file ctg_store.c.

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

◆ m0_ctg_fini()

M0_INTERNAL void m0_ctg_fini ( struct m0_fom fom0,
struct m0_cas_ctg ctg 
)

Finalises and deallocates the catalogue.

Should be called after m0_ctg_drop().

Definition at line 479 of file ctg_store.c.

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

◆ m0_ctg_gc_wait()

M0_INTERNAL int m0_ctg_gc_wait ( struct m0_ctg_op ctg_op,
int  next_phase 
)

Forces FOM to wait until index garbage collector removes all catalogues pending for deletion in "dead index" catalogue. After garbage collector is done, FOM is waked up in the 'next_phase' phase.

Parameters
ctg_opCatalogue operation context.
next_phaseNext phase of caller FOM.

M0_FSO_AGAIN or M0_FSO_WAIT.

Definition at line 1349 of file ctg_store.c.

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

◆ m0_ctg_insert()

M0_INTERNAL int m0_ctg_insert ( struct m0_ctg_op ctg_op,
struct m0_cas_ctg ctg,
const struct m0_buf key,
const struct m0_buf val,
int  next_phase 
)

Inserts a key/value record into catalogue.

Note
Value itself is not copied inside of this function, user should keep it until operation is complete. Key is copied before operation execution, user does not need to keep it since this function is called.
Parameters
ctg_opCatalogue operation context.
ctgContext of catalogue for record insertion.
keyKey to be inserted.
valValue to be inserted.
next_phaseNext phase of caller FOM.

M0_FSO_AGAIN or M0_FSO_WAIT.

Definition at line 1448 of file ctg_store.c.

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

◆ m0_ctg_insert_credit()

M0_INTERNAL void m0_ctg_insert_credit ( struct m0_cas_ctg ctg,
m0_bcount_t  knob,
m0_bcount_t  vnob,
struct m0_be_tx_credit accum 
)

Calculates credits for insertion of record into catalogue.

Parameters
ctgCatalogue context.
knobKey length.
knobValue length.
accumAccumulated credits.

Definition at line 1905 of file ctg_store.c.

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

◆ m0_ctg_lock()

M0_INTERNAL struct m0_long_lock* m0_ctg_lock ( struct m0_cas_ctg ctg)

Returns a reference to the catalogue long lock. This accessor hides internal representation of the long lock, because it needs to be padded.

Definition at line 2162 of file ctg_store.c.

Here is the caller graph for this function:

◆ m0_ctg_lookup()

M0_INTERNAL int m0_ctg_lookup ( struct m0_ctg_op ctg_op,
struct m0_cas_ctg ctg,
const struct m0_buf key,
int  next_phase 
)

Looks up a key/value record in catalogue.

Note
Key is copied before execution of operation, user does not need to keep it since this function is called.
Parameters
ctg_opCatalogue operation context.
ctgContext of catalogue for record looking up.
keyKey of record to be looked up.
next_phaseNext phase of caller FOM.

M0_FSO_AGAIN or M0_FSO_WAIT.

Definition at line 1555 of file ctg_store.c.

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

◆ m0_ctg_lookup_delete()

M0_INTERNAL int m0_ctg_lookup_delete ( struct m0_ctg_op ctg_op,
struct m0_cas_ctg ctg,
const struct m0_buf key,
struct m0_buf val,
int  flags,
int  next_phase 
)

Performs lookup of value by key in the catalogue, saves it and then proceeds as normal delete.

Note
Key is copied before execution of operation, user does not need to keep it when this function is called.
Parameters
ctg_opCatalogue operation context.
ctgContext of catalogue for record deletion.
keyKey of record to be deleted.
valSaved value of record to be deleted.
flagsCas op flags from cas_op(fom0)->cg_flags
next_phaseNext phase of caller FOM.

M0_FSO_AGAIN or M0_FSO_WAIT.

Definition at line 1465 of file ctg_store.c.

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

◆ m0_ctg_lookup_result()

M0_INTERNAL void m0_ctg_lookup_result ( struct m0_ctg_op ctg_op,
struct m0_buf buf 
)

Gets lookup result.

Note
Returned pointer is a pointer to original value placed in tree.
Parameters
[in]ctg_opCatalogue operation context.
[out]bufBuffer for value.

Definition at line 1570 of file ctg_store.c.

Here is the caller graph for this function:

◆ m0_ctg_mark_deleted_credit()

M0_INTERNAL void m0_ctg_mark_deleted_credit ( struct m0_be_tx_credit accum)

Calculates credits necessary to move catalogue to "dead index" catalogue.

Definition at line 1805 of file ctg_store.c.

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

◆ m0_ctg_mem_free()

M0_INTERNAL int m0_ctg_mem_free ( struct m0_ctg_op ctg_op,
void *  area,
int  next_phase 
)

Definition at line 2117 of file ctg_store.c.

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

◆ m0_ctg_mem_place()

M0_INTERNAL int m0_ctg_mem_place ( struct m0_ctg_op ctg_op,
const struct m0_buf buf,
int  next_phase 
)

Definition at line 2090 of file ctg_store.c.

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

◆ m0_ctg_mem_place_get()

M0_INTERNAL void m0_ctg_mem_place_get ( struct m0_ctg_op ctg_op,
struct m0_buf buf 
)

Definition at line 2105 of file ctg_store.c.

Here is the caller graph for this function:

◆ m0_ctg_meta()

M0_INTERNAL struct m0_cas_ctg* m0_ctg_meta ( void  )

Returns a pointer to meta catalogue context.

Definition at line 2130 of file ctg_store.c.

Here is the caller graph for this function:

◆ m0_ctg_meta_cursor_get()

M0_INTERNAL int m0_ctg_meta_cursor_get ( struct m0_ctg_op ctg_op,
const struct m0_fid fid,
int  next_phase 
)

Positions cursor on catalogue with FID . Should be called after m0_ctg_meta_cursor_init().

Parameters
ctg_opCatalogue operation context.
fidFID of catalogue for cursor positioning.
next_phaseNext phase of caller FOM.
See also
m0_ctg_meta_cursor_init()

Definition at line 1729 of file ctg_store.c.

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

◆ m0_ctg_meta_cursor_init()

M0_INTERNAL void m0_ctg_meta_cursor_init ( struct m0_ctg_op ctg_op)

Initialises cursor for meta catalogue.

Note
Passed catalogue operation must be initialised using m0_ctg_op_init() before calling of this function.
Parameters
ctg_opCatalogue operation context.

Definition at line 1722 of file ctg_store.c.

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

◆ m0_ctg_meta_cursor_next()

M0_INTERNAL int m0_ctg_meta_cursor_next ( struct m0_ctg_op ctg_op,
int  next_phase 
)

Moves meta catalogue cursor to the next record.

Parameters
ctg_opCatalogue operation context.
next_phaseNext phase of caller FOM.

Definition at line 1694 of file ctg_store.c.

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

◆ m0_ctg_meta_delete()

M0_INTERNAL int m0_ctg_meta_delete ( struct m0_ctg_op ctg_op,
const struct m0_fid fid,
int  next_phase 
)

Deletes a catalogue from meta catalogue.

Parameters
ctg_opCatalogue operation context.
fidFID of catalogue to be deleted.
next_phaseNext phase of caller FOM.

M0_FSO_AGAIN or M0_FSO_WAIT.

Definition at line 1392 of file ctg_store.c.

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

◆ m0_ctg_meta_find_ctg()

M0_INTERNAL int m0_ctg_meta_find_ctg ( struct m0_cas_ctg meta,
const struct m0_fid ctg_fid,
struct m0_cas_ctg **  ctg 
)

Find the catalogue store pointer from meta catalogue.

Lookup catalogue with provided fid in meta-catalogue synchronously.

Definition at line 503 of file ctg_store.c.

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

◆ m0_ctg_meta_insert()

M0_INTERNAL int m0_ctg_meta_insert ( struct m0_ctg_op ctg_op,
const struct m0_fid fid,
int  next_phase 
)

Creates a new catalogue context and inserts it into meta catalogue.

Parameters
ctg_opCatalogue operation context.
fidFID of catalogue to be created and inserted into meta catalogue.
next_phaseNext phase of caller FOM.

M0_FSO_AGAIN or M0_FSO_WAIT.

Definition at line 1336 of file ctg_store.c.

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

◆ m0_ctg_meta_lookup()

M0_INTERNAL int m0_ctg_meta_lookup ( struct m0_ctg_op ctg_op,
const struct m0_fid fid,
int  next_phase 
)

Looks up a catalogue in meta catalogue.

Parameters
ctg_opCatalogue operation context.
fidFID of catalogue to be looked up.
next_phaseNext phase of caller FOM.

M0_FSO_AGAIN or M0_FSO_WAIT.

Definition at line 1362 of file ctg_store.c.

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

◆ m0_ctg_meta_lookup_result()

M0_INTERNAL struct m0_cas_ctg* m0_ctg_meta_lookup_result ( struct m0_ctg_op ctg_op)

Gets a pointer to catalogue context that was looked up.

Definition at line 1377 of file ctg_store.c.

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

◆ m0_ctg_minkey()

M0_INTERNAL int m0_ctg_minkey ( struct m0_ctg_op ctg_op,
struct m0_cas_ctg ctg,
int  next_phase 
)

Gets the minimal key in the tree (wrapper over m0_be_btree_minkey()).

After operation complete min key value is in ctg_op->co_out_key.

Parameters
ctg_opCatalogue operation context. ctg Catalogue descriptor.
next_phaseNext phase of caller FOM.

M0_FSO_AGAIN or M0_FSO_WAIT.

Definition at line 1593 of file ctg_store.c.

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

◆ m0_ctg_op_fini()

M0_INTERNAL void m0_ctg_op_fini ( struct m0_ctg_op ctg_op)

Finalises catalogue operation.

Parameters
ctg_opCatalogue operation context.

Definition at line 1788 of file ctg_store.c.

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

◆ m0_ctg_op_get_ver()

M0_INTERNAL void m0_ctg_op_get_ver ( struct m0_ctg_op ctg_op,
struct m0_crv out 
)

Returns the version of the record the operation ctg_op worked on.

Definition at line 1582 of file ctg_store.c.

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

◆ m0_ctg_op_init()

M0_INTERNAL void m0_ctg_op_init ( struct m0_ctg_op ctg_op,
struct m0_fom fom,
uint32_t  flags 
)

Initialises catalogue operation.

Note
Catalogue operation must be initialised before executing of any operation on catalogues but getting lookup/cursor results and moving of cursor.
Parameters
ctg_opCatalogue operation context.
fomFOM that needs to execute catalogue operation.
flagsCatalogue operation flags.

Definition at line 1759 of file ctg_store.c.

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

◆ m0_ctg_op_rc()

M0_INTERNAL int m0_ctg_op_rc ( struct m0_ctg_op ctg_op)

Gets result code of executed catalogue operation.

Parameters
ctg_opCatalogue operation context.

Result code of executed catalogue operation.

Definition at line 1779 of file ctg_store.c.

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

◆ m0_ctg_rec_nr()

M0_INTERNAL uint64_t m0_ctg_rec_nr ( void  )

Total number of records in catalogue store in all user (non-meta) catalogues.

Definition at line 2145 of file ctg_store.c.

Here is the caller graph for this function:

◆ m0_ctg_rec_size()

M0_INTERNAL uint64_t m0_ctg_rec_size ( void  )

Total size of records in catalogue store in all user (non-meta) catalogues.

Definition at line 2151 of file ctg_store.c.

Here is the caller graph for this function:

◆ m0_ctg_state_inc_update()

M0_INTERNAL void m0_ctg_state_inc_update ( struct m0_be_tx tx,
uint64_t  size 
)

Update number of records and record size in cas state.

Definition at line 940 of file ctg_store.c.

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

◆ m0_ctg_store_fini()

M0_INTERNAL void m0_ctg_store_fini ( void  )

Releases one reference to catalogue store context. If the last reference is released then actual finalisation will be done.

Note
Every user of catalogue store must call this function.
See also
m0_ctg_store_init()

Definition at line 870 of file ctg_store.c.

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

◆ m0_ctg_store_init()

M0_INTERNAL int m0_ctg_store_init ( struct m0_be_domain dom)

Initialises catalogue store.

Note
Every user of catalogue store must call this function as catalogue store is a singleton and initialisation function may be called many times from different threads: the first call does actual initialisation, following calls does nothing but returning 0.

Firstly the function looks up into BE segment dictionary for meta catalogue. There are three cases:

  1. Meta catalogue is presented.
  2. meta catalogue is not presented.
  3. An error occurred.

In the first case the function looks up into meta catalogue for catalogue-index catalogue. If it is not presented or some error occurred then an error returned.

Note
Both meta catalogue and catalogue-index catalogue must be presented. In the second case the function creates meta catalogue, creates catalogue-index catalogue and inserts catalogue-index context into meta catalogue. In the third case an error returned.

0 on success or negative error code.

Todo:
Use 0type.
Todo:
Add checking, use header and footer.

Definition at line 814 of file ctg_store.c.

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

◆ m0_ctg_truncate()

M0_INTERNAL int m0_ctg_truncate ( struct m0_ctg_op ctg_op,
struct m0_cas_ctg ctg,
m0_bcount_t  limit,
int  next_phase 
)

Truncates catalogue: destroy all records, but not the B-tree root.

That routine may be called more than once to fit into transaction. 'Limit' is a maximum number of records to be deleted. 'Limit' may be calculated through m0_ctg_drop_credit() (as well as necessary credits).

After truncation is done, m0_ctg_drop() should be called to destroy associated B-tree completely.

Definition at line 1606 of file ctg_store.c.

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

◆ m0_ctg_try_init()

M0_INTERNAL void m0_ctg_try_init ( struct m0_cas_ctg ctg)

Initialise catalog meta-data volatile stuff: mutexes etc.

Definition at line 953 of file ctg_store.c.

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

◆ M0_XCA_DOMAIN()

struct m0_cas_ctg M0_XCA_DOMAIN ( be  )

Variable Documentation

◆ M0_XCA_DOMAIN

struct m0_ctg_op M0_XCA_DOMAIN