mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
dvc: move 'verify' property from tree to cache (#5334)
This commit is contained in:
Vendored
+4
@@ -6,6 +6,7 @@ from ..scheme import Schemes
|
||||
|
||||
def get_cloud_cache(tree):
|
||||
from .base import CloudCache
|
||||
from .gdrive import GDriveCache
|
||||
from .local import LocalCache
|
||||
from .ssh import SSHCache
|
||||
|
||||
@@ -15,6 +16,9 @@ def get_cloud_cache(tree):
|
||||
if tree.scheme == Schemes.SSH:
|
||||
return SSHCache(tree)
|
||||
|
||||
if tree.scheme == Schemes.GDRIVE:
|
||||
return GDriveCache(tree)
|
||||
|
||||
return CloudCache(tree)
|
||||
|
||||
|
||||
|
||||
Vendored
+2
@@ -45,6 +45,7 @@ def use_state(call):
|
||||
|
||||
class CloudCache:
|
||||
|
||||
DEFAULT_VERIFY = False
|
||||
DEFAULT_CACHE_TYPES = ["copy"]
|
||||
CACHE_MODE: Optional[int] = None
|
||||
|
||||
@@ -52,6 +53,7 @@ class CloudCache:
|
||||
self.tree = tree
|
||||
self.repo = tree.repo
|
||||
|
||||
self.verify = tree.config.get("verify", self.DEFAULT_VERIFY)
|
||||
self.cache_types = tree.config.get("type") or copy(
|
||||
self.DEFAULT_CACHE_TYPES
|
||||
)
|
||||
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
from .base import CloudCache
|
||||
|
||||
|
||||
class GDriveCache(CloudCache):
|
||||
DEFAULT_VERIFY = True
|
||||
+1
-1
@@ -481,7 +481,7 @@ class Remote:
|
||||
download=True,
|
||||
)
|
||||
|
||||
if not self.tree.verify:
|
||||
if not self.cache.verify:
|
||||
with cache.tree.state:
|
||||
for checksum in named_cache.scheme_keys("local"):
|
||||
cache_file = cache.tree.hash_to_path_info(checksum)
|
||||
|
||||
@@ -53,7 +53,6 @@ class BaseTree:
|
||||
|
||||
CHECKSUM_DIR_SUFFIX = ".dir"
|
||||
HASH_JOBS = max(1, min(4, cpu_count() // 2))
|
||||
DEFAULT_VERIFY = False
|
||||
LIST_OBJECT_PAGE_SIZE = 1000
|
||||
TRAVERSE_WEIGHT_MULTIPLIER = 5
|
||||
TRAVERSE_PREFIX_LEN = 3
|
||||
@@ -71,7 +70,6 @@ class BaseTree:
|
||||
|
||||
self._check_requires()
|
||||
|
||||
self.verify = config.get("verify", self.DEFAULT_VERIFY)
|
||||
self.path_info = None
|
||||
|
||||
@cached_property
|
||||
|
||||
@@ -89,7 +89,6 @@ class GDriveTree(BaseTree):
|
||||
scheme = Schemes.GDRIVE
|
||||
PATH_CLS = GDriveURLInfo
|
||||
REQUIRES = {"pydrive2": "pydrive2"}
|
||||
DEFAULT_VERIFY = True
|
||||
# Always prefer traverse for GDrive since API usage quotas are a concern.
|
||||
TRAVERSE_WEIGHT_MULTIPLIER = 1
|
||||
TRAVERSE_PREFIX_LEN = 2
|
||||
|
||||
Reference in New Issue
Block a user