poa-netstats-warehouse/doc/POABackend.Protocol.html

206 lines
5.4 KiB
HTML
Raw Normal View History

2018-07-06 09:32:03 -07:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
2018-08-10 14:58:29 -07:00
<meta name="generator" content="ExDoc v0.18.4">
2018-07-06 09:32:03 -07:00
<title>POABackend.Protocol poa_backend v0.1.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />
2018-09-05 05:08:57 -07:00
<script src="dist/sidebar_items-f62ce50de1.js"></script>
2018-07-06 09:32:03 -07:00
</head>
<body data-type="modules">
<script>try { if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; } catch (e) { }</script>
<div class="main">
<button class="sidebar-button sidebar-toggle">
<span class="icon-menu" aria-hidden="true"></span>
<span class="sr-only">Toggle Sidebar</span>
</button>
<button class="sidebar-button night-mode-toggle">
<span class="icon-theme" aria-hidden="true"></span>
<span class="sr-only">Toggle Theme</span>
</button>
<section class="sidebar">
2018-08-10 14:58:29 -07:00
<a href="POABackend.html" class="sidebar-projectLink">
2018-07-06 09:32:03 -07:00
<div class="sidebar-projectDetails">
<h1 class="sidebar-projectName">
poa_backend
</h1>
<h2 class="sidebar-projectVersion">
v0.1.0
</h2>
</div>
</a>
<form class="sidebar-search" action="search.html">
<button type="submit" class="search-button">
<span class="icon-search" aria-hidden="true"></span>
</button>
<input name="q" type="text" id="search-list" class="search-input" placeholder="Search" aria-label="Search" autocomplete="off" />
</form>
<ul class="sidebar-listNav">
<li><a id="extras-list" href="#full-list">Pages</a></li>
<li><a id="modules-list" href="#full-list">Modules</a></li>
</ul>
<div class="gradient"></div>
<ul id="full-list" class="sidebar-fullList"></ul>
</section>
<section class="content">
<div class="content-outer">
<div id="content" class="content-inner">
<h1>
<small class="visible-xs">poa_backend v0.1.0</small>
POABackend.Protocol
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/protocol.ex#L1" title="View Source" class="view-source" rel="help">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
</h1>
<section id="moduledoc">
<h2 id="module-poa-protocol" class="section-heading">
<a href="#module-poa-protocol" class="hover-link"><span class="icon-link" aria-hidden="true"></span></a>
POA Protocol
</h2>
<p>This protocol defines the communication between the Agents and the POA Backend.</p>
<p><img src="./backend_architecture.png" alt="POA Backend Architecture"/></p>
<h3 id="module-basic-calls" class="section-heading">
<a href="#module-basic-calls" class="hover-link"><span class="icon-link" aria-hidden="true"></span></a>
Basic calls
</h3>
<p>Only those calls are allowed:</p>
<ul>
2018-08-10 14:58:29 -07:00
<li>session - In order to generate a token/session for authentication/authorization
2018-07-06 09:32:03 -07:00
</li>
<li>ping - Ping message
</li>
<li>data - Specific message for a given receiver. It can be a metric itself or something else
</li>
<li>bye - Message sent when the Agent wants to close the communication explicitly
</li>
</ul>
2018-08-10 14:58:29 -07:00
<h4>session call</h4>
<p>This call is for generate a valid token/session in order to get access to the other calls</p>
2018-07-06 09:32:03 -07:00
<p>abstract request:</p>
<pre><code class="json">{
2018-08-10 14:58:29 -07:00
user: String() # user name
password: String()
}
response:
</code></pre>
<p>{
token: String() # this token must be attached to each call
}</p>
<pre><code class="elixir">
#### ping call
abstract request:
</code></pre>
<p>{
2018-07-06 09:32:03 -07:00
id: String() # agent id
2018-08-10 14:58:29 -07:00
token: String() # generated with a valid user/password calling the <em>session call</em>
}</p>
<pre><code class="elixir">
response:
</code></pre>
<p>{
2018-07-06 09:32:03 -07:00
result: String() # “success” or “error”
payload: String() # optional payload
2018-08-10 14:58:29 -07:00
}</p>
<pre><code class="elixir">
#### data call
abstract request:
</code></pre>
<p>{
2018-07-06 09:32:03 -07:00
id: String() # agent id
2018-08-10 14:58:29 -07:00
token: String() # generated with a valid user/password calling the <em>session call</em>
2018-07-06 09:32:03 -07:00
type: String() # data type (for now only ethereum_metrics)
data: Object() # metric data itself
2018-08-10 14:58:29 -07:00
}</p>
<pre><code class="elixir">
response:
</code></pre>
<p>{
2018-07-06 09:32:03 -07:00
result: String() # “success” or “error”
payload: String() # optional payload
2018-08-10 14:58:29 -07:00
}</p>
<pre><code class="elixir">
#### bye call
abstract request:
</code></pre>
<p>{
2018-07-06 09:32:03 -07:00
id: String() # agent id
2018-08-10 14:58:29 -07:00
token: String() # generated with a valid user/password calling the <em>session call</em>
}</p>
<pre><code class="elixir">
response:
</code></pre>
<p>{
2018-07-06 09:32:03 -07:00
result: String() # “success” or “error”
payload: String() # optional payload
2018-08-10 14:58:29 -07:00
}</p>
<pre><code class="elixir"></code></pre>
2018-07-06 09:32:03 -07:00
</section>
<footer class="footer">
<p>
<span class="line">
Built using
2018-08-10 14:58:29 -07:00
<a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" rel="help" target="_blank">ExDoc</a> (v0.18.4),
2018-07-06 09:32:03 -07:00
</span>
<span class="line">
designed by
<a href="https://twitter.com/dignifiedquire" target="_blank" title="@dignifiedquire">Friedel Ziegelmayer</a>.
</span>
</p>
</footer>
</div>
</div>
</section>
</div>
<script src="dist/app-9bd040e5e5.js"></script>
</body>
</html>