bbc1.core.query_management module

Copyright (c) 2017 beyond-blockchain.org.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class bbc1.core.query_management.QueryEntry(expire_after=30, callback_expire=None, callback=None, callback_error=None, interval=0, data={}, retry_count=-1)[source]

Bases: object

Callback manager

callback()[source]

Call a callback function for successful case

callback_error()[source]

Call a callback function for failure case

deactivate()[source]

Deactivate the entry

update(fire_after=None, expire_after=None, callback=None, callback_error=None, init=False)[source]

Update the entry information

Parameters:
  • fire_after (float) – set callback (periodical) to fire after given time (in second)
  • expire_after (float) – set expiration timer to given time (in second)
  • callback (obj) – callback method that will be called periodically
  • callback_error (obj) – callback method that will be called when error happens
  • init (bool) – If True, the scheduler is sorted again
update_expiration_time(expire_after)[source]

Update the expire timer

Parameters:expire_after (float) – new expiration time in second
class bbc1.core.query_management.Ticker(tick_interval=0.049)[source]

Bases: object

Clock ticker for query timers

del_entry(nonce)[source]

Delete an entry from the scheduler identified by nonce

get_entry(nonce)[source]

Get an entry identified by nonce

bbc1.core.query_management.get_ticker(tick_interval=0.049)[source]