noc.core.collection.base

Module Contents

noc.core.collection.base.state_lock
class noc.core.collection.base.Collection(name, stdout=None)

Bases: object

PREFIX = collections
CUSTOM_PREFIX
STATE_COLLECTION = noc.collectionstates
DEFAULT_API_VERSION = 1
_MODELS
Item
_state_cache
model
name_field
get_path(self)
classmethod iter_collections(cls)
get_state_collection(self)

Return mongo collection for state :return:

get_state(self)

Returns collection state as a dict of UUID -> hash :return:

save_state(self, state)

Save collection state :param state: :return:

classmethod get_builtins(cls, name)

Returns set of UUIDs for collection :param name: :return:

get_legacy_state_path(self)

Return legacy CSV state file path :return:

get_changed_status(self)

Return initially changed status :return:

get_items(self)

Returns dict of UUID -> Collection.Item containing new state :return:

dereference(self, d, model=None)
lookup(self, ref, field, key)
update_item(self, data)
delete_item(self, uuid)
sync(self)
fix_uuids(self)

Convert string UUIDs to binary :param name: :param model: :return:

classmethod install(cls, data)

Write data to the proper path :param data: :return: