# Module l_on_cseq

- Description
- Data Types
- Function Index
- Function Details

lease store based on rbrcseq.

Copyright © 2012-2016 Zuse Institute Berlin,

Version: $Id$

Authors: Florian Schintke (`schintke@zib.de`), Thorsten Schuett (`schuett@zib.de`).

## Description

lease store based on rbrcseq.

## Data Types

### erlang_timestamp()

    erlang_timestamp() =
        {MegaSecs :: non_neg_integer(),
         Secs :: 0..999999,
         MicroSecs :: 0..999999}

### lease_aux()

    lease_aux() =
        empty |
        {change_owner, comm:mypid()} |
        {invalid, split, intervals:interval(), intervals:interval()} |
        {valid, split, intervals:interval(), intervals:interval()} |
        {invalid, merge, intervals:interval(), intervals:interval()} |
        {valid, merge, intervals:interval(), intervals:interval()}

### lease_id()

    lease_id() = rt_chord:key()

### lease_t()

    lease_t() =
        #lease{id = lease_id(),
               epoch = non_neg_integer(),
               owner = comm:mypid_plain() | nil,
               range = intervals:interval(),
               aux = lease_aux(),
               version = non_neg_integer(),
               timeout = erlang_timestamp()}

## Function Index

add_first_lease_to_db/2 |
disable_lease/2 |
get_aux/1 |
get_epoch/1 |
get_id/1 |
get_owner/1 |
get_pretty_timeout/1 |
get_range/1 |
get_timeout/1 |
get_version/1 |
has_timed_out/1 |
id/1 |
is_a_lease/1 |
is_valid/1 |
lease_handover/3 |
lease_merge/3 |
lease_renew/2 |
lease_renew/3 |
lease_send_lease_to_node/3 |
lease_split/5 |
lease_split_and_change_owner/6 |
lease_takeover/2 |
lease_takeover_after/3 |
new_timeout/0 |
on/2 |
read/1 |
read/2 |
set_aux/2 |
set_epoch/2 |
set_owner/2 |
set_range/2 |
set_timeout/1 |
set_version/2 |
split_range/1 |
unittest_clear_lease_list/1 |
unittest_create_lease/1 |
unittest_create_lease_with_range/3 |
unittest_get_delta/0 |
unittest_lease_update/4 |
unittest_lease_update_unsafe/3 |

## Function Details

### unittest_get_delta/0

    unittest_get_delta() -> pos_integer()

### lease_renew/2

    lease_renew(Lease :: lease_t(), Mode :: active | passive) -> ok

### lease_renew/3

    lease_renew(Pid :: comm:erl_local_pid(),
                Lease :: lease_t(),
                Mode :: active | passive) ->
                   ok

### lease_handover/3

    lease_handover(Lease :: lease_t(),
                   NewOwner :: comm:mypid(),
                   ReplyTo :: comm:erl_local_pid()) ->
                      ok

### lease_takeover/2

    lease_takeover(Lease :: lease_t(),
                   ReplyTo :: comm:erl_local_pid()) ->
                      ok

### lease_takeover_after/3

    lease_takeover_after(Delay :: non_neg_integer(),
                         Lease :: lease_t(),
                         ReplyTo :: comm:erl_local_pid()) ->
                            ok

### lease_split/5

    lease_split(Lease :: lease_t(),
                R1 :: intervals:interval(),
                R2 :: intervals:interval(),
                Keep :: first | second,
                ReplyTo :: comm:erl_local_pid()) ->
                   ok

### lease_merge/3

    lease_merge(Lease1 :: lease_t(),
                Lease2 :: lease_t(),
                ReplyTo :: comm:erl_local_pid()) ->
                   ok

### lease_send_lease_to_node/3

    lease_send_lease_to_node(Pid :: comm:mypid(),
                             Lease :: lease_t(),
                             Mode :: active | passive) ->
                                ok

### lease_split_and_change_owner/6

    lease_split_and_change_owner(Lease :: lease_t(),
                                 R1 :: intervals:interval(),
                                 R2 :: intervals:interval(),
                                 Keep :: first | second,
                                 NewOwner :: comm:mypid(),
                                 ReplyPid :: comm:erl_local_pid()) ->
                                    ok

### disable_lease/2

    disable_lease(State :: dht_node_state:state(), Lease :: lease_t()) ->
                     dht_node_state:state()

### unittest_lease_update/4

    unittest_lease_update(Old :: lease_t(),
                          New :: lease_t(),
                          Mode :: active | passive,
                          DHTNode :: pid()) ->
                             ok | failed

### unittest_lease_update_unsafe/3

    unittest_lease_update_unsafe(Old :: lease_t(),
                                 New :: lease_t(),
                                 Mode :: active | passive) ->
                                    ok | failed

### unittest_clear_lease_list/1

    unittest_clear_lease_list(Pid :: comm:erl_local_pid()) -> ok

### on/2

    on(X1 :: comm:message(), State :: dht_node_state:state()) ->
          dht_node_state:state() | kill

### read/1

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

### read/2

    read(Key :: lease_id(), Pid :: comm:erl_local_pid()) -> ok

### add_first_lease_to_db/2

    add_first_lease_to_db(Id :: rt_chord:key(),
                          State :: dht_node_state:state()) ->
                             dht_node_state:state()

### unittest_create_lease/1

    unittest_create_lease(Id :: rt_chord:key()) -> lease_t()

### unittest_create_lease_with_range/3

    unittest_create_lease_with_range(From :: rt_chord:key(),
                                     To :: rt_chord:key(),
                                     Owner :: comm:mypid_plain()) ->
                                        lease_t()

### new_timeout/0

    new_timeout() -> erlang_timestamp()

### is_a_lease/1

    is_a_lease(L :: term()) -> boolean()

### get_version/1

    get_version(Lease :: lease_t()) -> non_neg_integer()

### set_version/2

    set_version(Lease :: lease_t(), Version :: non_neg_integer()) ->
                   lease_t()

### get_epoch/1

    get_epoch(Lease :: lease_t()) -> non_neg_integer()

### set_epoch/2

    set_epoch(Lease :: lease_t(), Epoch :: non_neg_integer()) ->
                 lease_t()

### set_timeout/1

    set_timeout(Lease :: lease_t()) -> lease_t()

### get_timeout/1

    get_timeout(Lease :: lease_t()) -> erlang_timestamp()

### get_pretty_timeout/1

    get_pretty_timeout(L :: lease_t()) -> string()

### get_id/1

    get_id(Lease :: lease_t()) -> rt_chord:key()

### get_owner/1

    get_owner(Lease :: lease_t()) -> comm:mypid_plain() | nil

### set_owner/2

    set_owner(L :: lease_t(), NewOwner :: comm:mypid_plain() | nil) ->
                 lease_t()

### get_aux/1

    get_aux(Lease :: lease_t()) -> lease_aux()

### set_aux/2

    set_aux(L :: lease_t(), Aux :: lease_aux()) -> lease_t()

### get_range/1

    get_range(Lease :: lease_t()) -> intervals:interval()

### set_range/2

    set_range(L :: lease_t(), Range :: intervals:interval()) ->
                 lease_t()

### is_valid/1

    is_valid(L :: lease_t()) -> boolean()

### has_timed_out/1

    has_timed_out(L :: lease_t()) -> boolean()

### id/1

    id(X :: intervals:interval()) -> rt_chord:key()

### split_range/1

    split_range(Range :: intervals:interval()) ->
                   {ok, intervals:interval(), intervals:interval()}

Generated by EDoc, Apr 22 2017, 15:58:19.