no more leaves

This commit is contained in:
Simone Scarduzio
2025-09-23 14:14:54 +02:00
parent 46b7317895
commit 59b15b6384
8 changed files with 36 additions and 36 deletions
+2 -2
View File
@@ -42,7 +42,7 @@ class StdLoggerAdapter(LoggerPort):
self,
op: str,
key: str,
leaf: str,
deltaspace: str,
sizes: dict[str, int],
durations: dict[str, float],
cache_hit: bool = False,
@@ -51,7 +51,7 @@ class StdLoggerAdapter(LoggerPort):
data = {
"op": op,
"key": key,
"leaf": leaf,
"deltaspace": deltaspace,
"sizes": sizes,
"durations": durations,
"cache_hit": cache_hit,
+6 -6
View File
@@ -347,18 +347,18 @@ def rm(
if delta_obj:
objects_to_delete.append(delta_key)
# Check for reference.bin in the same leaf
# Check for reference.bin in the same deltaspace
if "/" in obj_key:
leaf_prefix = "/".join(obj_key.split("/")[:-1])
ref_key = f"{leaf_prefix}/reference.bin"
deltaspace_prefix = "/".join(obj_key.split("/")[:-1])
ref_key = f"{deltaspace_prefix}/reference.bin"
else:
ref_key = "reference.bin"
# Only delete reference.bin if it's the last file in the leaf
# Only delete reference.bin if it's the last file in the deltaspace
ref_obj = service.storage.head(f"{bucket}/{ref_key}")
if ref_obj:
# Check if there are other files in this leaf
list_prefix = f"{bucket}/{leaf_prefix}" if "/" in obj_key else bucket
# Check if there are other files in this deltaspace
list_prefix = f"{bucket}/{deltaspace_prefix}" if "/" in obj_key else bucket
other_files = list(service.storage.list(list_prefix))
# Count files excluding reference.bin
non_ref_files = [o for o in other_files if not o.key.endswith("/reference.bin")]
+7 -7
View File
@@ -108,7 +108,7 @@ class DeltaService:
self.logger.info(
"Starting put operation",
file=str(local_file),
leaf=f"{delta_space.bucket}/{delta_space.prefix}",
deltaspace=f"{delta_space.bucket}/{delta_space.prefix}",
size=file_size,
)
@@ -151,7 +151,7 @@ class DeltaService:
self.logger.log_operation(
op="put",
key=summary.key,
leaf=f"{delta_space.bucket}/{delta_space.prefix}",
deltaspace=f"{delta_space.bucket}/{delta_space.prefix}",
sizes={"file": file_size, "delta": summary.delta_size or file_size},
durations={"total": duration},
cache_hit=summary.cache_hit,
@@ -182,7 +182,7 @@ class DeltaService:
self.logger.log_operation(
op="get",
key=object_key.key,
leaf=f"{object_key.bucket}",
deltaspace=f"{object_key.bucket}",
sizes={"file": int(obj_head.metadata.get("file_size", 0))},
durations={"total": duration},
cache_hit=False,
@@ -198,10 +198,10 @@ class DeltaService:
# So we use the same bucket as the delta
if "/" in delta_meta.ref_key:
ref_parts = delta_meta.ref_key.split("/")
leaf_prefix = "/".join(ref_parts[:-1])
deltaspace_prefix = "/".join(ref_parts[:-1])
else:
leaf_prefix = ""
delta_space = DeltaSpace(bucket=object_key.bucket, prefix=leaf_prefix)
deltaspace_prefix = ""
delta_space = DeltaSpace(bucket=object_key.bucket, prefix=deltaspace_prefix)
cache_hit = self.cache.has_ref(
delta_space.bucket, delta_space.prefix, delta_meta.ref_sha256
@@ -247,7 +247,7 @@ class DeltaService:
self.logger.log_operation(
op="get",
key=object_key.key,
leaf=f"{delta_space.bucket}/{delta_space.prefix}",
deltaspace=f"{delta_space.bucket}/{delta_space.prefix}",
sizes={"delta": delta_meta.delta_size, "file": delta_meta.file_size},
durations={"total": duration},
cache_hit=cache_hit,
+1 -1
View File
@@ -26,7 +26,7 @@ class LoggerPort(Protocol):
self,
op: str,
key: str,
leaf: str,
deltaspace: str,
sizes: dict[str, int],
durations: dict[str, float],
cache_hit: bool = False,