@@ -2,31 +2,17 @@ using InteractiveUtils
22
33@kwdef struct PackedGraphsDFG{T <: AbstractParams }
44 description:: String
5- # ------ deprecated fields v0.25 ---------
6- userLabel:: Union{Nothing, String} = nothing
7- robotLabel:: Union{Nothing, String} = nothing
8- sessionLabel:: Union{Nothing, String} = nothing
9- userData:: Union{Nothing, Dict{Symbol, SmallDataTypes}} = nothing
10- robotData:: Union{Nothing, Dict{Symbol, SmallDataTypes}} = nothing
11- sessionData:: Union{Nothing, Dict{Symbol, SmallDataTypes}} = nothing
12- userBlobEntries:: Union{Nothing, OrderedDict{Symbol, Blobentry}} = nothing
13- robotBlobEntries:: Union{Nothing, OrderedDict{Symbol, Blobentry}} = nothing
14- sessionBlobEntries:: Union{Nothing, OrderedDict{Symbol, Blobentry}} = nothing
15- # ---------------------------------
165 addHistory:: Vector{Symbol}
176 solverParams:: T
187 solverParams_type:: String = string (nameof (typeof (solverParams)))
198 typePackedVariable:: Bool = false # Are variables packed or full
209 typePackedFactor:: Bool = false # Are factors packed or full
2110 blobStores:: Union {Nothing, Dict{Symbol, FolderStore{Vector{UInt8}}}}
22-
23- # new structure to replace URS
24- # TODO remove union nothing after v0.25
25- graphLabel:: Union{Nothing, Symbol}
26- graphTags:: Union{Nothing, Vector{Symbol}}
27- graphMetadata:: Union{Nothing, Dict{Symbol, SmallDataTypes}}
28- graphBlobEntries:: Union{Nothing, OrderedDict{Symbol, Blobentry}}
29- agent:: Union{Nothing, Agent}
11+ graphLabel:: Symbol
12+ graphTags:: Vector{Symbol}
13+ graphMetadata:: Dict{Symbol, SmallDataTypes}
14+ graphBlobEntries:: OrderedDict{Symbol, Blobentry}
15+ agent:: Agent
3016end
3117
3218StructTypes. StructType (:: Type{PackedGraphsDFG} ) = StructTypes. AbstractType ()
@@ -49,7 +35,7 @@ Packing function to serialize DFG metadata from.
4935function packDFGMetadata (fg:: GraphsDFG )
5036 commonfields = intersect (fieldnames (PackedGraphsDFG), fieldnames (GraphsDFG))
5137
52- setdiff! (commonfields, [deprecatedDfgFields; :blobStores ])
38+ setdiff! (commonfields, [:blobStores ])
5339 blobStores = Dict {Symbol, FolderStore{Vector{UInt8}}} ()
5440 foreach (values (fg. blobStores)) do store
5541 if store isa FolderStore{Vector{UInt8}}
7157function unpackDFGMetadata (packed:: PackedGraphsDFG )
7258 commonfields = intersect (fieldnames (GraphsDFG), fieldnames (PackedGraphsDFG))
7359
74- # FIXME Deprecate remove in DFG v0.24
75- # setdiff!(commonfields, [:blobStores])
76- # blobStores = Dict{Symbol, AbstractBlobstore}()
77- # !isnothing(packed.blobStores) && merge!(blobStores, packed.blobStores)
78-
79- setdiff! (commonfields, [deprecatedDfgFields; :blobStores ])
60+ setdiff! (commonfields, [:blobStores ])
8061 blobStores = packed. blobStores
8162
82- if isnothing (packed. agent)
83- agentBlobEntries = nothing
84- agentMetadata = nothing
85- agentLabel = nothing
86- graphBlobEntries = nothing
87- graphMetadata = nothing
88- graphLabel = nothing
89-
90- for f in deprecatedDfgFields
91- if ! isnothing (getproperty (packed, f))
92- if f == :robotBlobEntries
93- agentBlobEntries = getproperty (packed, f)
94- @warn " Converting deprecated $f to agentBlobEntries"
95- elseif f == :robotData
96- agentMetadata = getproperty (packed, f)
97- @warn " Converting deprecated $f to agentMetadata"
98- elseif f == :robotLabel
99- agentLabel = Symbol (getproperty (packed, f))
100- @warn " Converting deprecated $f to agentLabel"
101- elseif f == :sessionBlobEntries
102- graphBlobEntries = getproperty (packed, f)
103- @warn " Converting deprecated $f to graphBlobEntries"
104- elseif f == :sessionData
105- graphMetadata = getproperty (packed, f)
106- @warn " onverting deprecated $f to graphMetadata"
107- elseif f == :sessionLabel
108- graphLabel = Symbol (getproperty (packed, f))
109- @warn " Converting deprecated $f to graphLabel"
110- else
111- @warn """
112- Field $f is deprecated as part of removing user/robot/session. Replace with Agent or Factorgraph [Label/Metadata/BlobEntries]
113- No conversion done for $f
114- """
115- end
116- end
117- end
118-
119- agent = Agent (;
120- label = agentLabel,
121- blobEntries = agentBlobEntries,
122- metadata = agentMetadata,
123- )
124- else
125- agent = packed. agent
126- graphBlobEntries = packed. graphBlobEntries
127- graphMetadata = packed. graphMetadata
128- graphLabel = packed. graphLabel
129- end
130-
63+ # TODO add 'CanSerialize' trait to blobstores and also serialize NvaBlobStores
13164 _isfolderstorepath (s) = false
13265 _isfolderstorepath (s:: FolderStore ) = ispath (s. folder)
13366 # FIXME escalate to keyword
@@ -157,22 +90,13 @@ function unpackDFGMetadata(packed::PackedGraphsDFG)
15790 return ! isnothing (v)
15891 end
15992
160- return GraphsDFG {typeof(packed.solverParams), VT, FT} (;
161- blobStores,
162- graphBlobEntries,
163- graphMetadata,
164- graphLabel,
165- agent,
166- props... ,
167- )
93+ return GraphsDFG {typeof(packed.solverParams), VT, FT} (; blobStores, props... )
16894end
16995
17096function unpackDFGMetadata! (dfg:: GraphsDFG , packed:: PackedGraphsDFG )
17197 commonfields = intersect (fieldnames (GraphsDFG), fieldnames (PackedGraphsDFG))
17298
173- # FIXME Deprecate remove Nothing union in DFG v0.24
174- # FIXME also remove deprectedDFG fields depr in v0.25
175- setdiff! (commonfields, [deprecatedDfgFields; :blobStores ])
99+ setdiff! (commonfields, [:blobStores ])
176100 ! isnothing (packed. blobStores) && merge! (dfg. blobStores, packed. blobStores)
177101
178102 props = (k => getproperty (packed, k) for k in commonfields)
0 commit comments