Skip to content

Commit 7d72ff5

Browse files
AffieCopilot
andauthored
Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Johannes Terblanche <6612981+Affie@users.noreply.github.com>
1 parent af992b4 commit 7d72ff5

5 files changed

Lines changed: 9 additions & 9 deletions

File tree

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Listing news on any major breaking changes in DFG. For regular changes, see int
2020
- `saveBlob_Variable!``saveVariableBlob!`, `loadBlob_Variable``loadVariableBlob`
2121
- Same pattern for Factor, Graph, Agent variants.
2222
- Old names kept as `const` aliases for backward compatibility.
23-
- `deleteBlob_Variable` and similar wrappers no longer exist. Use `deleteVariableBlobentry!` (metadata) and `purgeBlob!(provider, multihash)` (physical) directly. Warning: be carefull when deleting blobs to make sure they are no longer in use anywhere because the multihash id can be shared by multiple blobs.
23+
- `deleteBlob_Variable` and similar wrappers no longer exist. Use `deleteVariableBlobentry!` (metadata) and `purgeBlob!(provider, multihash)` (physical) directly. Warning: be careful when deleting blobs to make sure they are no longer in use anywhere because the multihash id can be shared by multiple blobs.
2424

2525
# v0.28
2626
- Reading or deserialzing of factor graphs created prior to v0.25 are no longer suppoted with the complete removal of User/Robot/Session

src/Blobproviders/Blobproviders.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ function fetchBlob(store::CachedBlobprovider, m::Multihash)
168168
!isnothing(blob) && return blob
169169
blob = fetchBlob(store.remote_provider, m)
170170
if !isnothing(blob)
171-
putBlob!(store.local_provider, blob)
171+
putBlob!(store.local_provider, m, blob)
172172
end
173173
return blob
174174
end

src/entities/Blobentry.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ Checks the integrity of a blob against the hashes stored in the given `Blobentry
225225
- Additionally verifies the `crchash` (crc32c) if present.
226226
- Returns `true` if all present hashes match.
227227
- Returns `false` if any hash does not match.
228-
- Returns `nothing` if only the multihash is present but the algorithm is unregistered.
228+
- Returns `nothing` if the multihash algorithm is unregistered.
229229
"""
230230
function checkHash(entry::Blobentry, blob)
231231
# Reverse lookup: multicodec code -> hash function
@@ -235,6 +235,7 @@ function checkHash(entry::Blobentry, blob)
235235
func = get(code_to_func, code, nothing)
236236
if isnothing(func)
237237
@warn "checkHash: unregistered multihash algorithm code $(repr(code)), skipping multihash check"
238+
return nothing
238239
else
239240
func(blob) != stored_digest && return false
240241
end

src/services/blobprovider_ops.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,10 @@ function getBlob(dfg::AbstractDFG, entry::Blobentry)
119119
providers = refBlobproviders(dfg)
120120

121121
if isempty(providers)
122-
error(
122+
@warn(
123123
"No Blobproviders mounted on DFG. Add one with `addBlobprovider!(dfg, FolderBlobprovider(path))` before storing blobs. Cannot retrieve multihash: $(entry.multihash)",
124124
)
125+
throw(LabelNotFoundError("Blobprovider", entry.provider, collect(keys(providers))))
125126
end
126127

127128
# 1. Build the search order: Hinted provider first, followed by the rest
@@ -170,11 +171,9 @@ function hasBlob(provider::AbstractBlobprovider, entry::Blobentry)
170171
end
171172
function hasBlob(dfg::AbstractDFG, entry::Blobentry)
172173
# CAS: check all providers — the blob may have been stored via a different route
174+
#TODO check entry.provider first
173175
for (_, provider) in refBlobproviders(dfg)
174-
try
175-
hasBlob(provider, entry.multihash) && return true
176-
catch
177-
end
176+
hasBlob(provider, entry.multihash) && return true
178177
end
179178
return false
180179
end

test/iifCompareTests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,6 @@ end
110110

111111
sfg = getSubgraph(GraphsDFG, fg, [:x0; :x1])
112112

113-
#TODO add proper subraph tests here (or remove testset), spot check for now.
113+
#TODO add proper subgraph tests here (or remove testset), spot check for now.
114114
@test issetequal(listVariables(sfg), [:x0; :x1])
115115
end

0 commit comments

Comments
 (0)