Skip to content

Commit

Permalink
deleteBlobEntry! in PackedVariable
Browse files Browse the repository at this point in the history
  • Loading branch information
Affie committed Sep 11, 2023
1 parent 378f6d0 commit 02901d0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/DataBlobs/services/BlobEntry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,18 @@ Notes:
function deleteBlobEntry!(var::AbstractDFGVariable, key::Symbol)
return pop!(var.dataDict, key)
end

function deleteBlobEntry!(var::PackedVariable, key::Symbol)
if !hasBlobEntry(var, key)
throw(

Check warning on line 201 in src/DataBlobs/services/BlobEntry.jl

View check run for this annotation

Codecov / codecov/patch

src/DataBlobs/services/BlobEntry.jl#L199-L201

Added lines #L199 - L201 were not covered by tests
KeyError(
"No dataEntry label $(key) found in variable $(getLabel(var)). Available keys: $(keys(var.dataDict))",
),
)
end
return deleteat!(var.blobEntries, findfirst(x -> x.label == key, var.blobEntries))

Check warning on line 207 in src/DataBlobs/services/BlobEntry.jl

View check run for this annotation

Codecov / codecov/patch

src/DataBlobs/services/BlobEntry.jl#L207

Added line #L207 was not covered by tests
end

function deleteBlobEntry!(dfg::AbstractDFG, label::Symbol, key::Symbol)
#users responsibility to delete data in db before deleting entry
# !isVariable(dfg, label) && return nothing
Expand Down
1 change: 1 addition & 0 deletions src/DistributedFactorGraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ export copyGraph!, deepcopyGraph, deepcopyGraph!, buildSubgraph, mergeGraph!

export hasBlobEntry,
getBlobEntry,
getBlobEntryFirst,
addBlobEntry!,
updateBlobEntry!,
deleteBlobEntry!,
Expand Down

0 comments on commit 02901d0

Please sign in to comment.