Use new connection class in pipeline

This commit is contained in:
vrde 2016-09-07 00:54:19 +02:00
parent 7097efaa33
commit 52243e1271
No known key found for this signature in database
GPG Key ID: 6581C7C39B3D397D
2 changed files with 16 additions and 13 deletions

View File

@ -53,10 +53,10 @@ class Block:
Returns: Returns:
The transaction. The transaction.
""" """
r.table('backlog')\ self.bigchain.connection.run(
.get(tx['id'])\ r.table('backlog')
.delete(durability='hard')\ .get(tx['id'])
.run(self.bigchain.conn) .delete(durability='hard'))
return tx return tx
@ -118,12 +118,14 @@ def initial():
b = Bigchain() b = Bigchain()
rs = r.table('backlog')\ rs = b.connection.run(
.between([b.me, r.minval], r.table('backlog')
[b.me, r.maxval], .between(
index='assignee__transaction_timestamp')\ [b.me, r.minval],
.order_by(index=r.asc('assignee__transaction_timestamp'))\ [b.me, r.maxval],
.run(b.conn) index='assignee__transaction_timestamp')
.order_by(index=r.asc('assignee__transaction_timestamp')))
return rs return rs

View File

@ -25,9 +25,10 @@ class Election:
""" """
Checks if block has enough invalid votes to make a decision Checks if block has enough invalid votes to make a decision
""" """
next_block = r.table('bigchain')\ next_block = self.bigchain.connection.run(
.get(next_vote['vote']['voting_for_block'])\ r.table('bigchain')
.run(self.bigchain.conn) .get(next_vote['vote']['voting_for_block']))
if self.bigchain.block_election_status(next_block) == self.bigchain.BLOCK_INVALID: if self.bigchain.block_election_status(next_block) == self.bigchain.BLOCK_INVALID:
return next_block return next_block