Skip to content

Commit 4fbbecf

Browse files
committed
blobSize in addBlobEntry!, bump v0.20.1
1 parent 32bc14f commit 4fbbecf

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
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.20.0"
3+
version = "0.20.1"
44

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

src/DataBlobs/services/BlobEntry.jl

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,25 @@ Should be extended if DFG variable is not returned by reference.
119119
120120
Also see: [`getBlobEntry`](@ref), [`addBlob`](@ref), [`mergeBlobEntries!`](@ref)
121121
"""
122-
function addBlobEntry!(var::AbstractDFGVariable, bde::BlobEntry)
123-
haskey(var.dataDict, bde.label) && error("blobEntry $(bde.label) already exists on variable $(getLabel(var))")
124-
var.dataDict[bde.label] = bde
125-
return bde
122+
function addBlobEntry!(
123+
var::AbstractDFGVariable,
124+
entry::BlobEntry;
125+
# see https://github.com/JuliaRobotics/DistributedFactorGraphs.jl/issues/985
126+
blobId::UUID = isnothing(entry.blobId) ? entry.id : entry.blobId ,
127+
blobSize::Int = hasfield(DistributedFactorGraphs.BlobEntry, :size) ? entry.size : -1 ,
128+
)
129+
haskey(var.dataDict, entry.label) && error("blobEntry $(entry.label) already exists on variable $(getLabel(var))")
130+
var.dataDict[entry.label] = entry
131+
return entry
126132
end
127133

128-
function addBlobEntry!(dfg::AbstractDFG, label::Symbol, bde::BlobEntry)
129-
return addBlobEntry!(getVariable(dfg, label), bde)
134+
function addBlobEntry!(
135+
dfg::AbstractDFG,
136+
vLbl::Symbol,
137+
entry::BlobEntry;
138+
kw...
139+
)
140+
return addBlobEntry!(getVariable(dfg, vLbl), entry; kw...)
130141
end
131142

132143

src/DataBlobs/services/HelpersDataWrapEntryBlob.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function addData!(
119119
checkhash && assertHash(entry, blob, hashfunction=hashfunction)
120120
blobId = addBlob!(dfg, entry, blob) |> UUID
121121
newEntry = BlobEntry(entry; id=blobId, blobId) #, size=length(blob))
122-
addBlobEntry!(dfg, label, newEntry)
122+
addBlobEntry!(dfg, label, newEntry; blobSize=length(blob))
123123
end
124124

125125
function addData!(
@@ -134,7 +134,7 @@ function addData!(
134134
checkhash && assertHash(entry, blob; hashfunction)
135135
blobId = addBlob!(blobstore, entry, blob) |> UUID
136136
newEntry = BlobEntry(entry; id=blobId, blobId) #, size=length(blob))
137-
addBlobEntry!(dfg, label, newEntry)
137+
addBlobEntry!(dfg, label, newEntry; blobSize=length(blob))
138138
end
139139

140140

0 commit comments

Comments
 (0)