mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
initial commit
This commit is contained in:
parent
e15d4ce39c
commit
14ffe739a5
@ -10,7 +10,9 @@ import bigchaindb
|
||||
import bigchaindb.config_utils
|
||||
from bigchaindb import exceptions
|
||||
from bigchaindb.crypto import hash_data, PublicKey, PrivateKey, generate_key_pair
|
||||
from bigchaindb.monitor import Monitor
|
||||
|
||||
c = Monitor()
|
||||
|
||||
class GenesisBlockAlreadyExistsError(Exception):
|
||||
pass
|
||||
@ -67,6 +69,7 @@ class Bigchain(object):
|
||||
def reconnect(self):
|
||||
return r.connect(host=self.host, port=self.port, db=self.dbname)
|
||||
|
||||
@c.timer('create_transaction', rate=0.01)
|
||||
def create_transaction(self, current_owner, new_owner, tx_input, operation, payload=None):
|
||||
"""Create a new transaction
|
||||
|
||||
@ -176,6 +179,7 @@ class Bigchain(object):
|
||||
public_key = PublicKey(public_key_base58)
|
||||
return public_key.verify(self.serialize(data), signature)
|
||||
|
||||
@c.timer('write_transaction', rate=0.01)
|
||||
def write_transaction(self, signed_transaction):
|
||||
"""Write the transaction to bigchain.
|
||||
|
||||
@ -312,6 +316,7 @@ class Bigchain(object):
|
||||
|
||||
return owned
|
||||
|
||||
@c.timer('validate_transaction', rate=0.01)
|
||||
def validate_transaction(self, transaction):
|
||||
"""Validate a transaction.
|
||||
|
||||
@ -389,6 +394,7 @@ class Bigchain(object):
|
||||
exceptions.InvalidHash, exceptions.InvalidSignature):
|
||||
return False
|
||||
|
||||
@c.timer('create_block')
|
||||
def create_block(self, validated_transactions):
|
||||
"""Creates a block given a list of `validated_transactions`.
|
||||
|
||||
@ -424,6 +430,7 @@ class Bigchain(object):
|
||||
|
||||
return block
|
||||
|
||||
@c.timer('validate_block')
|
||||
# TODO: check that the votings structure is correctly constructed
|
||||
def validate_block(self, block):
|
||||
"""Validate a block.
|
||||
|
11
bigchaindb/monitor.py
Normal file
11
bigchaindb/monitor.py
Normal file
@ -0,0 +1,11 @@
|
||||
import statsd
|
||||
from os import getppid
|
||||
from platform import node
|
||||
|
||||
class Monitor(statsd.StatsClient):
|
||||
def __init__(self, *args, **kwargs):
|
||||
if not kwargs:
|
||||
kwargs = {}
|
||||
if not kwargs.get('prefix'):
|
||||
kwargs['prefix'] = '{hostname}_{pid}.'.format(hostname=node(), pid=getppid())
|
||||
super().__init__(*args, **kwargs)
|
@ -24,7 +24,33 @@ bigchaindb:
|
||||
- ~/.bigchaindb_docker:/root/.bigchaindb_docker
|
||||
links:
|
||||
- rethinkdb
|
||||
- statsd:localhost
|
||||
environment:
|
||||
BIGCHAIN_DATABASE_HOST: rethinkdb
|
||||
BIGCHAINDB_CONFIG_PATH: /root/.bigchaindb_docker/config
|
||||
command: bigchaindb start
|
||||
|
||||
influxdb:
|
||||
image: tutum/influxdb
|
||||
ports:
|
||||
- "8083:8083"
|
||||
- "8086:8086"
|
||||
expose:
|
||||
- "8090"
|
||||
- "8099"
|
||||
environment:
|
||||
PRE_CREATE_DB: "telegraf"
|
||||
|
||||
grafana:
|
||||
build: ~/grafana-bigchaindb-docker
|
||||
ports:
|
||||
- "3000:3000"
|
||||
links:
|
||||
- influxdb:localhost
|
||||
|
||||
statsd:
|
||||
image: rhsimplex/docker-telegraf-statsd
|
||||
expose:
|
||||
- "8125/udp"
|
||||
links:
|
||||
- influxdb:localhost
|
Loading…
x
Reference in New Issue
Block a user