RejsonIPC

class dasha.web.extensions.ipc_backends.rejson.RejsonIPC(label)[source]

Bases: object

This class manages a JSON object in redis.

The actual data stub stored in the redis db under redis_key looks like:

{
    '_ipc_obj': {'a': 'b'},
    '_ipc_meta': {
        'key': 'redis_key'
        'rev': 0,
        'created_at': [xxxx, yyyy],
        'updated_at': [zzzz, wwww],
        }
    }
Parameters
labelstr

The label of this IPC channel.

Attributes Summary

connection

label

pipeline

A pipeline execution context.

redis_key

The key of the redis db entry.

Methods Summary

ensure_obj(self[, obj])

Setup the JSON data with obj if it does not exist yet.

get(self[, path])

Return value at path.

get_if_updated(self[, obj])

Returns new obj if it is updated.

get_meta(self[, key])

Return the metadata.

get_rejson_data(self)

Return the entire JSON data.

init_ipc(url)

is_initialized(self)

is_null(self[, path])

query_obj(self, op, path, \*args, \*\*kwargs)

Query object at path path with op.

reset(self, obj)

Reset the object with obj.

set(self, obj[, path])

Set obj to path.

type(self[, path])

Attributes Documentation

connection
label
pipeline

A pipeline execution context.

redis_key

The key of the redis db entry.

Methods Documentation

ensure_obj(self, obj=None)[source]

Setup the JSON data with obj if it does not exist yet.

Returns
bool

False if new object is created.

get(self, path='.')[source]

Return value at path.

None is returned if unable to get object.

get_if_updated(self, obj=None)[source]

Returns new obj if it is updated.

get_meta(self, key=None)[source]

Return the metadata.

get_rejson_data(self)[source]

Return the entire JSON data.

classmethod init_ipc(url)[source]
is_initialized(self)[source]
is_null(self, path='.')[source]
query_obj(self, op, path, \*args, \*\*kwargs)[source]

Query object at path path with op.

This assumes that the data exists.

reset(self, obj)[source]

Reset the object with obj.

set(self, obj, path='.')[source]

Set obj to path.

If path is root, new object is created implicitly.

type(self, path='.')[source]