Skip to content

Commit 79a5493

Browse files
committed
Neo4jDFG still uses base64(JSON2.write(fdata))
1 parent b57b604 commit 79a5493

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

src/Neo4jDFG/services/Neo4jDFG.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,9 @@ function getFactor(dfg::Neo4jDFG, label::Union{Symbol, String})
271271
props = result.results[1]["data"][1]["row"][1]
272272

273273
# NOTE: Until we address #590, base64 decode the data to ensure robustness, #833
274-
props["data"] = String(base64decode(props["data"]))
274+
# TODO: consolidate with top level only JSON, #848
275+
packedData = String(base64decode(props["data"]))
276+
props["data"] = JSON2.read(packedData)
275277

276278
return rebuildFactorMetadata!(dfg, unpackFactor(dfg, props))
277279
end

src/services/Serialization.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,10 @@ function _packSolverData(
298298
#
299299
packtype = convertPackedType(fnctype)
300300
try
301-
packedJson = convert( PackedFunctionNodeData{packtype}, getSolverData(f) )
302-
# packedJson = JSON2.write(packed) # NOTE SINGLE TOP LEVEL JSON.write ONLY
301+
packed = convert( PackedFunctionNodeData{packtype}, getSolverData(f) )
302+
packedJson = packed # JSON2.write(packed) # NOTE SINGLE TOP LEVEL JSON.write ONLY
303303
if base64Encode
304-
# 833
304+
# 833, 848, Neo4jDFG still using base64(JSON2.write(solverdata))...
305305
packedJson = JSON2.write(packed)
306306
packedJson = base64encode(packedJson)
307307
end
@@ -354,7 +354,6 @@ function Base.convert(::Type{PF}, nt::NamedTuple) where {PF <: AbstractPackedFac
354354
end
355355

356356
function Base.convert(::Type{GenericFunctionNodeData{P}}, nt::NamedTuple) where P
357-
@show P
358357
GenericFunctionNodeData{P}(
359358
nt.eliminated,
360359
nt.potentialused,
@@ -389,6 +388,14 @@ function unpackFactor(dfg::G, packedProps::Dict{String, Any}) where G <: Abstrac
389388
tags = Vector{Symbol}()
390389
end
391390
end
391+
392+
# Get the stored variable order
393+
_variableOrderSymbols = if packedProps["_variableOrderSymbols"] isa String
394+
JSON2.read(packedProps["_variableOrderSymbols"], Vector{Symbol})
395+
else
396+
Symbol.(packedProps["_variableOrderSymbols"])
397+
end
398+
392399
data = packedProps["data"]
393400
datatype = packedProps["fnctype"]
394401
@debug "DECODING factor type = '$(datatype)' for factor '$label'"
@@ -398,13 +405,6 @@ function unpackFactor(dfg::G, packedProps::Dict{String, Any}) where G <: Abstrac
398405
packed = nothing
399406
fullFactorData = nothing
400407

401-
# Get the stored variable order
402-
_variableOrderSymbols = if packedProps["_variableOrderSymbols"] isa String
403-
JSON2.read(packedProps["_variableOrderSymbols"], Vector{Symbol})
404-
else
405-
Symbol.(packedProps["_variableOrderSymbols"])
406-
end
407-
408408
# @show packtype
409409
# @show data
410410
try

test/testBlocks.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ end
5656

5757

5858
Base.@kwdef struct PackedTestAbstractPrior <: AbstractPackedFactor
59-
s::String
59+
s::String = ""
6060
end
6161
# PackedTestAbstractPrior() = PackedTestAbstractPrior("")
6262

0 commit comments

Comments
 (0)