Skip to content

Commit

Permalink
scaffold, prototype scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Netherdrake committed Apr 18, 2017
0 parents commit ecf989d
Show file tree
Hide file tree
Showing 16 changed files with 1,136 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg


# dotenv
.env

# Rope project settings
.ropeproject

# Vim
Session.vim

# Pycharm
.idea

# junk
blocks.json

# sqlite db for testing
local.db
/tests/fastest-test.sh
/tests/sbds-install.sh
/tests/test.sh
/tests/fast-test.sh
/tests/sync.sh
/tests/failed_blocks/
/envd
!/sbds.egg-info/
/tests/envdir-to-envfile.sh
*.db
envfile
/deploy
112 changes: 112 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit tests / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env
envfile

# virtualenv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

# Vim
Session.vim

# Pycharm
.idea

# sqlite db for testing
*.db
/tests/fast-test.sh
/tests/fastest-test.sh
/tests/sbds-install.sh
/tests/test.sh
/tests/sync.sh
/tests/failed_blocks/
tests/failed_blocks/
/envdir/
/sbds.egg-info/
/envd/
/tests/envdir-to-envfile.sh
/deploy/
/scripts/hive.sqlite
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3.5.3
MAINTAINER furion <furion@steemit.com>

COPY . /src
WORKDIR /src

RUN pip install ipython
RUN pip install -r requirements.txt

EXPOSE 5000

#CMD ["python", "app.py"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Steemit Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
47 changes: 47 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
SHELL := /bin/bash
ROOT_DIR := $(shell pwd)

PROJECT_NAME := hive
PROJECT_DOCKER_TAG := steemit/$(PROJECT_NAME)
PROJECT_DOCKER_RUN_ARGS := -p8080:8080

default: build

.PHONY: test run test-without-lint test-pylint fmt test-without-build build

build:
docker build -t $(PROJECT_DOCKER_TAG) .

run:
docker run $(PROJECT_DOCKER_RUN_ARGS) $(PROJECT_DOCKER_TAG)

test: test-without-build build

test-without-build: test-without-lint test-pylint


test-without-lint:
py.test tests

test-pylint:
py.test --pylint -m pylint $(PROJECT_NAME)

fmt:
yapf --recursive --in-place --style pep8 .
autopep8 --recursive --in-place .

requirements.txt: serve.py
pip freeze > $@

clean: clean-build clean-pyc

clean-build:
rm -fr build/ dist/ *.egg-info .eggs/ .tox/ __pycache__/ .cache/ .coverage htmlcov src

clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +

install: clean
pip install -e .
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
`hivemind` is an off-chain consensus layer for Steem communities and API server for social features like feeds and follows.

It is primarily concerned with indexing specific `custom_json` namespaces but also watches for posts, votes, and account creations.

[Community Spec Draft](https://github.com/steemit/condenser/wiki/Community-Spec-%5BDRAFT%5D)


Upon reindexing/following the blockchain, the following tables are populated:

### Core

- `hive_blocks`: basic linked list of blocks to save current head block and ensure sequential processing
- `hive_accounts`: basic account index. may be supplanted with cached data
- `hive_posts`: main post index. contains core immutable metadata as well as community states
- `hive_follows`: all follows and their creation date
- `hive_reblogs`: all reblog actions (account, post, date)
- `hive_posts_cache`: updated with latest state of posts as new blocks come in (removing need to query steemd)

### Community

- `hive_communities`: registered community data
- `hive_members`: roles of accounts within each community, and metadata
- `hive_flags`: track all community flag operations for mods to review
- `hive_modlog`: tracks all `hivemind` related operations for auditability
12 changes: 12 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
pytest
pytest-runner
pytest-pylint
pep8
yapf
sphinx
recommonmark
sphinxcontrib-restbuilder
sphinxcontrib-programoutput
pytest-console-scripts
sphinxcontrib-napoleon
sphinx_rtd_theme
1 change: 1 addition & 0 deletions hive/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# coding=utf-8
Loading

0 comments on commit ecf989d

Please sign in to comment.