Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hivemind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
hivemind
Commits
ee1ab308
Commit
ee1ab308
authored
7 years ago
by
furion
Browse files
Options
Downloads
Patches
Plain Diff
[docs] update documentation
parent
a8b60cfe
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
README.md
+3
-12
3 additions, 12 deletions
README.md
docs/cli.rst
+26
-0
26 additions, 0 deletions
docs/cli.rst
docs/modules.rst
+23
-1
23 additions, 1 deletion
docs/modules.rst
hive/cli.py
+2
-5
2 additions, 5 deletions
hive/cli.py
hive/server/serve.py
+0
-8
0 additions, 8 deletions
hive/server/serve.py
with
54 additions
and
26 deletions
README.md
+
3
−
12
View file @
ee1ab308
...
@@ -2,20 +2,10 @@
...
@@ -2,20 +2,10 @@
`hivemind`
is an off-chain consensus layer for Steem communities and API server for social features like feeds and follows.
`hivemind`
is an off-chain consensus layer for Steem communities and API server for social features like feeds and follows.
# Dev Environment
# Dev Environment
Make sure you have Python 3.5+, Docker and MySQL installed on your local machine.
Prepare MySQL Database (once):
```
make mysql
```
Prepare and load REPL (on change):
```
make build
make iypthon
```
## Setting up MySQL
## Setting up MySQL
First, we need to s
etup
a MySQL server
. An easy way to do that
(in Docker)
is to run:
First, we need to s
tart
a MySQL server (in Docker)
.
```
```
make mysql
make mysql
```
```
...
@@ -24,6 +14,7 @@ Then we need to set `DATABASE_URL` environment variable, for example:
...
@@ -24,6 +14,7 @@ Then we need to set `DATABASE_URL` environment variable, for example:
```
```
set DATABASE_URL 'mysql://root:root_password@mysql:3306/testdb'
set DATABASE_URL 'mysql://root:root_password@mysql:3306/testdb'
```
```
*I defined `mysql` in `/etc/hosts` such that it links to mysql docker container IP.*
Lastly we invoke the
`ensure-schema`
command to create MySQL tables.
Lastly we invoke the
`ensure-schema`
command to create MySQL tables.
...
...
This diff is collapsed.
Click to expand it.
docs/cli.rst
+
26
−
0
View file @
ee1ab308
...
@@ -2,6 +2,32 @@ hive-cli
...
@@ -2,6 +2,32 @@ hive-cli
~~~~~~~~
~~~~~~~~
`hive` is a convenient CLI utility that enables you to manage the indexer, or spin up the `JSON-RPC` server.
`hive` is a convenient CLI utility that enables you to manage the indexer, or spin up the `JSON-RPC` server.
Usage
-----
::
~/G/s/hive % hive -h
Usage: hive [OPTIONS] COMMAND [ARGS]...
The *hive* CLI manages database, indexer and the server.
For more detailed information on a command and its flags, run:
hive COMMAND --help
Options:
-h, --help Show this message and exit.
Commands:
db Database Level Operations.
indexer Parse the blockchain and index the MySQL...
server HTTP server for answering DB queries
Database Commands
-----------------
Todo
Server Commands
Server Commands
---------------
---------------
Todo
Todo
...
...
This diff is collapsed.
Click to expand it.
docs/modules.rst
+
23
−
1
View file @
ee1ab308
Modules
Modules
~~~~~~~
~~~~~~~
``
hive
``
is comprised of the following modules:
**
hive
**
is comprised of the following modules:
- ``hive.indexer``
- ``hive.indexer``
- ``hive.db``
- ``hive.server``
- ``hive.server``
- ``hive.extras``
- ``hive.extras``
...
@@ -22,6 +23,27 @@ hive.server
...
@@ -22,6 +23,27 @@ hive.server
.. automodule:: hive.server
.. automodule:: hive.server
:members:
:members:
Health Check
------------
To perform a health check, perform a `GET` on ``/health``.
Returns 200 if everything is OK, and 500 /w json error message otherwise.
JSON-RPC Example
----------------
.. code-block:: python
from jsonrpcclient.http_client import HTTPClient
HTTPClient('http://localhost:1234').request('hive.status')
Outputs:
::
--> {"jsonrpc": "2.0", "method": "hive.status", "id": 8}
<-- {"result": {"diff": 6396850, "hive": 5042966, "steemd": 11439816}, "id": 8, "jsonrpc": "2.0"} (200 OK)
Result: {'diff': 6396850, 'hive': 5042966, 'steemd': 11439816}
--------
--------
hive.extras
hive.extras
...
...
This diff is collapsed.
Click to expand it.
hive/cli.py
+
2
−
5
View file @
ee1ab308
...
@@ -11,11 +11,8 @@ context_settings = dict(help_option_names=['-h', '--help'])
...
@@ -11,11 +11,8 @@ context_settings = dict(help_option_names=['-h', '--help'])
context_settings
=
context_settings
,
context_settings
=
context_settings
,
)
)
def
cli
():
def
cli
():
"""
The *hive* CLI manages storage, retrieval, and querying of the Steem
"""
The *hive* CLI manages database, indexer and the server.
blockchain.
hive has several commands, each of which has additional subcommands.
\b
\b
For more detailed information on a command and its flags, run:
For more detailed information on a command and its flags, run:
hive COMMAND --help
hive COMMAND --help
...
...
This diff is collapsed.
Click to expand it.
hive/server/serve.py
+
0
−
8
View file @
ee1ab308
...
@@ -85,14 +85,6 @@ json_rpc_methods = {
...
@@ -85,14 +85,6 @@ json_rpc_methods = {
for
method_name
,
fn_call
in
json_rpc_methods
.
items
():
for
method_name
,
fn_call
in
json_rpc_methods
.
items
():
jsonrpc
.
register_method
(
method
=
fn_call
,
method_name
=
method_name
)
jsonrpc
.
register_method
(
method
=
fn_call
,
method_name
=
method_name
)
# TODO: add to documentation
# In [9]: from jsonrpcclient.http_client import HTTPClient
#
# In [10]: HTTPClient('http://localhost:1234').request('hive.status')
# --> {"jsonrpc": "2.0", "method": "hive.status", "id": 8}
# <-- {"result": {"diff": 6396850, "hive": 5042966, "steemd": 11439816}, "id": 8, "jsonrpc": "2.0"} (200 OK)
# Out[10]: {'diff': 6396850, 'hive': 5042966, 'steemd': 11439816}
# WSGI application
# WSGI application
# ----------------
# ----------------
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment