Behavior defining converter modules used during Mnesia->Khepri copy.
All callbacks are run in the same process, so process-based features like the dictionary and mailbox are usable from the callback functions.
Unlike what the "optional callback functions" line says above, at least one ofinit_copy_to_khepri/3
or init_copy_to_khepri/4
is
required, depending on how the copy is started.
init_copy_to_khepri/3 | Initializes the state of the converter module. |
init_copy_to_khepri/4 | Initializes the state of the converter module, using Args . |
copy_to_khepri/3 | Copies a record to a Khepri store. |
delete_from_khepri/3 | Deletes a key from a Khepri store. |
finish_copy_to_khepri/1 | Performs any post-copy operations. |
init_copy_to_khepri(StoreId, MigrationId, Tables) -> Ret
StoreId = khepri:store_id()
MigrationId = mnesia_to_khepri:migration_id()
Tables = [mnesia_to_khepri:mnesia_table()]
Ret = {ok, Priv}
Priv = priv
Initializes the state of the converter module.
This callback is used when a table copy is initiated like this:mnesia_to_khepri:copy_all_tables(
StoreId,
<<"my_migration">>,
my_converter_mod).
See init_copy_to_khepri/4
if you want to pass arguments to the
converter module.
It it called after involved tables were marked as "being migrated" (i.e.
copy in progress). This state is recorded in the destination Khepri store
StoreId
.
init_copy_to_khepri/3
or init_copy_to_khepri/4
is
required, depending on how the copy is started.
See also: init_copy_to_khepri/4.
init_copy_to_khepri(StoreId, MigrationId, Tables, Args) -> Ret
StoreId = khepri:store_id()
MigrationId = mnesia_to_khepri:migration_id()
Tables = [mnesia_to_khepri:mnesia_table()]
Args = any()
Ret = {ok, Priv}
Priv = priv
Initializes the state of the converter module, using Args
.
mnesia_to_khepri:copy_all_tables(
StoreId,
<<"my_migration">>,
{my_converter_mod, Args}).
See init_copy_to_khepri/3
if you don't need to pass arguments to
the converter module.
It it called after involved tables were marked as being migrated. This
state is recorded in the destination Khepri store StoreId
.
init_copy_to_khepri/3
or init_copy_to_khepri/4
is
required, depending on how the copy is started.
See also: init_copy_to_khepri/3.
copy_to_khepri(Table, Record, Priv) -> Ret
Table = mnesia_to_khepri:mnesia_table()
Record = tuple()
Priv = priv
Ret = {ok, Priv}
Copies a record to a Khepri store.
This callback is called for each record to copy. Record
comes from table
Table
initially. It may not be called at all if there are not records to
copy.
init_copy_to_khepri/2
or init_copy_to_khepri/3
.
delete_from_khepri(Table, Key, Priv) -> Ret
Table = mnesia_to_khepri:mnesia_table()
Key = any()
Priv = priv
Ret = {ok, Priv}
Deletes a key from a Khepri store.
This callback is called for each deletion which occurred in Mnesia concurrently to the copy in progress. Only the Mnesia key is available, not the record that was deleted. It may not be called at all if there were no concurrent deletions.
The callback is responsible for deciding what to do in Khepri. The destination Khepri store was passed toinit_copy_to_khepri/3
or
init_copy_to_khepri/4
.
finish_copy_to_khepri(Priv) -> ok
Priv = priv
Performs any post-copy operations.
It it called after involved tables were marked as "migrated" (i.e. copy is
finished). This state is recorded in the destination Khepri store
StoreId
.
Generated by EDoc