Motr
M0
|
Detailed functional specification for Layout DB. More...
Functions | |
M0_INTERNAL int | m0_layout_lookup (struct m0_layout_domain *dom, uint64_t lid, struct m0_layout_type *lt, struct m0_db_tx *tx, struct m0_db_pair *pair, struct m0_layout **out) |
M0_INTERNAL int | m0_layout_add (struct m0_layout *l, struct m0_db_tx *tx, struct m0_db_pair *pair) |
M0_INTERNAL int | m0_layout_update (struct m0_layout *l, struct m0_db_tx *tx, struct m0_db_pair *pair) |
M0_INTERNAL int | m0_layout_delete (struct m0_layout *l, struct m0_db_tx *tx, struct m0_db_pair *pair) |
M0_INTERNAL void | m0_layout_pair_set (struct m0_db_pair *pair, uint64_t *lid, void *area, m0_bcount_t num_bytes) |
Detailed functional specification for Layout DB.
Detailed functional specification provides documentation of all the data structures and interfaces (internal and external).
M0_INTERNAL int m0_layout_add | ( | struct m0_layout * | l, |
struct m0_db_tx * | tx, | ||
struct m0_db_pair * | pair | ||
) |
Adds a new layout record entry into the layouts table. If applicable, adds layout type and enum type specific entries into the relevant tables.
pair | A m0_db_pair sent by the caller along with having set pair->dp_key.db_buf and pair->dp_rec.db_buf. This is to leave the buffer allocation with the caller. |
Regarding the size of the pair->dp_rec.db_buf: The buffer size should be large enough to contain the data that is to be written specifically to the layouts table. It means it needs to be at the most the size returned by m0_layout_max_recsize().
Definition at line 542 of file layout_db.c.
M0_INTERNAL int m0_layout_delete | ( | struct m0_layout * | l, |
struct m0_db_tx * | tx, | ||
struct m0_db_pair * | pair | ||
) |
Deletes a layout record with given layout id and its related information from the relevant tables.
pair | A m0_db_pair sent by the caller along with having set pair->dp_key.db_buf and pair->dp_rec.db_buf. This is to leave the buffer allocation with the caller. |
Regarding the size of the pair->dp_rec.db_buf: The buffer size should be large enough to contain the data that is to be written specifically to the layouts table. It means it needs to be at the most the size returned by m0_layout_max_recsize().
Definition at line 601 of file layout_db.c.
M0_INTERNAL int m0_layout_lookup | ( | struct m0_layout_domain * | dom, |
uint64_t | lid, | ||
struct m0_layout_type * | lt, | ||
struct m0_db_tx * | tx, | ||
struct m0_db_pair * | pair, | ||
struct m0_layout ** | out | ||
) |
Looks for an in-memory layout object with the given identifier in the list of layout objects maintained in the layout domain. If not found there, looks up for a persistent layout record in the layout DB with the given identifier. If present in the layout DB, prepares an in-memory layout object with the information from the DB and adds the layout object to the list of layout objects in the layout domain.
All operations are performed in the context of the caller-supplied transaction.
pair | A m0_db_pair sent by the caller along with having set pair->dp_key.db_buf and pair->dp_rec.db_buf. This is to leave the buffer allocation with the caller. |
Regarding the size of the pair->dp_rec.db_buf: The buffer size should be large enough to contain the data that is to be read specifically from the layouts table. It means it needs to be at the most the size returned by m0_layout_max_recsize(). It is no harm if it is bigger than that.
Definition at line 428 of file layout_db.c.
M0_INTERNAL void m0_layout_pair_set | ( | struct m0_db_pair * | pair, |
uint64_t * | lid, | ||
void * | area, | ||
m0_bcount_t | num_bytes | ||
) |
Definition at line 370 of file layout_db.c.
M0_INTERNAL int m0_layout_update | ( | struct m0_layout * | l, |
struct m0_db_tx * | tx, | ||
struct m0_db_pair * | pair | ||
) |
Updates a layout record from the DB. The only field that can be updated for an existing layout in the layout DB is its user count. It is not prevented through the implementation to update any other fields since it was found to be costly through performance perspective.
pair | A m0_db_pair sent by the caller along with having set pair->dp_key.db_buf and pair->dp_rec.db_buf. This is to leave the buffer allocation with the caller. |
Regarding the size of the pair->dp_rec.db_buf: The buffer size should be large enough to contain the data that is to be written specifically to the layouts table. It means it needs to be at the most the size returned by m0_layout_max_recsize().
Definition at line 570 of file layout_db.c.