# Module webhelpers

- Description
- Data Types
- Function Index
- Function Details

web helpers module for mgmt server to generate the web interface.

Copyright © 2007-2016 Zuse Institute Berlin,

Version: $Id$

Authors: Thorsten Schuett (`schuett@zib.de`).

## Description

web helpers module for mgmt server to generate the web interface

## Data Types

### attribute_type()

    attribute_type() = {atom(), string()}

### client_version()

    client_version() = non_neg_integer()

### html_type()

    html_type() =
        {atom(),
         [attribute_type()],
         html_type() | [html_type()] | string()}

## Function Index

delete_key/2 |
flush_ring_cache/0 |
format_centroids/1 | Convert a list of centroids into a JSON string.
format_nodes/1 | Format Nodes as returned by getVivaldiMap() into JSON.
getDCClustersAndNodes/0 |
getGossipRendered/0 |
getIndexedRingRendered/0 |
getMonitorClientData/0 |
getMonitorRingData/0 |
getRingChart/0 |
getRingRendered/0 |
getVivaldiMap/0 |
get_and_cache_ring/0 |
html_pre/2 | Pre-formats a string (useful for reading erlang terms).
isPost/1 | Checks whether the current request is a post operation.
lookup/1 |
safe_html_string/1 | Escapes angle brackets within the string with their HTML counter parts so that content is not mis-interpreted as HTML tags.
safe_html_string/2 | Formats the data with the format string and escapes angle brackets with their HTML counter parts so that content is not mis-interpreted as HTML tags.
set_key/2 |

## Function Details

### isPost/1

    isPost(A :: #arg{req = #http_request{method = atom()}}) ->
              boolean()

Checks whether the current request is a post operation.

### lookup/1

    lookup(Key :: rt_chord:key()) ->
              {TimeInMs :: integer(),
               Result ::
                   {Value :: db_dht:value(),
                    Version :: client_version()} |
                   {fail, not_found} |
                   {fail, timeout} |
                   {fail, fail}}

### set_key/2

    set_key(Key :: rt_chord:key(), Value :: db_dht:value()) ->
               {TimeInMs :: integer(),
                Result ::
                    commit |
                    userabort |
                    {fail, not_found} |
                    {fail, timeout} |
                    {fail, fail} |
                    {fail, abort}}

### delete_key/2

    delete_key(Key :: rt_chord:key(), Timeout :: pos_integer()) ->
                  {TimeInMs :: integer(),
                   Result ::
                       {ok, pos_integer(), list()} |
                       {fail, timeout} |
                       {fail, timeout, pos_integer(), list()}}

### getVivaldiMap/0

    getVivaldiMap() ->
                     [{{comm:mypid(), node_details:hostname()},
                       gossip_vivaldi:network_coordinate()}]

### format_nodes/1

    format_nodes(Nodes ::
                     [{{comm:mypid(), node_details:hostname()},
                       gossip_vivaldi:network_coordinate()}]) ->
                    string()

Format Nodes as returned by getVivaldiMap() into JSON.

### getDCClustersAndNodes/0

    getDCClustersAndNodes() ->
                             {[{comm:mypid(),
                                gossip_vivaldi:network_coordinate()}],
                              dc_centroids:centroids(),
                              non_neg_integer(),
                              float()} |
                             disabled

### format_centroids/1

    format_centroids(Centroids :: [dc_centroids:centroid()]) ->
                        string()

Convert a list of centroids into a JSON string

### get_and_cache_ring/0

    get_and_cache_ring() -> statistics:ring()

### flush_ring_cache/0

    flush_ring_cache() -> ok

### getRingChart/0

    getRingChart() -> [html_type()]

### getRingRendered/0

    getRingRendered() -> html_type()

### getIndexedRingRendered/0

    getIndexedRingRendered() -> html_type()

### getGossipRendered/0

    getGossipRendered() -> html_type()

### getMonitorClientData/0

    getMonitorClientData() -> html_type()

### getMonitorRingData/0

    getMonitorRingData() -> [html_type()]

### safe_html_string/2

    safe_html_string(Format :: io:format(), Data :: [term()]) ->
                        string()

Formats the data with the format string and escapes angle brackets with their HTML counter parts so that content is not mis-interpreted as HTML tags.

### safe_html_string/1

    safe_html_string(String :: io_lib:chars()) -> string()

Escapes angle brackets within the string with their HTML counter parts so that content is not mis-interpreted as HTML tags.

### html_pre/2

    html_pre(Format :: io:format(), Data :: [term()]) -> string()

Pre-formats a string (useful for reading erlang terms)

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