Skip to content

Commit 3435826

Browse files
authored
Merge pull request #613 from JuliaRobotics/maint/20Q3/docs_and_cleanup
Fix docs and cleanup deprecated
2 parents a0c0299 + 27fe311 commit 3435826

File tree

8 files changed

+42
-109
lines changed

8 files changed

+42
-109
lines changed

test/DataStoreTests.jl renamed to attic/DataStoreTests.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,3 @@ sleep(0.1)
7979
#TODO
8080
#listStoreEntries(ds)
8181
end
82-
83-
1320*4
84-
85-
3600+2200

docs/src/func_ref.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,16 @@ Modules = [CloudGraphsDFGs]
133133

134134

135135

136-
## Big Data
136+
## Data Entries and Blobs
137137

138138
```@autodocs
139139
Modules = [DistributedFactorGraphs]
140140
141-
Pages = ["entities/AbstractBigDataEntries.jl",
142-
"entities/AbstractDataStore.jl",
143-
"entities/FileDataStore.jl",
144-
"entities/InMemoryDataStore.jl",
145-
"services/AbstractBigDataEntries.jl",
146-
"services/AbstractDataStore.jl",
147-
"services/FileDataStore.jl",
148-
"services/InMemoryDataStore.jl"]
141+
Pages = ["entities/AbstractDataEntries.jl",
142+
"services/AbstractDataEntries.jl",
143+
"services/BlobStores.jl",
144+
"services/DataEntryBlob.jl",
145+
"services/FileDataEntryBlob.jl",
146+
"services/InMemoryDataEntryBlob.jl"]
149147
150148
```

src/DataBlobs/DataBlobs.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ include("services/InMemoryDataEntryBlob.jl")
1515

1616

1717
export AbstractDataEntry, GeneralDataEntry, MongodbDataEntry, FileDataEntry
18-
export InMemoryDataStore, FileDataStore
1918

2019
export getData, addData!, updateData!, deleteData!, listStoreEntries
2120
export getDataBlob, addDataBlob!, updateDataBlob!, deleteDataBlob!, listDataBlobs

src/DataBlobs/services/AbstractDataEntries.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ buildSourceString(dfg::AbstractDFG, label::Symbol) =
2626

2727
"""
2828
$(SIGNATURES)
29-
Get big data entry
29+
Get data entry
3030
"""
3131
function getDataEntry(var::AbstractDFGVariable, key::Symbol)
3232
!hasDataEntry(var, key) && error("Data entry $(key) does not exist in variable")
@@ -39,7 +39,7 @@ end
3939

4040
"""
4141
$(SIGNATURES)
42-
Add Big Data Entry to a DFG variable
42+
Add Data Entry to a DFG variable
4343
"""
4444
function addDataEntry!(var::AbstractDFGVariable, bde::AbstractDataEntry)
4545
haskey(var.dataDict, bde.label) && error("Data entry $(bde.label) already exists in variable")
@@ -50,7 +50,7 @@ end
5050

5151
"""
5252
$(SIGNATURES)
53-
Add Big Data Entry to distributed factor graph.
53+
Add Data Entry to distributed factor graph.
5454
Should be extended if DFG variable is not returned by reference.
5555
"""
5656
function addDataEntry!(dfg::AbstractDFG, label::Symbol, bde::AbstractDataEntry)
@@ -60,7 +60,7 @@ end
6060

6161
"""
6262
$(SIGNATURES)
63-
Update big data entry
63+
Update data entry
6464
6565
DevNote
6666
- DF, unclear if `update` verb is applicable in this case, see #404
@@ -77,23 +77,23 @@ end
7777

7878
"""
7979
$(SIGNATURES)
80-
Delete big data entry from the factor graph.
80+
Delete data entry from the factor graph.
8181
Note this doesn't remove it from any data stores.
8282
8383
Notes:
84-
- users responsibility to delete big data in db before deleting entry
84+
- users responsibility to delete data in db before deleting entry
8585
"""
8686
function deleteDataEntry!(var::AbstractDFGVariable, key::Symbol)
8787
return pop!(var.dataDict, key)
8888
end
8989
function deleteDataEntry!(dfg::AbstractDFG, label::Symbol, key::Symbol)
90-
#users responsibility to delete big data in db before deleting entry
90+
#users responsibility to delete data in db before deleting entry
9191
# !isVariable(dfg, label) && return nothing
9292
return deleteDataEntry!(getVariable(dfg, label), key)
9393
end
9494

9595
function deleteDataEntry!(var::AbstractDFGVariable, entry::AbstractDataEntry)
96-
#users responsibility to delete big data in db before deleting entry
96+
#users responsibility to delete data in db before deleting entry
9797
return deleteDataEntry!(var, entry.label)
9898
end
9999

@@ -111,7 +111,7 @@ hasDataEntry(var::DFGVariable, key::Symbol) = haskey(var.dataDict, key)
111111

112112
"""
113113
$(SIGNATURES)
114-
Get big data entries, Vector{AbstractDataEntry}
114+
Get data entries, Vector{AbstractDataEntry}
115115
"""
116116
function getDataEntries(var::AbstractDFGVariable)
117117
#or should we return the iterator, Base.ValueIterator{Dict{Symbol,AbstractDataEntry}}?

src/DataBlobs/services/DataEntryBlob.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ function addData! end
6565
$(SIGNATURES)
6666
Update a data entry or blob to the blob store or dfg.
6767
Related
68-
[`updateDataEntry`](@ref)
68+
[`updateDataEntry!`](@ref)
6969
"""
7070
function updateData! end
7171

7272
"""
7373
$(SIGNATURES)
7474
Delete a data entry and blob from the blob store or dfg.
7575
Related
76-
[`deleteDataEntry`](@ref)
76+
[`deleteDataEntry!`](@ref)
7777
"""
7878
function deleteData! end
7979

src/Deprecated.jl

Lines changed: 22 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ abstract type AbstractDataStore end
2020
struct GeneralDataEntry <: AbstractDataEntry end
2121
GeneralDataEntry(args...; kwargs...) = error("`GeneralDataEntry` is deprecated, use `BlobStoreEntry`")
2222

23+
export InMemoryDataStore, FileDataStore
24+
2325
struct FileDataStore <: AbstractDataStore end
2426
FileDataStore(args...; kwargs...) = error("`FileDataStore` is deprecated, use `FolderStore`")
2527

@@ -35,92 +37,32 @@ deleteDataBlob!(store::AbstractDataStore, entry::AbstractDataEntry) = error("Abs
3537
listDataBlobs(store::AbstractDataStore) = error("AbstractDataStore $(typeof(store)) is deprecated.")
3638

3739

40+
addData!(dfg::AbstractDFG,
41+
lbl::Symbol,
42+
datastore::Union{FileDataStore, InMemoryDataStore},
43+
descr::Symbol,
44+
mimeType::AbstractString,
45+
data::Vector{UInt8} ) = error("This API, FileDataStore and in MemoryDataStore is deprecated use new api parameter order and FolderStore")
3846

39-
"""
40-
$(SIGNATURES)
41-
Add Big Data Entry to distributed factor graph.
42-
Should be extended if DFG variable is not returned by reference.
43-
44-
Example
45-
46-
See docs for `getDataEntryElement`.
47-
48-
Related
49-
50-
addData!, getDataEntryElement, fetchData
51-
"""
52-
function addData!(dfg::AbstractDFG,
53-
lbl::Symbol,
54-
datastore::Union{FileDataStore, InMemoryDataStore},
55-
descr::Symbol,
56-
mimeType::AbstractString,
57-
data::Vector{UInt8} )
58-
#
59-
node = isVariable(dfg, lbl) ? getVariable(dfg, lbl) : getFactor(dfg, lbl)
60-
# Make a big data entry in the graph - use JSON2 to just write this
61-
entry = GeneralDataEntry(dfg, node, descr, mimeType=mimeType)
62-
# Set it in the store
63-
addDataBlob!(datastore, entry, data)
64-
# Add the entry to the graph
65-
addDataEntry!(node, entry)
66-
end
67-
# const addDataEntry! = addData!
68-
69-
70-
71-
"""
72-
$SIGNATURES
73-
Get both the entry and raw data element from datastore returning as a tuple.
74-
75-
Notes:
76-
- This is the counterpart to `addDataEntry!`.
77-
- Data is identified by the node in the DFG object `dfglabel::Symbol` as well as `datalabel::Symbol`.
78-
- The data should have been stored along with a `entry.mimeType::String` which describes the format of the data.
79-
- ImageMagick.jl is useful for storing images in png or jpg compressed format.
80-
81-
Example
82-
83-
```julia
84-
# some dfg object
85-
fg = initfg()
86-
addVariable!(fg, :x0, IIF.ContinuousScalar) # using IncrementalInference
87-
# FileDataStore (as example)
88-
datastore = FileDataStore(joinLogPath(fg,"datastore"))
47+
export addDataElement!
48+
addDataElement!(dfg::AbstractDFG,
49+
lbl::Symbol,
50+
datastore::Union{FileDataStore, InMemoryDataStore},
51+
descr::Symbol,
52+
mimeType::AbstractString,
53+
data::Vector{UInt8} ) = error("This API, FileDataStore and in MemoryDataStore is deprecated use addData! and FolderStore")
8954

90-
# now some data comes in
91-
mydata = Dict(:soundBite => randn(Float32, 10000), :meta => "something about lazy foxes and fences.")
9255

93-
# store the data
94-
addDataEntry!( fg, :x0, datastore, :SOUND_DATA, "application/json", Vector{UInt8}(JSON2.write( mydata )) )
9556

96-
# get/fetch the data
97-
entry, rawData = fetchData(fg, :x0, datastore, :SOUND_DATA)
57+
export getDataEntryBlob
58+
getDataEntryBlob(dfg::AbstractDFG,
59+
dfglabel::Symbol,
60+
datastore::Union{FileDataStore, InMemoryDataStore},
61+
datalabel::Symbol) = error("This API, FileDataStore and in MemoryDataStore is deprecated use getData and FolderStore")
9862

99-
# unpack data to original format (this must be done by the user)
100-
@show entry.mimeType # "applicatio/json"
101-
userFormat = JSON2.read(IOBuffer(rawData))
102-
```
103-
104-
Related
105-
106-
addDataEntry!, addData!, fetchData, fetchDataEntryElement
107-
"""
108-
function getDataEntryBlob(dfg::AbstractDFG,
109-
dfglabel::Symbol,
110-
datastore::Union{FileDataStore, InMemoryDataStore},
111-
datalabel::Symbol)
112-
#
113-
vari = getVariable(dfg, dfglabel)
114-
if !hasDataEntry(vari, datalabel)
115-
# current standards is to fail hard
116-
error("missing data entry $datalabel in $dfglabel")
117-
# return nothing, nothing
118-
end
119-
entry = getDataEntry(vari, datalabel)
120-
element = getDataBlob(datastore, entry)
121-
return entry, element
122-
end
63+
export fetchDataEntryElement
12364
const fetchDataEntryElement = getDataEntryBlob
65+
export fetchData
12466
const fetchData = getDataEntryBlob
12567

12668
#

src/DistributedFactorGraphs.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,9 @@ export copyGraph!, deepcopyGraph, deepcopyGraph!, buildSubgraph, mergeGraph!
179179
##------------------------------------------------------------------------------
180180
export addDataEntry!, getDataEntry, updateDataEntry!, deleteDataEntry!, getDataEntries, listDataEntries, hasDataEntry, hasDataEntry
181181
# convenience wrappers
182-
export addDataEntry!, getDataEntryBlob
182+
export addDataEntry!
183183
# aliases
184-
export addData!, fetchData, fetchDataEntryBlob
185-
184+
export addData!
186185

187186
##------------------------------------------------------------------------------
188187
# Factors

test/runtests.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ end
5959
end
6060

6161
@testset "Data Store Tests" begin
62-
#include("DataStoreTests.jl")
6362
include("consol_DataEntryBlobTests.jl")
6463
end
6564

0 commit comments

Comments
 (0)