# Module api_json_tx

- Description
- Data Types
- Function Index
- Function Details

JSON API for transactional, consistent access to replicated DHT items.

Copyright © 2012 Zuse Institute Berlin

Version: $Id$

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

## Description

JSON API for transactional, consistent access to replicated DHT items.

## Data Types

### client_key()

    client_key() = [unicode_char()]

### client_value()

    client_value() = any()

### commit_result()

    commit_result() =
        {struct,
         [{status, string()} |
          {reason, string()} |
          {keys, {array, [string()]}}]}

### read_result()

    read_result() =
        {struct,
         [{status, string()} | {reason, string()} | {value, value()}]}

### request()

    request() =
        {string(), client_key()} |
        {string(), {struct, [{client_key(), value()}]}} |
        {string(),
         {struct,
          [{string(), client_key()} |
           {string(), {array, [client_value()]}}]}} |
        {string(), {struct, [{client_key(), client_value()}]}} |
        {string(),
         {struct, [{string(), client_key()} | {string(), value()}]}} |
        {string(), any()}

### result()

    result() = read_result() | write_result() | commit_result()

### unicode_char()

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

### value()

    value() =
        {struct,
         [{type | string(), string()} |
          {value | string(), client_value()}]}

### write_result()

    write_result() =
        {struct, [{status, string()} | {reason, string()}]}

## Function Index

add_del_on_list/3 |
add_on_nr/2 |
handler/2 |
json_to_value/1 |
read/1 |
req_list/1 |
req_list/2 |
req_list_commit_each/1 |
result_to_json/1 |
results_to_json/1 |
test_and_set/3 |
value_to_json/1 |
write/2 |

## Function Details

### handler/2

    handler(AnyOp :: atom(), AnyParams :: list()) -> any()

### req_list/1

    req_list(ReqList :: {array, [request()]}) ->
                {struct,
                 [{tlog, string()} | {results, {array, [result()]}}]}

### req_list/2

    req_list(JSON_TLog :: string(),
             JSON_ReqList :: {array, [request()]}) ->
                {struct,
                 [{tlog, string()} | {results, {array, [result()]}}]}

### read/1

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

### write/2

    write(Key :: client_key(), Value :: value()) -> commit_result()

### add_del_on_list/3

    add_del_on_list(Key :: client_key(),
                    ToAdd :: {array, [client_value()]},
                    ToRemove :: {array, [client_value()]}) ->
                       commit_result() |
                       {struct,
                        [{status, string()} | {reason, string()}]}

### add_on_nr/2

    add_on_nr(Key :: client_key(), ToAdd :: number()) ->
                 commit_result() |
                 {struct, [{status, string()} | {reason, string()}]}

### test_and_set/3

    test_and_set(Key :: client_key(),
                 OldValue :: value(),
                 NewValue :: value()) ->
                    commit_result() |
                    {struct,
                     [{status, string()} |
                      {reason, string()} |
                      {value, value()}]}

### req_list_commit_each/1

    req_list_commit_each(JSON_ReqList :: {array, [request()]}) ->
                            {array, [result()]}

### results_to_json/1

    results_to_json(Results :: [api_tx:result()]) ->
                       {array, [result()]}

### result_to_json/1

    result_to_json(Result :: api_tx:result()) -> result()

### value_to_json/1

    value_to_json(Value :: client_value()) -> {value, value()}

### json_to_value/1

    json_to_value(X1 :: value()) -> client_value()

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