# Module kv_on_cseq

- Description
- Data Types
- Function Index
- Function Details

key value store based on rbrcseq.

Copyright © 2012-2015 Zuse Institute Berlin,

Version: $Id$

Authors: Florian Schintke (`schintke@zib.de`).

## Description

key value store based on rbrcseq.

## Data Types

### client_key()

    client_key() = [unicode_char()]

### client_value()

    client_value() = any()

### db_entry()

    db_entry() = {readlock(), writelock(), version(), value()}

### readlock()

    readlock() = [txid()]

### txid()

    txid() = rt_chord:key()

### unicode_char()

    unicode_char() = 0..55295 | 57344..65533 | 65536..1114111

### value()

    value() = any()

### version()

    version() = non_neg_integer() | -1

### writelock()

    writelock() = txid() | no_write_lock

## Function Index

abort_read/5 | Releases the read lock of a given entry, if it was set.
abort_read_feeder/5 |
abort_write/5 | Releases the write lock of a given entry, if it was set.
abort_write_feeder/5 |
cc_abort_read/3 | The content check for abort_read has only to ensure, that the readlock is eliminated when it is there.
cc_abort_write/3 |
cc_commit_read/3 |
cc_commit_write/3 |
cc_return_val/4 |
cc_set_rl/3 |
cc_set_wl/3 |
cc_single_write/3 |
commit_read/5 | Releases the read lock of a given entry, if it was set.
commit_read_feeder/5 |
commit_write/5 | Releases the write lock of a given entry, if it was set, and writes the new value.
commit_write_feeder/5 |
max/2 |
read/1 |
rf_rl_vers/1 |
rf_rl_wl_vers/1 |
rf_val/1 |
rf_val_vers/1 |
rf_wl_vers/1 |
set_lock/3 |
wf_set_rl/3 |
wf_set_vers_val/3 |
wf_set_wl/3 |
wf_unset_rl/3 |
wf_unset_wl/3 |
wf_val_unset_wl/3 |
work_phase_async/4 |
write/2 |

## Function Details

### work_phase_async/4

    work_phase_async(ClientPid :: comm:erl_local_pid(),
                     ReqId :: any(),
                     HashedKey :: rt_chord:key(),
                     Op :: read | write) ->
                        ok

### rf_val_vers/1

    rf_val_vers(X :: db_entry() | prbr_bottom) ->
                   {client_value(), version()}

### read/1

    read(Key :: client_key()) -> api_tx:read_result()

### rf_val/1

    rf_val(X :: db_entry() | prbr_bottom) -> client_value()

### write/2

    write(Key :: client_key(), Value :: client_value()) ->
             api_tx:write_result()

### cc_single_write/3

    cc_single_write(X1 ::
                        no_value_yet |
                        {readlock(), writelock(), version()},
                    WriteFilter :: prbr:write_filter(),
                    Value :: any()) ->
                       {true, UI :: version()} |
                       {false, [readlock_is_set | writelock_is_set]}

### wf_set_vers_val/3

    wf_set_vers_val(Entry :: db_entry() | prbr_bottom,
                    Version :: version(),
                    WriteValue :: client_value()) ->
                       {db_entry(), none}

### set_lock/3

    set_lock(TLogEntry :: tx_tlog:tlog_entry(),
             TxId :: txid(),
             ReplyTo :: comm:erl_local_pid()) ->
                ok

### rf_wl_vers/1

    rf_wl_vers(X :: db_entry() | prbr_bottom) ->
                  {writelock(), version()} | no_value_yet

### cc_set_rl/3

    cc_set_rl(X1 :: no_value_yet | {writelock(), version()},
              WF :: prbr:write_filter(),
              Val :: {txid_on_cseq:txid(), version()}) ->
                 {true, UI :: none} | {false, any()}

### wf_set_rl/3

    wf_set_rl(DBEntry :: db_entry(),
              UI :: {writelock(), version()} | no_value_yet,
              X3 :: {txid_on_cseq:txid(), version()}) ->
                 {db_entry(), none}

### rf_rl_wl_vers/1

    rf_rl_wl_vers(X :: db_entry() | prbr_bottom) ->
                     {readlock(), writelock(), version()} |
                     no_value_yet

### cc_set_wl/3

    cc_set_wl(X1 :: {readlock, writelock(), version()},
              WF :: prbr:write_filter(),
              Val :: {txid_on_cseq:txid(), version()}) ->
                 {true, UI :: none} | {false, any()}

### wf_set_wl/3

    wf_set_wl(DBEntry :: prbr_bottom,
              UI :: none,
              X3 :: {txid_on_cseq:txid(), -1}) ->
                 {db_entry(), none}

### commit_read_feeder/5

    commit_read_feeder(TLogEntry :: tx_tlog:tlog_entry(),
                       TxId :: txid(),
                       Pid :: comm:erl_local_pid(),
                       Round :: pr:pr(),
                       OldVal :: {txid_on_cseq:txid(), version()}) ->
                          {tx_tlog:tlog_entry(),
                           txid(),
                           comm:erl_local_pid(),
                           pr:pr(),
                           {txid_on_cseq:txid(), version()}}

### commit_read/5

    commit_read(TLogEntry :: tx_tlog:tlog_entry(),
                TxId :: txid(),
                ReplyTo :: comm:erl_local_pid(),
                NextRound :: pr:pr(),
                OldVal :: any()) ->
                   ok

Releases the read lock of a given entry, if it was set.

### rf_rl_vers/1

    rf_rl_vers(X :: db_entry() | prbr_bottom) ->
                  {readlock(), version()} | no_value_yet

### cc_commit_read/3

    cc_commit_read(X1 :: no_value_yet | {readlock, version()},
                   WF :: prbr:write_filter(),
                   Val :: {txid_on_cseq:txid(), version()}) ->
                      {true, UI :: none} | {false, any()}

### wf_unset_rl/3

    wf_unset_rl(DBEntry :: prbr_bottom,
                UI :: none,
                X3 :: {txid_on_cseq:txid(), 0}) ->
                   {prbr_bottom, none}

### commit_write_feeder/5

    commit_write_feeder(TLogEntry :: tx_tlog:tlog_entry_write(),
                        TxId :: txid(),
                        Pid :: comm:erl_local_pid(),
                        Round :: pr:pr(),
                        OldVal :: {txid_on_cseq:txid(), version()}) ->
                           {tx_tlog:tlog_entry_write(),
                            txid(),
                            comm:erl_local_pid(),
                            pr:pr(),
                            {txid_on_cseq:txid(), version()}}

### commit_write/5

    commit_write(TLogEntry :: tx_tlog:tlog_entry_write(),
                 TxId :: txid(),
                 ReplyTo :: comm:erl_local_pid(),
                 NextRound :: pr:pr(),
                 OldVal :: any()) ->
                    ok

Releases the write lock of a given entry, if it was set, and writes the new value. erlang shell test call: api_tx:write("a", 1).

### cc_commit_write/3

    cc_commit_write(X1 ::
                        no_value_yet |
                        {writelock(), version()} |
                        {readlock(), writelock(), version()},
                    WF :: prbr:write_filter(),
                    Val ::
                        {txid_on_cseq:txid(),
                         version(),
                         NewVal :: any()}) ->
                       {true, UI :: none} | {false, Reason :: any()}

### wf_val_unset_wl/3

    wf_val_unset_wl(DBEntry :: prbr_bottom,
                    UI :: none,
                    X3 :: {txid_on_cseq:txid(), 0, value()}) ->
                       {prbr_bottom, none}

### abort_read_feeder/5

    abort_read_feeder(TLogEntry :: tx_tlog:tlog_entry(),
                      TxId :: txid(),
                      Pid :: comm:erl_local_pid(),
                      Round :: pr:pr(),
                      OldVal :: {txid_on_cseq:txid(), version()}) ->
                         {tx_tlog:tlog_entry(),
                          txid(),
                          comm:erl_local_pid(),
                          pr:pr(),
                          {txid_on_cseq:txid(), version()}}

### abort_read/5

    abort_read(TLogEntry :: tx_tlog:tlog_entry(),
               TxId :: txid(),
               ReplyTo :: comm:erl_local_pid(),
               NextRound :: pr:pr(),
               OldVal :: any()) ->
                  ok

Releases the read lock of a given entry, if it was set.

### cc_abort_read/3

    cc_abort_read(X1 :: no_value_yet | {readlock, version()},
                  WF :: prbr:write_filter(),
                  Val :: {txid_on_cseq:txid(), version()}) ->
                     {boolean(), UI :: none}

The content check for abort_read has only to ensure, that the readlock is eliminated when it is there. The write operation (unset read lock) is performed, when the result is {true, _}. Otherwise, the tx still passes and it is assumed that either the readlock was not acquired, or was already eliminated by a write_through operation of the rbrcseq module due to concurrency.

### abort_write_feeder/5

    abort_write_feeder(TLogEntry :: tx_tlog:tlog_entry_write(),
                       TxId :: txid(),
                       Pid :: comm:erl_local_pid(),
                       Round :: pr:pr(),
                       OldVal :: {txid_on_cseq:txid(), version()}) ->
                          {tx_tlog:tlog_entry_write(),
                           txid(),
                           comm:erl_local_pid(),
                           pr:pr(),
                           {txid_on_cseq:txid(), version()}}

### abort_write/5

    abort_write(TLogEntry :: tx_tlog:tlog_entry_write(),
                TxId :: txid(),
                ReplyTo :: comm:erl_local_pid(),
                NextRound :: pr:pr(),
                OldVal :: any()) ->
                   ok

Releases the write lock of a given entry, if it was set. erlang shell test call: api_tx:write("a", 1).

### cc_abort_write/3

    cc_abort_write(X1 ::
                       no_value_yet |
                       {writelock(), version()} |
                       {readlock(), writelock(), version()},
                   WF :: prbr:write_filter(),
                   Val ::
                       {txid_on_cseq:txid(),
                        version(),
                        NewVal :: any()}) ->
                      {true, UI :: none} | {false, any()}

### wf_unset_wl/3

    wf_unset_wl(DBEntry :: prbr_bottom,
                UI :: none,
                X3 :: {txid_on_cseq:txid(), 0, value()}) ->
                   {prbr_bottom, none}

### cc_return_val/4

    cc_return_val(WhichCC :: atom(),
                  Checks :: [{boolean(), tuple() | atom()}],
                  UI :: any(),
                  X4 :: boolean()) ->
                     {true, UI :: any()} | {false, any()}

### max/2

    max(A :: db_entry(), B :: db_entry()) -> db_entry()

Generated by EDoc, Feb 29 2016, 16:12:13.