Picotm's module interface. More...
#include "picotm/config/picotm-config.h"
#include <signal.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "compiler.h"
#include "picotm-error.h"
Data Structures | |
struct | picotm_module_ops |
Typedefs | |
typedef void(* | picotm_module_apply_event_function) (uint16_t head, uintptr_t tail, void *data, struct picotm_error *error) |
typedef void(* | picotm_module_apply_function) (void *data, struct picotm_error *error) |
typedef void(* | picotm_module_begin_function) (void *data, struct picotm_error *error) |
typedef void(* | picotm_module_finish_function) (void *data, struct picotm_error *error) |
typedef void(* | picotm_module_prepare_commit_function) (void *data, int is_irrevocable, struct picotm_error *error) |
typedef void(* | picotm_module_release_function) (void *data) |
typedef void(* | picotm_module_undo_event_function) (uint16_t head, uintptr_t tail, void *data, struct picotm_error *error) |
typedef void(* | picotm_module_undo_function) (void *data, struct picotm_error *error) |
Functions | |
PICOTM_NOTHROW void | picotm_append_event (unsigned long module, uint16_t head, uintptr_t tail, struct picotm_error *error) |
PICOTM_NOTHROW void | picotm_irrevocable (void) |
PICOTM_NOTHROW bool | picotm_is_irrevocable (void) |
PICOTM_NOTHROW void | picotm_recover_from_errno (int errno_hint) |
PICOTM_NOTHROW void | picotm_recover_from_error (const struct picotm_error *error) |
PICOTM_NOTHROW void | picotm_recover_from_error_code (enum picotm_error_code error_hint) |
PICOTM_NOTHROW void | picotm_recover_from_kern_return_t (kern_return_t value) |
PICOTM_NOTHROW void | picotm_recover_from_siginfo_t (const siginfo_t *info) |
PICOTM_NOTHROW unsigned long | picotm_register_module (const struct picotm_module_ops *ops, void *data, struct picotm_error *error) |
PICOTM_NOTHROW void | picotm_resolve_conflict (struct picotm_rwlock *conflicting_lock) |
Picotm is extensible. The header file picotm-module.h
contains the declaration of picotm's module interface. The interface allows for implementing support for additional features, libraries and functionality. All existing modules are written on top of this interface as well.
typedef void(* picotm_module_apply_event_function) (uint16_t head, uintptr_t tail, void *data, struct picotm_error *error) |
Invoked by picotm during the commit phase to apply an event.
head | The event's head data. | |
tail | The event's tail data. | |
data | The pointer to module-specific data. | |
[out] | error | Returns an error from the module. |
typedef void(* picotm_module_apply_function) (void *data, struct picotm_error *error) |
Invoked by picotm during the commit phase to apply changes of a module.
data | The pointer to module-specific data. | |
[out] | error | Returns an error from the module. |
typedef void(* picotm_module_begin_function) (void *data, struct picotm_error *error) |
Invoked by picotm at the beginning of a transaction.
data | The pointer to module-specific data. | |
[out] | error | Returns an error from the module. |
typedef void(* picotm_module_finish_function) (void *data, struct picotm_error *error) |
Invoked by picotm to clean up a module's resources at the end of a transaction.
data | The pointer to module-specific data. | |
[out] | error | Returns an error from the module. |
typedef void(* picotm_module_prepare_commit_function) (void *data, int is_irrevocable, struct picotm_error *error) |
Invoked by picotm to prepare a module's resources for commit.
data | The pointer to module-specific data. | |
is_irrevocable | True if the transaction is irrevocable, false otherwise. | |
[out] | error | Returns an error from the module. |
typedef void(* picotm_module_release_function) (void *data) |
Invoked by picotm to clean up a module's resources when the thread exists.
data | The pointer to module-specific data. |
typedef void(* picotm_module_undo_event_function) (uint16_t head, uintptr_t tail, void *data, struct picotm_error *error) |
Invoked by picotm during the roll-back phase to revert an event.
head | The event's head data. | |
tail | The event's tail data. | |
data | The pointer to module-specific data. | |
[out] | error | Returns an error from the module. |
typedef void(* picotm_module_undo_function) (void *data, struct picotm_error *error) |
Invoked by picotm during the roll-back phase to revert changes of a module.
data | The pointer to module-specific data. | |
[out] | error | Returns an error from the module. |
PICOTM_NOTHROW void picotm_append_event | ( | unsigned long | module, |
uint16_t | head, | ||
uintptr_t | tail, | ||
struct picotm_error * | error | ||
) |
Appends an event to the transaction's event log.
module | The module number | |
head | Module-specific head data. | |
tail | Module-specific tail data, or a pointer to tail data. | |
[out] | error | Returns an error. |
PICOTM_NOTHROW void picotm_irrevocable | ( | void | ) |
Makes the current transaction irrevocable.
PICOTM_NOTHROW bool picotm_is_irrevocable | ( | void | ) |
Returns the transaction irrevocability status.
PICOTM_NOTHROW void picotm_recover_from_errno | ( | int | errno_hint | ) |
Instructs the transaction management system to recover from an error. The errno code is given as a hint.
errno_hint | The errno code of the detected error, or 0 if unknown. |
PICOTM_NOTHROW void picotm_recover_from_error | ( | const struct picotm_error * | error | ) |
Instructs the transaction management system to recover from an error. The error is supplied as an argument.
error | The detected error. |
PICOTM_NOTHROW void picotm_recover_from_error_code | ( | enum picotm_error_code | error_hint | ) |
Instructs the transaction management system to recover from an error. The error code is given as a hint.
error_hint | The error code of the detected error, or PICOTM_GENERAL_ERROR if unknown. |
PICOTM_NOTHROW void picotm_recover_from_kern_return_t | ( | kern_return_t | value | ) |
Instructs the transaction management system to recover from an error given as value of type 'kern_return_t'.
value | The kern_return_t value of the detected error. |
PICOTM_NOTHROW void picotm_recover_from_siginfo_t | ( | const siginfo_t * | info | ) |
Instructs the transaction management system to recover from an signal. Informaton about the signal is provided as value of type 'siginfo_t'.
[in] | info | The siginfo_t value of the received signal. |
PICOTM_NOTHROW unsigned long picotm_register_module | ( | const struct picotm_module_ops * | ops, |
void * | data, | ||
struct picotm_error * | error | ||
) |
Registers a new module with the transaction management system.
ops | The module-operations call-back structure. | |
data | A pointer to module-specific data. | |
[out] | error | Returns an error. |
PICOTM_NOTHROW void picotm_resolve_conflict | ( | struct picotm_rwlock * | conflicting_lock | ) |
Instructs the transaction management system to resolve a conflict between transactions.
conflicting_lock | The conflicting lock, or NULL if unknown. |