repo: move data_index to .dvc/tmp/index

This commit is contained in:
Ruslan Kuprieiev
2023-02-17 19:55:25 +02:00
parent 7ccf35b47e
commit d68599a5f7
+4 -11
View File
@@ -379,23 +379,16 @@ class Repo:
@property
def data_index(self) -> Optional["DataIndex"]:
from appdirs import user_cache_dir
from fsspec.utils import tokenize
from dvc_data.index import DataIndex
if not self.config["feature"].get("data_index_cache"):
return None
if not self.index_db_dir:
return None
if self._data_index is None:
cache_dir = user_cache_dir(self.config.APPNAME, self.config.APPAUTHOR)
index_dir = os.path.join(
cache_dir,
"index",
"data",
# scm.root_dir and repo.root_dir don't match for subrepos
tokenize((self.scm.root_dir, self.root_dir)),
)
index_dir = os.path.join(self.index_db_dir, "data")
os.makedirs(index_dir, exist_ok=True)
self._data_index = DataIndex.open(os.path.join(index_dir, "db.db"))