Skip to content

Commit

Permalink
Merge pull request #1048 from JuliaRobotics/23Q3/fix/getdatauuid
Browse files Browse the repository at this point in the history
bug fix, getData with UUID
  • Loading branch information
dehann committed Sep 10, 2023
2 parents 54f4e35 + 1185cf7 commit 378f6d0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "DistributedFactorGraphs"
uuid = "b5cc3c7e-6572-11e9-2517-99fb8daf2f04"
version = "0.23.2"
version = "0.23.3"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
2 changes: 1 addition & 1 deletion src/DataBlobs/services/BlobEntry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ If the blob label `datalabel_1` already exists, then this function will return t
"""
function incrDataLabelSuffix(
dfg::AbstractDFG,
vla,
vla::Union{Symbol, <:AbstractString},
bllb::S;
datalabel = Ref(""),
) where {S <: Union{Symbol, <:AbstractString}}
Expand Down
4 changes: 3 additions & 1 deletion src/DataBlobs/services/HelpersDataWrapEntryBlob.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ function getData(
checkhash::Bool = true,
getlast::Bool = true,
)
de_ = getBlobEntries(dfg, vlabel, key)
_getblobentr(g, v, k) = getBlobEntries(g, v, k)
_getblobentr(g, v, k::UUID) = [getBlobEntry(g, v, k);]
de_ = _getblobentr(dfg, vlabel, key)
lbls = (s -> s.label).(de_)
idx = sortperm(lbls; rev = getlast)
_first(s) = s
Expand Down
18 changes: 18 additions & 0 deletions test/testBlocks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1152,11 +1152,29 @@ function blobsStoresTestBlock!(fg)
# Getting
data = getData(fg, fs, :a, :testing) # convenience wrapper over getBlob
@test data[1].hash == newData.hash #[1]
# more dispatches
data = getData(fg, :a, :testing) # convenience wrapper over getBlob
@test data[1].hash == newData.hash #[1]
data = getData(fg, :a, "testing") # convenience wrapper over getBlob
@test data[1].hash == newData.hash #[1]
data = getData(fg, :a, r"testing") # convenience wrapper over getBlob
@test data[1].hash == newData.hash #[1]
be = getBlobEntry(fg, :a, r"testing")
data = getData(fg, :a, be.originId) # convenience wrapper over getBlob
@test data[1].hash == newData.hash #[1]
# @test data[2] == newData[2]
# Updating
updateData = updateData!(fg, fs, :a, newData, rand(UInt8, 50)) # convenience wrapper around updateBlob!
@test updateData[1].hash != data[1].hash
@test updateData[2] != data[2]
@show bllb = DistributedFactorGraphs.incrDataLabelSuffix(fg, :a, :testing)
newData2 = addData!(fg, fs.key, :a, bllb, testData) # convenience wrapper over addBlob!
nbe = listBlobEntries(fg, :a)
filter!(s -> occursin(r"testing", string(s)), nbe)
@test 2 == length(nbe)
# TODO: incrSuffix when adding repeat labels, e.g. :testing_1, :testing_2
data2 = getData(fg, :a, :testing)
data3 = getData(fg, :a, bllb)
# Deleting
return retData = deleteData!(fg, :a, :testing) # convenience wrapper around deleteBlob!
end
Expand Down

0 comments on commit 378f6d0

Please sign in to comment.