Motr
M0
|
Data Structures | |
struct | m0_dtm0_log_rec |
struct | m0_be_dtm0_log |
Enumerations | |
enum | m0_be_dtm0_log_credit_op { M0_DTML_CREATE, M0_DTML_SENT, M0_DTML_EXECUTED, M0_DTML_PERSISTENT, M0_DTML_PRUNE, M0_DTML_REDO } |
m0_be_dtm0_log_credit_op enum
DTM0 persistent log is implemented on top of be modules and uses be_list for storing the log records. m0_be_dtm0_log_credit_op is an enumeration of the operation codes that can be specified to obtain credits for performing the corresponding operation related to dtm0_log.
Enumerator | |
---|---|
M0_DTML_CREATE | |
M0_DTML_SENT | |
M0_DTML_EXECUTED | |
M0_DTML_PERSISTENT | |
M0_DTML_PRUNE | |
M0_DTML_REDO |
Definition at line 141 of file dtm0_log.h.
M0_INTERNAL int m0_be_dtm0_log_alloc | ( | struct m0_be_dtm0_log ** | out | ) |
Typical call flow for calling DTM0 log interface routines:
** Initialisation/Finalisation for volatile fields of the log ** Create a persistent log or just allocate a volatile (in-memory) log m0_be_dtm0_log_create / m0_be_dtm0_log_alloc
log | Pointer to variable in which to return the allocate memory address. |
Allocate memory for a dtm0 volatile log structure.
Definition at line 70 of file dtm0_log.c.
M0_INTERNAL void m0_be_dtm0_log_clear | ( | struct m0_be_dtm0_log * | log | ) |
Given a pointer to a dtm0 volatile log clear the log and finalize it.
log | Pointer to the volatile log that we want to clear. |
TODO: rename this to indicate that it's used for volatile usecase only. TODO: remove later. Removes all records from the volatile log.
Definition at line 520 of file dtm0_log.c.
M0_INTERNAL int m0_be_dtm0_log_create | ( | struct m0_be_tx * | tx, |
struct m0_be_seg * | seg, | ||
struct m0_be_dtm0_log ** | out | ||
) |
This routine is used to create a dtm0 persistent log.
tx | handle to an already opened transaction. |
seg | be segment on which to create the log. |
out | variable in which to store the pointer to the newly created log. |
Definition at line 237 of file dtm0_log.c.
M0_INTERNAL void m0_be_dtm0_log_credit | ( | enum m0_be_dtm0_log_credit_op | op, |
struct m0_dtm0_tx_desc * | txd, | ||
struct m0_buf * | payload, | ||
struct m0_be_seg * | seg, | ||
struct m0_dtm0_log_rec * | rec, | ||
struct m0_be_tx_credit * | accum | ||
) |
For performing an operation on a persistent log, we need to take the appropriate number of be transaction credit.
op | Operation code for the type of dtm0 log operation that we want to perform. |
txd | A valid dtm0 tx descriptor that we want to store in the log record. |
payload | The payload is an opaque structure for dtm0 log to store in the log record. |
seg | The be segment on which the log resides. |
A | pointer to a valid m0_dtm0_log_rec. |
accum | This contains the number of credits required for performing the operation. |
Definition at line 202 of file dtm0_log.c.
M0_INTERNAL void m0_be_dtm0_log_destroy | ( | struct m0_be_tx * | tx, |
struct m0_be_dtm0_log ** | log | ||
) |
This routine is used to destroy a previously created persistent dtm0 log
tx | handle to an already opened transaction. |
log | Pointer to the dtm0 log which we wish to destroy |
Definition at line 260 of file dtm0_log.c.
M0_INTERNAL struct m0_dtm0_log_rec* m0_be_dtm0_log_find | ( | struct m0_be_dtm0_log * | log, |
const struct m0_dtm0_tid * | id | ||
) |
Given a pointer to a dtm0 transaction id, this routine searches the log for the log record matching this tx id and returns it.
log | Pointer to the dtm0 log in which we wish to search. |
tid | Pointer to a dtm0 transaction id corresponding to the record that we wish to fetch from the log. |
Definition at line 270 of file dtm0_log.c.
M0_INTERNAL void m0_be_dtm0_log_fini | ( | struct m0_be_dtm0_log * | log | ) |
Finalize a dtm0 log. We need to call this routine once after we have finished performing all operations on it.
log | Pointer to a valid log. |
Definition at line 111 of file dtm0_log.c.
M0_INTERNAL void m0_be_dtm0_log_free | ( | struct m0_be_dtm0_log ** | log | ) |
Free the memory allocated by m0_be_dtm0_log_alloc
log | Pointer to a log structure that has been previously allocated. |
Definition at line 119 of file dtm0_log.c.
M0_INTERNAL int m0_be_dtm0_log_init | ( | struct m0_be_dtm0_log * | log, |
struct m0_be_seg * | seg, | ||
struct m0_dtm0_clk_src * | cs, | ||
bool | is_plog | ||
) |
Initialize a dtm0 log. We need to call this routine once before we can perform any operations on it.
log | Pointer to a m0_be_dtm0_log that has to be initialized. |
cs | Pointer to a clock source. This will be used for comparisons involving log record timestamps. |
is_plog | A flag to indicate whether the dtm0 log that we are trying to init is a volatile of persistent store. |
Definition at line 94 of file dtm0_log.c.
M0_INTERNAL void m0_be_dtm0_log_pmsg_post | ( | struct m0_be_dtm0_log * | log, |
struct m0_fop * | fop | ||
) |
Deliver a persistent message to the log.
log | Pointer to the dtm0 log which we wish to destroy |
fop | This is a fop for the request carrying a PERSISTENT notice |
TODO: Only volatile log is supported so far.
Definition at line 637 of file dtm0_log.c.
M0_INTERNAL int m0_be_dtm0_log_prune | ( | struct m0_be_dtm0_log * | log, |
struct m0_be_tx * | tx, | ||
const struct m0_dtm0_tid * | id | ||
) |
Given a pointer to a dtm0 transaction id, this routine searches the log for the log record matching this tx id and removes all the records having id lower or equal to the specified id.
log | Pointer to the log from which we want to delete the record. |
tx | Pointer to an open be transaction. |
id | Pointer to a dtm0 transaction id corresponding to the record that we wish to delete from the log. |
Definition at line 477 of file dtm0_log.c.
M0_INTERNAL int m0_be_dtm0_log_update | ( | struct m0_be_dtm0_log * | log, |
struct m0_be_tx * | tx, | ||
struct m0_dtm0_tx_desc * | txd, | ||
struct m0_buf * | payload | ||
) |
This routine is used to update a record in the dtm0 log. If the record does not exist it will be inserted.
log | Pointer to the dtm0 log which we wish to update. |
tx | handle to an already opened transaction. |
txd | A valid dtm0 tx descriptor that we want to store in the log record. |
payload | The payload is an opaque structure for dtm0 log to store in the log record. |
Definition at line 460 of file dtm0_log.c.
M0_INTERNAL bool m0_be_dtm0_plog_can_prune | ( | struct m0_be_dtm0_log * | log, |
const struct m0_dtm0_tid * | id, | ||
struct m0_be_tx_credit * | accum | ||
) |
Given a pointer to a dtm0 persistent log and a transaction id, this routine searches the log for the log record matching this tx id and checks whether all log records with id lower or equal to the specified id are persistent and if they can be pruned.
log | Pointer to the log from which we want to delete the record. |
tx | Pointer to an open be transaction. |
id | Pointer to a dtm0 transaction id corresponding to the record that we wish to delete from the log. |
To prune a record from the log, it needs to be persistent in the log and all the records in the log with id lower than this must be persistent as well. And, when we delete this record we will need to delete all such records. This function is used to determine whether the record with the given id can be pruned from the log and if yes, it also returns a count of the number of be tx credits that would be requried to delete these many records.
Definition at line 573 of file dtm0_log.c.
M0_INTERNAL int m0_be_dtm0_plog_prune | ( | struct m0_be_dtm0_log * | log, |
struct m0_be_tx * | tx, | ||
const struct m0_dtm0_tid * | id | ||
) |
Given a pointer to a dtm0 persistent log and a transaction id, this routine searches the log for the log record matching this tx id and removes all the log records with id lower or equal to the specified id that are persistent.
log | Pointer to the log from which we want to delete the record. |
tx | Pointer to an open be transaction. |
id | Pointer to a dtm0 transaction id corresponding to the record that we wish to delete from the log. |
Definition at line 609 of file dtm0_log.c.
M0_INTERNAL int m0_be_dtm0_volatile_log_insert | ( | struct m0_be_dtm0_log * | log, |
struct m0_dtm0_log_rec * | rec | ||
) |
Given a pointer to a dtm0 volatile log and a log record, insert the record in the log.
log | Pointer to the volatile log into which that we want to insert the record. |
Definition at line 540 of file dtm0_log.c.
M0_INTERNAL void m0_be_dtm0_volatile_log_update | ( | struct m0_be_dtm0_log * | log, |
struct m0_dtm0_log_rec * | rec | ||
) |
This routine is used to update a record in a dtm0 volatile log.
log | Pointer to the dtm0 log which we wish to destroy |
rec | Pointer to a valid dtm0 log record that we want to update. |
Definition at line 555 of file dtm0_log.c.