kvclient

Name

kvclient -- Client To Manager's REST Key Value Store Service

Synopsis


package require kvclient

KvClient client-name ?option value...?
client configure option value ?...?
set value [client getValue keyname]
client setValue keyname value
set keys [client listNames]
set kvdump [client list]
      

DESCRIPTION

REST client for the key value store domain (/KVStore) of the DAQ manager server. This package provides an object oriented client package. The package does service discovery and reconnects for every REST request rather than maintaining a connection with e.g. persistent sockets.

Because the package does per-request service discovery and connection, it is generally tolerant of the sorts of port reassignment that can happen as a result of server exit and restart. Similarly server restarts are transparent to the package because no persistent connection is maintained.

OPTIONS

The client is configured using options, much the same way Tk widgets are configured. Options, in addition to the clientutils::SERVICE variable configure service discovery. clientutils::SERVICE contains the service the manager advertises and defaults to DAQManager, which is the default service advertised.

The host in which the server runs as well as the user that started the server are configuration options:

-host

Host in which the server is running.

-user

User name of the user that started the server.

METHODS

Constructed objects support the following methods:

configure option value ?...?

Built in method that configures the object's options. Since service discover and connections are made/broken with each request, this provide support for e.g. service migration.

getValue keyname

Returns the value of the key keyname. keyname must be a defined key in the Key Value store or an error will be signalled.

setValue keyname value

This method modifies the value of the key keyname. setting it to value. keyname must already exist in the key value store or an error will be returned.

listNames

Returns a list of the keynames that are defined in the key value store.

list

Returns a dict whose keys are the keys of the key value store and whose values are their values.