Module ra_snapshot

Data Types

checkpoint()

checkpoint() = ra_idxterm()

effect()

effect() = {monitor, process, snapshot_writer, pid()} | {bg_work, function(), function()}

file_err()

file_err() = ra_lib:file_err()

kind()

kind() = snapshot | checkpoint | recovery_checkpoint

meta()

meta() = snapshot_meta()

recovery_checkpoint()

recovery_checkpoint() = ra_idxterm()

state()

abstract datatype: state()

Function Index

abort_accept/1
accept_chunk/3
accepting/1
begin_accept/2
begin_read/2
begin_snapshot/5
complete_accept/4
complete_snapshot/5
context/2
current/1
current_snapshot_dir/1
delete/2
delete_recovery_checkpoint/1Delete the current recovery checkpoint.
directory/2
handle_error/3
highest_idx/1
indexes/1
init/7
init/8
init/9
init_ets/0
last_index_for/1
latest_checkpoint/1
make_snapshot_dir/3
pending/1
promote_checkpoint/2
read_chunk/3
read_meta/2
recover/1
recover_recovery_checkpoint/1Recover from the recovery checkpoint if it exists.
recovery_checkpoint/1
snapshot_size/1
take_extra_checkpoints/1
take_older_checkpoints/2
write_indexes/2 Indexes file format: "RASI" (4 bytes - magic) Version (1 byte - unsigned) CRC32 (4 bytes - unsigned 32-bit integer) Data (binary - term_to_binary of indexes).
write_recovery_checkpoint/4Write a recovery checkpoint synchronously during shutdown.

Function Details

abort_accept/1

abort_accept(State::state()) -> state()

accept_chunk/3

accept_chunk(Chunk::term(), Num::non_neg_integer(), State::state()) -> state()

accepting/1

accepting(X1::state()) -> option(ra_idxterm())

begin_accept/2

begin_accept(Meta::meta(), State::state()) -> {ok, state()}

begin_read/2

begin_read(State::state(), Context::map()) -> {ok, Meta::meta(), ReadState} | {error, term()}

begin_snapshot/5

begin_snapshot(Meta::meta(), MacModule::module(), MacState::term(), SnapKind::kind(), State::state()) -> {state(), [effect()]}

complete_accept/4

complete_accept(Chunk::term(), Num::non_neg_integer(), Machine::ra_machine:machine(), State0::state()) -> {state(), MacState::term(), ra_seq:state(), [effect()]}

complete_snapshot/5

complete_snapshot(IdxTerm::ra_idxterm(), X2::kind(), LiveIndexes::ra_seq:state(), SnapshotSize::non_neg_integer(), State::state()) -> state()

context/2

context(X1::state(), Node::node()) -> map()

current/1

current(X1::state()) -> option(ra_idxterm())

current_snapshot_dir/1

current_snapshot_dir(X1::state()) -> option(file:filename_all())

delete/2

delete(Dir, X2) -> any()

delete_recovery_checkpoint/1

delete_recovery_checkpoint(State::state()) -> state()

Delete the current recovery checkpoint.

directory/2

directory(X1::state(), X2::kind()) -> option(file:filename_all())

handle_error/3

handle_error(IDX_TERM::{ra:index(), ra_term()}, Error::term(), State::state()) -> state()

highest_idx/1

highest_idx(X1::state()) -> ra_index()

indexes/1

indexes(Dir::file:filename_all()) -> {ok, ra_seq:state()} | {error, invalid_format | {invalid_version, integer()} | checksum_error | file:posix()}

init/7

init(UId::ra_uid(), Module::module(), SnapshotsDir::file:filename_all(), CheckpointDir::file:filename_all(), Machine::option(ra_machine:machine()), Counter::undefined | counters:counters_ref(), MaxCheckpoints::pos_integer()) -> state()

init/8

init(UId::ra_uid(), Module::module(), SnapshotsDir::file:filename_all(), CheckpointDir::file:filename_all(), RecoveryCheckpointDir::option(file:filename_all()), Machine::option(ra_machine:machine()), Counter::undefined | counters:counters_ref(), MaxCheckpoints::pos_integer()) -> state()

init/9

init(UId::ra_uid(), Module::module(), SnapshotsDir::file:filename_all(), CheckpointDir::file:filename_all(), RecoveryCheckpointDir::option(file:filename_all()), SyncServer::undefined | ra_log_sync:pool_ref(), Machine::option(ra_machine:machine()), Counter::undefined | counters:counters_ref(), MaxCheckpoints::pos_integer()) -> state()

init_ets/0

init_ets() -> ok

last_index_for/1

last_index_for(UId::ra_uid()) -> option(ra_index())

latest_checkpoint/1

latest_checkpoint(X1::state()) -> option(checkpoint())

make_snapshot_dir/3

make_snapshot_dir(Dir, Index, Term) -> any()

pending/1

pending(X1::state()) -> option({ra_idxterm(), kind()})

promote_checkpoint/2

promote_checkpoint(Idx::ra_index(), State0::state()) -> {boolean(), State::state(), Effects::[effect()]}

read_chunk/3

read_chunk(ReadState, ChunkSizeBytes::non_neg_integer(), State::state()) -> {ok, Data::term(), {next, ReadState} | last} | {error, term()}

read_meta/2

read_meta(Module::module(), Location::file:filename_all()) -> {ok, meta()} | {error, invalid_format | {invalid_version, integer()} | checksum_error | file_err() | term()}

recover/1

recover(X1::state()) -> {ok, Meta::meta(), State::term()} | {error, no_current_snapshot} | {error, term()}

recover_recovery_checkpoint/1

recover_recovery_checkpoint(X1::state()) -> {ok, Meta::meta(), State::term()} | {error, no_recovery_checkpoint} | {error, term()}

Recover from the recovery checkpoint if it exists. This is used by ra_server:recover/1 to skip log replay when a recovery checkpoint with a higher index than the snapshot exists.

recovery_checkpoint/1

recovery_checkpoint(X1::state()) -> option(recovery_checkpoint())

snapshot_size/1

snapshot_size(X1::state()) -> non_neg_integer() | undefined

take_extra_checkpoints/1

take_extra_checkpoints(State0::state()) -> {state(), [checkpoint()]}

take_older_checkpoints/2

take_older_checkpoints(Idx::ra_index(), State0::state()) -> {state(), [checkpoint()]}

write_indexes/2

write_indexes(Dir::file:filename_all(), Indexes::ra_seq:state()) -> ok | {error, file:posix()}

Indexes file format: "RASI" (4 bytes - magic) Version (1 byte - unsigned) CRC32 (4 bytes - unsigned 32-bit integer) Data (binary - term_to_binary of indexes)

write_recovery_checkpoint/4

write_recovery_checkpoint(Meta::meta(), MacState::term(), SnapModule::module(), State::state()) -> {ok, state()} | {error, term()}

Write a recovery checkpoint synchronously during shutdown. Recovery checkpoints store the machine state to skip log replay on restart. They don't include live indexes - those are recovered from the last snapshot/checkpoint.


Generated by EDoc