Skip to content

Commit 378f6d0

Browse files
authored
Merge pull request #1048 from JuliaRobotics/23Q3/fix/getdatauuid
bug fix, getData with UUID
2 parents 54f4e35 + 1185cf7 commit 378f6d0

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DistributedFactorGraphs"
22
uuid = "b5cc3c7e-6572-11e9-2517-99fb8daf2f04"
3-
version = "0.23.2"
3+
version = "0.23.3"
44

55
[deps]
66
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

src/DataBlobs/services/BlobEntry.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ If the blob label `datalabel_1` already exists, then this function will return t
399399
"""
400400
function incrDataLabelSuffix(
401401
dfg::AbstractDFG,
402-
vla,
402+
vla::Union{Symbol, <:AbstractString},
403403
bllb::S;
404404
datalabel = Ref(""),
405405
) where {S <: Union{Symbol, <:AbstractString}}

src/DataBlobs/services/HelpersDataWrapEntryBlob.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ function getData(
8888
checkhash::Bool = true,
8989
getlast::Bool = true,
9090
)
91-
de_ = getBlobEntries(dfg, vlabel, key)
91+
_getblobentr(g, v, k) = getBlobEntries(g, v, k)
92+
_getblobentr(g, v, k::UUID) = [getBlobEntry(g, v, k);]
93+
de_ = _getblobentr(dfg, vlabel, key)
9294
lbls = (s -> s.label).(de_)
9395
idx = sortperm(lbls; rev = getlast)
9496
_first(s) = s

test/testBlocks.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,11 +1152,29 @@ function blobsStoresTestBlock!(fg)
11521152
# Getting
11531153
data = getData(fg, fs, :a, :testing) # convenience wrapper over getBlob
11541154
@test data[1].hash == newData.hash #[1]
1155+
# more dispatches
1156+
data = getData(fg, :a, :testing) # convenience wrapper over getBlob
1157+
@test data[1].hash == newData.hash #[1]
1158+
data = getData(fg, :a, "testing") # convenience wrapper over getBlob
1159+
@test data[1].hash == newData.hash #[1]
1160+
data = getData(fg, :a, r"testing") # convenience wrapper over getBlob
1161+
@test data[1].hash == newData.hash #[1]
1162+
be = getBlobEntry(fg, :a, r"testing")
1163+
data = getData(fg, :a, be.originId) # convenience wrapper over getBlob
1164+
@test data[1].hash == newData.hash #[1]
11551165
# @test data[2] == newData[2]
11561166
# Updating
11571167
updateData = updateData!(fg, fs, :a, newData, rand(UInt8, 50)) # convenience wrapper around updateBlob!
11581168
@test updateData[1].hash != data[1].hash
11591169
@test updateData[2] != data[2]
1170+
@show bllb = DistributedFactorGraphs.incrDataLabelSuffix(fg, :a, :testing)
1171+
newData2 = addData!(fg, fs.key, :a, bllb, testData) # convenience wrapper over addBlob!
1172+
nbe = listBlobEntries(fg, :a)
1173+
filter!(s -> occursin(r"testing", string(s)), nbe)
1174+
@test 2 == length(nbe)
1175+
# TODO: incrSuffix when adding repeat labels, e.g. :testing_1, :testing_2
1176+
data2 = getData(fg, :a, :testing)
1177+
data3 = getData(fg, :a, bllb)
11601178
# Deleting
11611179
return retData = deleteData!(fg, :a, :testing) # convenience wrapper around deleteBlob!
11621180
end

0 commit comments

Comments
 (0)