dragonfly.implementations.kv_store module

Some template vars

Members: kv_store kv_store_key times2 times3 Functions: Classes:

kv_store.py

A simple key-value store which is a dripline provider. The endpoints of this provider are associated with keys, and are determined by the configuration file. For example, if the configuration file has a provider section that looks like this:

providers:
  - name: kv_example
    module: kv_store
    endpoints:
      -name: foo
        module: kv_store_key
      -name: bar
        module: kv_store_key
      -name: baz
        module: kv_store_key

Then the KV store will have three keys, foo, bar, and baz, which are associated with it. They can be addressed as such on the network, or can also be addressed using their fully qualified hierarchical address e.g. somenode.kv.foo.

Summary

class dragonfly.implementations.kv_store.kv_store(**kwargs)

Bases: dragonfly.implementations.kv_store.kv_store

The KV store. This is just a wrapper around a dict.

Keyword Arguments:
 
  • name (str) – unique identifier across all dripline services (used to determine routing key)
  • calibration (str||dict) – string use to process raw get result (with .format(raw)) or a dict to use for the same purpose where raw must be a key
  • get_on_set (bool) – flag to toggle running ‘on_get’ after each ‘on_set’
add_endpoint(endpoint)
cmd(target, method_name, value=[], payload={}, lockout_key=False, timeout=None, ignore_retcode=False)
endpoint(endpoint)

Return the endpoint associated with some key.

endpoint_names
endpoints
get(target, timeout=None, ignore_retcode=False)
handle_request(channel, method, properties, request)
is_locked
list_endpoints()

List all endpoints associated with this KV store. This is the same as enumerating the keys in the dict.

lock(*args, **kwargs)
lockout_key
logging_status
on_cmd(*args, **kwargs)

WARNING! if you override this method, you must ensure you deal with lockout properly

on_config(attribute, value=None)

configure a property again

WARNING! if you override this method, you must ensure you deal with lockout properly

on_send(*commands)
on_set(*args, **kwargs)
ping(*args, **kwargs)

ignore all details and respond with an empty message

schedule_status
send(to_send)
set(target, value, lockout_key=False, timeout=None, ignore_retcode=False)
set_condition(*args, **kwargs)

To actually do something inside a class, the set_condition should be implemented in the class itself.

unlock(*args, **kwargs)
class dragonfly.implementations.kv_store.kv_store_key(initial_value=None, **kwargs)

Bases: dragonfly.implementations.kv_store.kv_store_key

A key in the KV store.

Keyword Arguments:
 
  • log_on_set (bool) – flag to enable logging the new value whenever a new one is set
  • max_interval (float) – If > 0, any log event exceding this number of seconds since the last broadcast will trigger a broadcast.
  • max_fractional_change (float) – If > 0, any log event which produces a value which differs from the previous value by more than this amount (expressed as a fraction, ie 10% change is 0.1) will trigger a broadcast
  • alert_routing_key (str) – routing key for the alert message send when broadcasting a logging event result. The default value of ‘sensor_value’ is valid for DataLoggers which represent physical quantities being stored to the slow controls database tables
  • name (str) – unique identifier across all dripline services (used to determine routing key)
  • calibration (str||dict) – string use to process raw get result (with .format(raw)) or a dict to use for the same purpose where raw must be a key
  • get_on_set (bool) – flag to toggle running ‘on_get’ after each ‘on_set’
  • schedule_interval (float) – time in seconds between scheduled events
handle_request(channel, method, properties, request)
is_locked
lock(lockout_key=None, *args, **kwargs)
lockout_key
log_interval
log_on_set
logging_status
max_fractional_change
max_interval
on_cmd(*args, **kwargs)

WARNING! if you override this method, you must ensure you deal with lockout properly

on_config(attribute, value=None)

configure a property again

WARNING! if you override this method, you must ensure you deal with lockout properly

on_get(*args, **kwargs)
on_set(value)

Set the value associated with this key to some new value.

ping(*args, **kwargs)

ignore all details and respond with an empty message

schedule_interval
schedule_status
scheduled_action()

Override Scheduler method with Spime-specific get and log

set_condition(*args, **kwargs)

To actually do something inside a class, the set_condition should be implemented in the class itself.

single_schedule(delay)
store_value(severity)

This method automatically overridden in Spimescape add_endpoint

unlock(*args, **kwargs)
dragonfly.implementations.kv_store.times2(value)
dragonfly.implementations.kv_store.times3(value)

End of modules condition

Data:

End of data condition