def properties(self): """Return the properties of this collection. :returns: the collection's id, status, key_options etc. :rtype: dict :raises: CollectionGetError """ res = self.api.get( "/_api/collection/{}/properties".format(self.name) ) if res.status_code not in HTTP_OK: raise CollectionGetError(res) return { "id": res.obj["id"], "name": res.obj["name"], "is_edge": res.obj["type"] == 3, "status": COLLECTION_STATUSES.get( res.obj["status"], "corrupted ({})".format(res.obj["status"]) ), "do_compact": res.obj["doCompact"], "is_system": res.obj["isSystem"], "is_volatile": res.obj["isVolatile"], "journal_size": res.obj["journalSize"], "wait_for_sync": res.obj["waitForSync"], "key_options": uncamelify(res.obj["keyOptions"]) }
def properties(self): """Return the properties of this collection. :returns: the collection's id, status, key_options etc. :rtype: dict :raises: CollectionGetError """ res = self.api.get("/_api/collection/{}/properties".format(self.name)) if res.status_code not in HTTP_OK: raise CollectionGetError(res) return { "id": res.body["id"], "name": res.body["name"], "is_edge": res.body["type"] == 3, "status": COLLECTION_STATUSES.get( res.body["status"], "corrupted ({})".format(res.body["status"])), "do_compact": res.body["doCompact"], "is_system": res.body["isSystem"], "is_volatile": res.body["isVolatile"], "journal_size": res.body["journalSize"], "wait_for_sync": res.body["waitForSync"], "key_options": uncamelify(res.body["keyOptions"]) }
def unload(self): """Unload this collection from memory. :returns: the status of the collection :rtype: str :raises: CollectionUnloadError """ res = self.api.put("/_api/collection/{}/unload".format(self.name)) if res.status_code not in HTTP_OK: raise CollectionUnloadError(res) return COLLECTION_STATUSES.get( res.body["status"], "corrupted ({})".format(res.body["status"]))
def unload(self): """Unload this collection from memory. :returns: the status of the collection :rtype: str :raises: CollectionUnloadError """ res = self.api.put( "/_api/collection/{}/unload".format(self.name) ) if res.status_code not in HTTP_OK: raise CollectionUnloadError(res) return COLLECTION_STATUSES.get( res.obj["status"], "corrupted ({})".format(res.obj["status"]) )