Skip to content

Commit 6e6f87f

Browse files
committed
rm JSON and JSON2
1 parent 70bb1f1 commit 6e6f87f

File tree

5 files changed

+38
-29
lines changed

5 files changed

+38
-29
lines changed

Project.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
99
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
1010
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1111
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
12-
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
13-
JSON2 = "2535ab7d-5cd8-5a07-80ac-9b1792aadce3"
1412
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
1513
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1614
ManifoldsBase = "3362f125-f0bb-47a3-aa74-596ffd7ef2fb"
@@ -33,8 +31,6 @@ Distributions = "0.23, 0.24, 0.25"
3331
DocStringExtensions = "0.8, 0.9"
3432
GraphPlot = "0.5.0"
3533
Graphs = "1.4"
36-
JSON = "0.21"
37-
JSON2 = "0.3.1"
3834
JSON3 = "1"
3935
ManifoldsBase = "0.12, 0.13, 0.14"
4036
OrderedCollections = "1.4"

src/DataBlobs/DataBlobs.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# using BlobFrames
2-
# using CSV
3-
using JSON
1+
42
using SHA
53

64
include("entities/AbstractBlobEntries.jl")
@@ -12,6 +10,8 @@ include("services/BlobStores.jl")
1210

1311
# include("services/InMemoryStore.jl")
1412

13+
export InMemoryBlobStore
14+
export FolderStore
1515

1616
export BlobEntry
1717

src/DataBlobs/services/BlobStores.jl

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -116,25 +116,42 @@ deleteBlob!(dfg::AbstractDFG, blobstore::AbstractBlobStore, label::Symbol, entry
116116
deleteBlob!(dfg, blobstore, label, entry.label)
117117

118118
function deleteBlob!(dfg::AbstractDFG, blobstore::AbstractBlobStore, label::Symbol, key::Symbol)
119-
de = deleteDataEntry!(dfg, label, key)
119+
de = deleteBlobEntry!(dfg, label, key)
120120
db = deleteBlob!(blobstore, de)
121121
return de=>db
122122
end
123123

124124
##==============================================================================
125125

126-
addBlob!(dfg::AbstractDFG, blobstorekey::Symbol, label::Symbol, key::Symbol, blob::Vector{UInt8},
127-
timestamp=now(localzone()); kwargs...) = addBlob!(dfg,
128-
getBlobStore(dfg, blobstorekey),
129-
label,
130-
key,
131-
blob,
132-
timestamp;
133-
kwargs...)
134-
135-
function addBlob!(dfg::AbstractDFG, blobstore::AbstractBlobStore, label::Symbol, key::Symbol,
136-
blob::Vector{UInt8}, timestamp=now(localzone()); description="", mimeType = "application/octet-stream", id::UUID = uuid4(), hashfunction = sha256)
126+
addBlob!(
127+
dfg::AbstractDFG,
128+
blobstorekey::Symbol,
129+
label::Symbol,
130+
key::Symbol,
131+
blob::Vector{UInt8},
132+
timestamp=now(localzone());
133+
kwargs...) = addBlob!(
134+
dfg,
135+
getBlobStore(dfg, blobstorekey),
136+
label,
137+
key,
138+
blob,
139+
timestamp;
140+
kwargs...
141+
)
137142

143+
function addBlob!(
144+
dfg::AbstractDFG,
145+
blobstore::AbstractBlobStore,
146+
label::Symbol,
147+
key::Symbol,
148+
blob::Vector{UInt8},
149+
timestamp=now(localzone());
150+
description="", mimeType = "application/octet-stream",
151+
id::UUID = uuid4(),
152+
hashfunction = sha256
153+
)
154+
#
138155
@warn "ID's and origin IDs should be reconciled here."
139156
entry = BlobEntry(
140157
id = id,
@@ -155,7 +172,6 @@ end
155172
##==============================================================================
156173
## FolderStore
157174
##==============================================================================
158-
export FolderStore
159175

160176
struct FolderStore{T} <: AbstractBlobStore{T}
161177
key::Symbol
@@ -200,7 +216,7 @@ function addBlob!(store::FolderStore{T}, entry::BlobEntry, data::T) where T
200216
write(f, data)
201217
end
202218
open(entryfilename, "w") do f
203-
JSON.print(f, entry)
219+
JSON3.write(f, entry)
204220
end
205221
return data
206222
end
@@ -218,7 +234,7 @@ function updateBlob!(store::FolderStore{T}, entry::BlobEntry, data::T) where T
218234
write(f, data)
219235
end
220236
open(entryfilename, "w") do f
221-
JSON.print(f, entry)
237+
JSON3.write(f, entry)
222238
end
223239
return data
224240
end
@@ -238,7 +254,7 @@ end
238254
##==============================================================================
239255
## InMemoryBlobStore
240256
##==============================================================================
241-
export InMemoryBlobStore
257+
242258
struct InMemoryBlobStore{T} <: AbstractBlobStore{T}
243259
key::Symbol
244260
blobs::Dict{UUID, T}

src/DistributedFactorGraphs.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ using Dates
2222
using TimeZones
2323
using Distributions
2424
using Reexport
25-
using JSON
26-
# using Unmarshal
27-
using JSON2 # JSON2 requires all properties to be in correct sequence, can't guarantee that from DB.
2825
using JSON3
2926
using StructTypes
3027
using LinearAlgebra

src/FileDFG/services/FileDFG.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ function loadDFG!(dfgLoadInto::AbstractDFG, dst::AbstractString)
155155

156156
# remove the temporary unzipped file
157157
if unzip
158-
@info "DFG.loadDFG! is deleting a temp folder created during unzip, $loaddir"
159-
# need this because the number of files created in /tmp/caesar/random is becoming redonkulous.
160-
Base.rm(loaddir, recursive=true, force=true)
158+
@info "DFG.loadDFG! is deleting a temp folder created during unzip, $loaddir"
159+
# need this because the number of files created in /tmp/caesar/random is becoming redonkulous.
160+
Base.rm(loaddir, recursive=true, force=true)
161161
end
162162

163163
return dfgLoadInto

0 commit comments

Comments
 (0)