def set_storage_policy(self, policy): """Change the storage_policy of a content""" cid = ContainerId(hexa=self.container_id) containerLoc = ContainerLocator() addr, = containerLoc.locate(self.namespace, cid) meta2 = Meta2(self.namespace, make_gridd_from_addr(addr)) content_stat, = list(meta2.stat_content_v2(cid, self.name)) sys_metadata = Metadata(content_stat.get_metadata_system()) if sys_metadata.getValue("storage-policy") is not policy: sys_metadata.add("storage-policy", policy) meta2.modify_content_sysmetadata(cid, self.name, sys_metadata)
def __init__(self, ns): self.ns = ns cscaddr, = ConscienceLocator().locate(ns, '') self.conscience = Conscience(ns, make_gridd_from_addr(cscaddr)) self.services = {}