objectstore: integrate metadata object
Integrate the new `Metadata` object as `meta` property on `Object`. Use it to actually store metadata after a successful stage run. A new class `PathAdapter` is introduce which is in turned used to expose the base path of `Object` as `os.PathLike` so it can be passed as path to `Metadata`. The advantage is that any changes to the base path in `Object` will automatically be picked up by `Metadata`; the prominent, and currently only, case where this is happening in `Object` is `store_tree`.
This commit is contained in:
parent
fec9dcea97
commit
1205de0abb
3 changed files with 51 additions and 1 deletions
|
|
@ -254,6 +254,32 @@ class TestObjectStore(unittest.TestCase):
|
|||
|
||||
md.set("a", data)
|
||||
assert md.get("a") == data
|
||||
|
||||
with objectstore.ObjectStore(self.store) as store:
|
||||
obj = store.new("a")
|
||||
p = Path(obj, "A")
|
||||
p.touch()
|
||||
|
||||
obj.meta.set("md", data)
|
||||
assert obj.meta.get("md") == data
|
||||
|
||||
store.commit(obj, "x")
|
||||
obj.meta.set("extra", extra)
|
||||
assert obj.meta.get("extra") == extra
|
||||
|
||||
store.commit(obj, "a")
|
||||
|
||||
with objectstore.ObjectStore(self.store) as store:
|
||||
obj = store.get("a")
|
||||
|
||||
assert obj.meta.get("md") == data
|
||||
assert obj.meta.get("extra") == extra
|
||||
|
||||
ext = store.get("x")
|
||||
|
||||
assert ext.meta.get("md") == data
|
||||
assert ext.meta.get("extra") is None
|
||||
|
||||
def test_host_tree(self):
|
||||
with objectstore.ObjectStore(self.store) as store:
|
||||
host = store.host_tree
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue