repo: rename odb -> cache

We used to have it named `cache` before, but these days it is clear that
you can have three odbs: just odb (e.g. in-memory), cache (typically local)
or remote (typically cloud). Fixing naming here before proceeding with
introducing `out.odb` and `out.cache`.

In preparation for migration to https://github.com/iterative/dvc-data/pull/304
This commit is contained in:
Ruslan Kuprieiev
2023-02-08 23:05:45 +02:00
parent 4176007493
commit 58295ca0ab
46 changed files with 218 additions and 216 deletions
+7 -7
View File
@@ -105,9 +105,9 @@ def test_checkout_corrupted_cache_dir(tmp_dir, dvc):
# NOTE: modifying cache file for one of the files inside the directory
# to check if dvc will detect that the cache is corrupted.
obj = load(dvc.odb.local, out.hash_info)
obj = load(dvc.cache.local, out.hash_info)
_, _, entry_oid = list(obj)[0]
cache = dvc.odb.local.oid_to_path(entry_oid.value)
cache = dvc.cache.local.oid_to_path(entry_oid.value)
os.chmod(cache, 0o644)
with open(cache, "w+", encoding="utf-8") as fobj:
@@ -161,7 +161,7 @@ class TestCheckoutCleanWorkingDir:
def test_checkout_selective_remove(tmp_dir, dvc):
# Use copy to test for changes in the inodes
dvc.odb.local.cache_types = ["copy"]
dvc.cache.local.cache_types = ["copy"]
tmp_dir.dvc_gen({"data": {"foo": "foo", "bar": "bar"}})
foo_inode = system.inode(os.path.join("data", "foo"))
@@ -357,7 +357,7 @@ def test_checkout_moved_cache_dir_with_symlinks(tmp_dir, dvc):
assert system.is_symlink(os.path.join("data", "file"))
old_data_link = os.path.realpath(os.path.join("data", "file"))
old_cache_dir = dvc.odb.local.path
old_cache_dir = dvc.cache.local.path
new_cache_dir = old_cache_dir + "_new"
os.rename(old_cache_dir, new_cache_dir)
@@ -395,7 +395,7 @@ def test_checkout_no_checksum(tmp_dir, dvc):
[("hardlink", system.is_hardlink), ("symlink", system.is_symlink)],
)
def test_checkout_relink(tmp_dir, dvc, link, link_test_func):
dvc.odb.local.cache_types = [link]
dvc.cache.local.cache_types = [link]
tmp_dir.dvc_gen({"dir": {"data": "text"}})
dvc.unprotect("dir/data")
@@ -408,7 +408,7 @@ def test_checkout_relink(tmp_dir, dvc, link, link_test_func):
@pytest.mark.parametrize("link", ["hardlink", "symlink", "copy"])
def test_checkout_relink_protected(tmp_dir, dvc, link):
dvc.odb.local.cache_types = [link]
dvc.cache.local.cache_types = [link]
tmp_dir.dvc_gen("foo", "foo")
dvc.unprotect("foo")
@@ -595,7 +595,7 @@ def test_checkout_with_relink_existing(tmp_dir, dvc, link):
(tmp_dir / "foo").unlink()
tmp_dir.dvc_gen("bar", "bar")
dvc.odb.local.cache_types = [link]
dvc.cache.local.cache_types = [link]
stats = dvc.checkout(relink=True)
assert stats == {**empty_checkout, "added": ["foo"]}