Changeset View
Changeset View
Standalone View
Standalone View
swh/scanner/scanner.py
Show All 15 Lines | |||||
from .output import Output | from .output import Output | ||||
from .policy import ( | from .policy import ( | ||||
QUERY_LIMIT, | QUERY_LIMIT, | ||||
DirectoryPriority, | DirectoryPriority, | ||||
FilePriority, | FilePriority, | ||||
GreedyBFS, | GreedyBFS, | ||||
LazyBFS, | LazyBFS, | ||||
QueryAll, | QueryAll, | ||||
RandomDirSamplingPriority, | |||||
source_size, | source_size, | ||||
) | ) | ||||
async def run( | async def run( | ||||
config: Dict[str, Any], | config: Dict[str, Any], | ||||
policy, | policy, | ||||
source_tree: Directory, | source_tree: Directory, | ||||
Show All 29 Lines | def get_policy_obj(source_tree: Directory, nodes_data: MerkleNodeInfo, policy: str): | ||||
elif policy == "bfs": | elif policy == "bfs": | ||||
return LazyBFS(source_tree, nodes_data) | return LazyBFS(source_tree, nodes_data) | ||||
elif policy == "greedybfs": | elif policy == "greedybfs": | ||||
return GreedyBFS(source_tree, nodes_data) | return GreedyBFS(source_tree, nodes_data) | ||||
elif policy == "filepriority": | elif policy == "filepriority": | ||||
return FilePriority(source_tree, nodes_data) | return FilePriority(source_tree, nodes_data) | ||||
elif policy == "dirpriority": | elif policy == "dirpriority": | ||||
return DirectoryPriority(source_tree, nodes_data) | return DirectoryPriority(source_tree, nodes_data) | ||||
elif policy == "randomdir": | |||||
return RandomDirSamplingPriority(source_tree, nodes_data) | |||||
else: | else: | ||||
raise Exception(f"policy '{policy}' not found") | raise Exception(f"policy '{policy}' not found") | ||||
def scan( | def scan( | ||||
config: Dict[str, Any], | config: Dict[str, Any], | ||||
root_path: str, | root_path: str, | ||||
exclude_patterns: Iterable[str], | exclude_patterns: Iterable[str], | ||||
Show All 24 Lines |