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.

Ticker([tick_interval]) Clock ticker for query timers
QueryEntry([expire_after, callback_expire, ...]) Querying entry
class query_management.QueryEntry(expire_after=30, callback_expire=None, callback=None, callback_error=None, interval=0, data={}, retry_count=-1)[source]

Bases: object

Querying entry

callback()[source]

Call a callback function for successful case

Returns:
callback_error()[source]

Call a callback function for failure case

Returns:
deactivate()[source]

Deactivate the entry

Returns:
fire()[source]

Fire the entry

Returns:
force_expire()[source]

Forcibly make the entry expire

Returns:
rest_of_time_to_expire()[source]

Get the rest of time to expire :return:

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

Update the entry information

Parameters:
  • fire_after
  • callback
  • callback_error
Returns:

update_expiration_time(expire_after)[source]

Update the expire timer

Parameters:expire_after
Returns:
class query_management.Ticker(tick_interval=0.049)[source]

Bases: object

Clock ticker for query timers

add_entry(entry)[source]
del_entry(nonce)[source]
get_entry(nonce)[source]
refresh_timer()[source]
tick_loop()[source]
update_timer(nonce, append_new_flag)[source]
query_management.exec_func_after(func, after)[source]

Simple timer utility to call function after specified time (second)

Parameters:
  • func
  • after
Returns:

query_management.get_ticker(tick_interval=0.049)[source]