objectstore: direct path i/o for Object
The `Object.{read,write}` methods were introduced to implement
copy on write support. Calling `write` would trigger the copy,
if the object had a `base`. Additionally, a level of indirection
was introduced via bind mounts, which allowed to hide the actual
path of the object in the store and make sure that `read` really
returned a read-only path.
Support for copy-on-write was recently removed[1], and thus the
need for the `read` and `write` methods. We lose the benefits
of the indirection, but they are not really needed: the path to
the object is not really hidden since one can always use the
`resolve_ref` method to obtain the actual store object path.
The read only property of build trees is ensured via read only
bind mounts in the build root.
Instead of using `read` and `write`, `Object` now gained a new
`tree` property that is the path to the objects tree and also
is implementing `__fspath__` and so behaves like an `os.PathLike`
object and can thus transparently be used in many places, like
e.g. `os.path.join` or `pathlib.Path`.
[1] 5346025031
This commit is contained in:
parent
a25ae2b1d5
commit
f8ca0cf4bc
4 changed files with 123 additions and 149 deletions
|
|
@ -80,9 +80,10 @@ class TestFormatV1(unittest.TestCase):
|
|||
storedir = pathlib.Path(tmpdir, "store")
|
||||
monitor = NullMonitor(sys.stderr.fileno())
|
||||
libdir = os.path.abspath(os.curdir)
|
||||
store = ObjectStore(storedir)
|
||||
|
||||
res = manifest.build(store, manifest.pipelines, monitor, libdir)
|
||||
with ObjectStore(storedir) as store:
|
||||
res = manifest.build(store, manifest.pipelines, monitor, libdir)
|
||||
|
||||
return res
|
||||
|
||||
def test_canonical(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue