# Module cloudi_write_ahead_logging

- Description
- Data Types
- Function Index
- Function Details

### CloudI Write Ahead Logging (WAL)

File storage for transaction logging done by cloudi_service_queue.

Copyright © 2014-2016 Michael Truog

Version: 1.5.5 Jan 10 2017 20:54:09 ------------------------------------------------------------------------

Authors: Michael Truog (`mjtruog [at] gmail (dot) com`).

## Description

### CloudI Write Ahead Logging (WAL)

File storage for transaction logging done by cloudi_service_queue. No disk index is maintained, but an in-memory index is kept.

## Data Types

### dict_proxy()

`dict_proxy(Key, Value) = dict:dict(Key, Value)`

### non_neg_integer_64bit()

`non_neg_integer_64bit() = 0..18446744073709551615`

### pos_integer_64bit()

`pos_integer_64bit() = 1..18446744073709551615`

### retry_function()

`retry_function() = fun((Chunk::cloudi_service_queue:request(), Retry::boolean()) -> {ok, cloudi_service:trans_id()} | {error, timeout})`

### state()

`state() = #state{file = undefined | string(), compression = undefined | 0..9, position = undefined | non_neg_integer(), chunks = dict_proxy(cloudi_service:trans_id(), #chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}), chunks_free = [#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}]}`

### update_function()

`update_function() = fun((cloudi_service_queue:request()) -> {cloudi_service:trans_id(), cloudi_service_queue:request()} | undefined)`

## Function Index

erase/2 |
erase_retry/4 |
fetch_keys/1 |
new/3 |
size/1 |
size_free/1 |
store_end/3 |
store_fail/2 |
store_start/2 |
update/3 |

## Function Details

### erase/2

`erase(ChunkId::cloudi_service:trans_id(), State::#state{file = undefined | string(), compression = undefined | 0..9, position = undefined | non_neg_integer(), chunks = dict_proxy(cloudi_service:trans_id(), #chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}), chunks_free = [#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}]}) -> {cloudi_service_queue:request(), #state{file = undefined | string(), compression = undefined | 0..9, position = undefined | non_neg_integer(), chunks = dict_proxy(cloudi_service:trans_id(), #chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}), chunks_free = [#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}]}}`

### erase_retry/4

`erase_retry(ChunkId::cloudi_service:trans_id(), RetryMax::non_neg_integer(), RetryF::retry_function(), State::#state{file = undefined | string(), compression = undefined | 0..9, position = undefined | non_neg_integer(), chunks = dict_proxy(cloudi_service:trans_id(), #chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}), chunks_free = [#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}]}) -> #state{file = undefined | string(), compression = undefined | 0..9, position = undefined | non_neg_integer(), chunks = dict_proxy(cloudi_service:trans_id(), #chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}), chunks_free = [#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}]}`

### fetch_keys/1

`fetch_keys(State::#state{file = undefined | string(), compression = undefined | 0..9, position = undefined | non_neg_integer(), chunks = dict_proxy(cloudi_service:trans_id(), #chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}), chunks_free = [#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}]}) -> [cloudi_service:trans_id()]`

### new/3

`new(FilePath::string(), Compression::0..9, RetryF::retry_function()) -> #state{file = undefined | string(), compression = undefined | 0..9, position = undefined | non_neg_integer(), chunks = dict_proxy(cloudi_service:trans_id(), #chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}), chunks_free = [#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}]}`

### size/1

`size(State::#state{file = undefined | string(), compression = undefined | 0..9, position = undefined | non_neg_integer(), chunks = dict_proxy(cloudi_service:trans_id(), #chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}), chunks_free = [#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}]}) -> non_neg_integer()`

### size_free/1

`size_free(State::#state{file = undefined | string(), compression = undefined | 0..9, position = undefined | non_neg_integer(), chunks = dict_proxy(cloudi_service:trans_id(), #chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}), chunks_free = [#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}]}) -> non_neg_integer()`

### store_end/3

`store_end(ChunkId::cloudi_service:trans_id(), Chunk::#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}, State::#state{file = undefined | string(), compression = undefined | 0..9, position = undefined | non_neg_integer(), chunks = dict_proxy(cloudi_service:trans_id(), #chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}), chunks_free = [#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}]}) -> #state{file = undefined | string(), compression = undefined | 0..9, position = undefined | non_neg_integer(), chunks = dict_proxy(cloudi_service:trans_id(), #chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}), chunks_free = [#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}]}`

### store_fail/2

`store_fail(Chunk::#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}, State::#state{file = undefined | string(), compression = undefined | 0..9, position = undefined | non_neg_integer(), chunks = dict_proxy(cloudi_service:trans_id(), #chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}), chunks_free = [#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}]}) -> #state{file = undefined | string(), compression = undefined | 0..9, position = undefined | non_neg_integer(), chunks = dict_proxy(cloudi_service:trans_id(), #chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}), chunks_free = [#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}]}`

### store_start/2

`store_start(ChunkRequest::cloudi_service_queue:request(), State::#state{file = undefined | string(), compression = undefined | 0..9, position = undefined | non_neg_integer(), chunks = dict_proxy(cloudi_service:trans_id(), #chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}), chunks_free = [#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}]}) -> {#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}, #state{file = undefined | string(), compression = undefined | 0..9, position = undefined | non_neg_integer(), chunks = dict_proxy(cloudi_service:trans_id(), #chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}), chunks_free = [#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}]}}`

### update/3

`update(ChunkId::cloudi_service:trans_id(), UpdateF::update_function(), State::#state{file = undefined | string(), compression = undefined | 0..9, position = undefined | non_neg_integer(), chunks = dict_proxy(cloudi_service:trans_id(), #chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}), chunks_free = [#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}]}) -> {cloudi_service_queue:request() | undefined, #state{file = undefined | string(), compression = undefined | 0..9, position = undefined | non_neg_integer(), chunks = dict_proxy(cloudi_service:trans_id(), #chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}), chunks_free = [#chunk{size = pos_integer_64bit(), position = non_neg_integer_64bit(), request = cloudi_service_queue:request() | undefined, retries = non_neg_integer()}]}}`

Generated by EDoc, Jan 10 2017, 20:54:09.