# Module rr_resolve

- Description
- Data Types
- Function Index
- Function Details

replica update resolve module Updates local and/or remote Key-Value-Pairs (kv-pair) Modes: 1) key_upd: updates local db entries with received kvv-list, if received kv is newer 2) key_upd_send: creates kvv-list out of a given key-list and sends it to dest 3) interval_upd: works like key_upd + sends all own db entries which are not in received kvv-list to the feedback pid (if given) 4) interval_upd_send: creates kvv-list from given interval and sends it to dest 5) interval_upd_my: tries to resolve items from the given interval by requesting data from replica nodes Options: 1) Feedback: sends data ids to Node (A) which are outdated at (A) 2) Send_Stats: sends resolution stats to given pid Usage: rrepair process provides API for resolve requests.

Copyright © 2011-2015 Zuse Institute Berlin

Version: $Id$

Behaviours: `gen_component`.

Authors: Maik Lange (`malange@informatik.hu-berlin.de`).

## Description

replica update resolve module Updates local and/or remote Key-Value-Pairs (kv-pair) Modes: 1) key_upd: updates local db entries with received kvv-list, if received kv is newer 2) key_upd_send: creates kvv-list out of a given key-list and sends it to dest 3) interval_upd: works like key_upd + sends all own db entries which are not in received kvv-list to the feedback pid (if given) 4) interval_upd_send: creates kvv-list from given interval and sends it to dest 5) interval_upd_my: tries to resolve items from the given interval by requesting data from replica nodes Options: 1) Feedback: sends data ids to Node (A) which are outdated at (A) 2) Send_Stats: sends resolution stats to given pid Usage: rrepair process provides API for resolve requests

## Data Types

### client_version()

    client_version() = non_neg_integer()

### kvv_list()

    kvv_list() =
        [{rt_chord:key(), db_dht:value(), client_version()}]

### message()

    message() =
        {start, operation(), options(), StartTag :: atom()} |
        {get_entries_response, db_dht:db_as_list()} |
        {get_state_response, intervals:interval()} |
        {update_key_entries_ack,
         [{db_entry:entry_ex(),
           Exists :: boolean(),
           Done :: boolean()}]} |
        {'DOWN',
         MonitorRef :: reference(),
         process,
         Owner :: pid(),
         Info :: any()}

### operation()

    operation() =
        {103,
         KvvListInAnyQ :: kvv_list(),
         ReqKeys :: [rt_chord:key()]} |
        {key_upd_send,
         DestPid :: comm:mypid(),
         SendKeys :: [rt_chord:key()],
         ReqKeys :: [rt_chord:key()]} |
        {104, intervals:interval(), KvvListInAnyQ :: kvv_list()} |
        {interval_upd_send,
         intervals:interval(),
         DestPid :: comm:mypid()} |
        {interval_upd_my, intervals:interval()}

### option()

    option() =
        {feedback_request, comm:mypid()} | {from_my_node, 0 | 1}

### options()

    options() = [option()]

### state()

    state() =
        #rr_resolve_state{ownerPid = pid(),
                          operation = undefined | operation(),
                          my_range = undefined | intervals:interval(),
                          fb_dest_pid = undefined | comm:mypid(),
                          fb_send_kvv = kvv_list(),
                          fb_had_kvv_req = boolean(),
                          fb_send_kvv_req = kvv_list(),
                          other_kv_tree =
                              gb_trees:tree(rt_chord:key(),
                                            client_version()),
                          stats = stats(),
                          from_my_node = 0 | 1}

### stats()

    stats() =
        #resolve_stats{session_id = rrepair:session_id() | null,
                       diff_size = non_neg_integer(),
                       regen_count = non_neg_integer(),
                       update_count = non_neg_integer(),
                       upd_fail_count = non_neg_integer(),
                       regen_fail_count = non_neg_integer()}

## Function Index

get_stats_session_id/1 |
init/1 |
merge_stats/2 | Merges two stats records with an identical session_id (otherwise error will be raised).
merge_stats_feeder/2 |
on/2 |
print_resolve_stats/1 |
start/1 |
start_gen_component/5 |

## Function Details

### start_gen_component/5

    start_gen_component(Module :: module(),
                        Handler :: gen_component:handler(),
                        Args :: term(),
                        Options :: [gen_component:option()],
                        Self :: pid()) ->
                           no_return() | ok

### on/2

    on(Msg :: message(), State :: state()) -> state() | kill

### get_stats_session_id/1

    get_stats_session_id(Stats :: stats()) ->
                            rrepair:session_id() | null

### merge_stats_feeder/2

    merge_stats_feeder(A :: stats(), B :: stats()) ->
                          {stats(), stats()}

### merge_stats/2

    merge_stats(Resolve_stats :: stats(), X2 :: stats()) -> stats()

Merges two stats records with an identical session_id (otherwise error will be raised).

### print_resolve_stats/1

    print_resolve_stats(Stats :: stats()) -> [any()]

### init/1

    init(State :: state()) -> state()

### start/1

    start(SessionId :: rrepair:session_id() | null) ->
             {ok, MyPid :: pid()}

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