Skip to content

Commit 64a9e0f

Browse files
committed
fix warnings
1 parent 25f906e commit 64a9e0f

File tree

5 files changed

+172
-214
lines changed

5 files changed

+172
-214
lines changed

src/DataBlobs/DataBlobs.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ include("entities/BlobStores.jl")
77
include("services/AbstractBlobEntries.jl")
88
include("services/BlobEntry.jl")
99
include("services/BlobStores.jl")
10+
include("services/Blob.jl")
1011

1112
# include("services/InMemoryStore.jl")
1213

src/DataBlobs/services/AbstractBlobEntries.jl

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,67 @@ function deleteBlobEntry!(var::AbstractDFGVariable, entry::BlobEntry)
119119
return deleteBlobEntry!(var, entry.label)
120120
end
121121

122+
123+
124+
125+
##==============================================================================
126+
## Blob CRUD interface
127+
##==============================================================================
128+
129+
130+
"""
131+
Get the data entry and blob for the specified blobstore or dfg retured as a tuple.
132+
Get the data blob for the specified blobstore or dfg.
133+
134+
Related
135+
[`getBlobEntry`](@ref)
136+
137+
$(METHODLIST)
138+
"""
139+
function getBlob end
140+
141+
"""
142+
Add a data Entry and Blob to a distributed factor graph or BlobStore.
143+
Adds a blob to the blob store or dfg with the given entry.
144+
145+
Related
146+
[`addBlobEntry!`](@ref)
147+
148+
$(METHODLIST)
149+
"""
150+
function addBlob! end
151+
152+
"""
153+
Update a blob to the blob store or dfg with the given entry.
154+
Update a data entry or blob to the blob store or dfg.
155+
Related
156+
[`updateBlobEntry!`](@ref)
157+
158+
$(METHODLIST)
159+
160+
DevNotes
161+
- TODO TBD update verb on data since data blobs and entries are restricted to immutable only.
162+
"""
163+
function updateBlob! end
164+
165+
"""
166+
Delete a data entry and blob from the blob store or dfg.
167+
Delete a blob to the blob store or dfg with the given entry.
168+
169+
Related
170+
[`deleteBlobEntry!`](@ref)
171+
172+
$(METHODLIST)
173+
"""
174+
function deleteBlob! end
175+
176+
"""
177+
$(SIGNATURES)
178+
List all ids in the blob store.
179+
"""
180+
function listBlobs end
181+
182+
122183
##==============================================================================
123184
## BlobEntry - Helper functions, Lists, etc
124185
##==============================================================================

src/DataBlobs/services/Blob.jl

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
2+
3+
##==============================================================================
4+
## DFG Blob CRUD
5+
##==============================================================================
6+
7+
# function getBlob(
8+
# dfg::AbstractDFG,
9+
# entry::BlobEntry;
10+
# checkhash::Bool=true,
11+
# )
12+
13+
# end
14+
15+
function getBlob(
16+
dfg::AbstractDFG,
17+
vlabel::Symbol,
18+
key::Union{Symbol,UUID, <:AbstractString, Regex};
19+
hashfunction = sha256,
20+
checkhash::Bool=true
21+
)
22+
de_ = getBlobEntry(dfg, vlabel, key)
23+
_first(s) = s
24+
_first(s::AbstractVector) = s[1]
25+
de = _first(de_)
26+
db = getBlob(dfg, de)
27+
28+
checkhash && assertHash(de, db, hashfunction=hashfunction)
29+
return de=>db
30+
end
31+
32+
function addBlob!(
33+
dfg::AbstractDFG,
34+
label::Symbol,
35+
entry::BlobEntry,
36+
blob::Vector{UInt8};
37+
hashfunction = sha256,
38+
checkhash::Bool=true
39+
)
40+
checkhash && assertHash(entry, blob, hashfunction=hashfunction)
41+
de = addBlobEntry!(dfg, label, entry)
42+
db = addBlob!(dfg, de, blob)
43+
return de=>db
44+
end
45+
46+
function addBlob!(
47+
::Type{<:BlobEntry},
48+
dfg::AbstractDFG,
49+
label::Symbol,
50+
key::Symbol,
51+
blob::AbstractVector{UInt8},
52+
timestamp=now(localzone());
53+
id::UUID = uuid4(),
54+
hashfunction::Function = sha256
55+
)
56+
fde = BlobEntry(key, id, timestamp, blob)
57+
de = addBlobEntry!(dfg, label, fde)
58+
return de=>blob
59+
end
60+
61+
function updateBlob!(
62+
dfg::AbstractDFG,
63+
label::Symbol,
64+
entry::BlobEntry,
65+
blob::Vector{UInt8};
66+
hashfunction = sha256,
67+
checkhash::Bool=true
68+
)
69+
checkhash && assertHash(entry, blob, hashfunction=hashfunction)
70+
de = updateBlobEntry!(dfg, label, entry)
71+
db = updateBlob!(dfg, de, blob)
72+
return de=>db
73+
end
74+
75+
function deleteBlob!(
76+
dfg::AbstractDFG,
77+
label::Symbol,
78+
key::Symbol
79+
)
80+
de = deleteBlobEntry!(dfg, label, key)
81+
db = deleteBlob!(dfg, de)
82+
return de=>db
83+
end

src/DataBlobs/services/BlobEntry.jl

Lines changed: 0 additions & 185 deletions
Original file line numberDiff line numberDiff line change
@@ -46,188 +46,3 @@ end
4646
Base.show(io::IO, ::MIME"text/plain", entry::BlobEntry) = show(io, entry)
4747

4848

49-
##==============================================================================
50-
## DFG BlobBlob CRUD
51-
##==============================================================================
52-
53-
"""
54-
$(SIGNATURES)
55-
Get the data blob for the specified blobstore or dfg.
56-
"""
57-
function getBlob end
58-
59-
"""
60-
$(SIGNATURES)
61-
Adds a blob to the blob store or dfg with the given entry.
62-
"""
63-
function addBlob! end
64-
65-
"""
66-
$(SIGNATURES)
67-
Update a blob to the blob store or dfg with the given entry.
68-
"""
69-
function updateBlob! end
70-
71-
"""
72-
$(SIGNATURES)
73-
Delete a blob to the blob store or dfg with the given entry.
74-
"""
75-
function deleteBlob! end
76-
77-
"""
78-
$(SIGNATURES)
79-
List all ids in the blob store.
80-
"""
81-
function listBlobs end
82-
83-
##==============================================================================
84-
## Blob CRUD interface
85-
##==============================================================================
86-
87-
"""
88-
Get the data entry and blob for the specified blobstore or dfg retured as a tuple.
89-
Related
90-
[`getBlobEntry`](@ref)
91-
92-
$(METHODLIST)
93-
"""
94-
function getBlob end
95-
96-
"""
97-
Add a data Entry and Blob to a distributed factor graph or BlobStore.
98-
Related
99-
[`addBlobEntry!`](@ref)
100-
101-
$(METHODLIST)
102-
"""
103-
function addBlob! end
104-
105-
"""
106-
Update a data entry or blob to the blob store or dfg.
107-
Related
108-
[`updateBlobEntry!`](@ref)
109-
110-
$(METHODLIST)
111-
112-
DevNotes
113-
- TODO TBD update verb on data since data blobs and entries are restricted to immutable only.
114-
"""
115-
function updateBlob! end
116-
117-
"""
118-
Delete a data entry and blob from the blob store or dfg.
119-
Related
120-
[`deleteBlobEntry!`](@ref)
121-
122-
$(METHODLIST)
123-
"""
124-
function deleteBlob! end
125-
126-
#
127-
# addBlob!(dfg::AbstractDFG, entry::BlobEntry, blob)
128-
# updateBlob!(dfg::AbstractDFG, entry::BlobEntry, blob)
129-
# deleteBlob!(dfg::AbstractDFG, entry::BlobEntry)
130-
131-
132-
133-
function getBlob(dfg::AbstractDFG, entry::BlobEntry)
134-
error("$(typeof(dfg)) doesn't override 'getBlob', with $(typeof(entry)).")
135-
end
136-
137-
function addBlob!(dfg::AbstractDFG, entry::BlobEntry, data::T) where T
138-
error("$(typeof(dfg)) doesn't override 'addBlob!'.")
139-
end
140-
141-
function updateBlob!(dfg::AbstractDFG, entry::BlobEntry, data::T) where T
142-
error("$(typeof(dfg)) doesn't override 'updateBlob!'.")
143-
end
144-
145-
function deleteBlob!(dfg::AbstractDFG, entry::BlobEntry)
146-
error("$(typeof(dfg)) doesn't override 'deleteBlob!'.")
147-
end
148-
149-
function listBlobs(dfg::AbstractDFG)
150-
error("$(typeof(dfg)) doesn't override 'listBlobs'.")
151-
end
152-
153-
##==============================================================================
154-
## DFG Blob CRUD
155-
##==============================================================================
156-
157-
# function getBlob(
158-
# dfg::AbstractDFG,
159-
# entry::BlobEntry;
160-
# checkhash::Bool=true,
161-
# )
162-
163-
# end
164-
165-
function getBlob(
166-
dfg::AbstractDFG,
167-
vlabel::Symbol,
168-
key::Union{Symbol,UUID, <:AbstractString, Regex};
169-
hashfunction = sha256,
170-
checkhash::Bool=true
171-
)
172-
de_ = getBlobEntry(dfg, vlabel, key)
173-
_first(s) = s
174-
_first(s::AbstractVector) = s[1]
175-
de = _first(de_)
176-
db = getBlob(dfg, de)
177-
178-
checkhash && assertHash(de, db, hashfunction=hashfunction)
179-
return de=>db
180-
end
181-
182-
function addBlob!(
183-
dfg::AbstractDFG,
184-
label::Symbol,
185-
entry::BlobEntry,
186-
blob::Vector{UInt8};
187-
hashfunction = sha256,
188-
checkhash::Bool=true
189-
)
190-
checkhash && assertHash(entry, blob, hashfunction=hashfunction)
191-
de = addBlobEntry!(dfg, label, entry)
192-
db = addBlob!(dfg, de, blob)
193-
return de=>db
194-
end
195-
196-
function addBlob!(
197-
::Type{<:BlobEntry},
198-
dfg::AbstractDFG,
199-
label::Symbol,
200-
key::Symbol,
201-
blob::AbstractVector{UInt8},
202-
timestamp=now(localzone());
203-
id::UUID = uuid4(),
204-
hashfunction::Function = sha256
205-
)
206-
fde = BlobEntry(key, id, timestamp, blob)
207-
de = addBlobEntry!(dfg, label, fde)
208-
return de=>blob
209-
end
210-
211-
function updateBlob!(
212-
dfg::AbstractDFG,
213-
label::Symbol,
214-
entry::BlobEntry,
215-
blob::Vector{UInt8};
216-
hashfunction = sha256,
217-
checkhash::Bool=true
218-
)
219-
checkhash && assertHash(entry, blob, hashfunction=hashfunction)
220-
de = updateBlobEntry!(dfg, label, entry)
221-
db = updateBlob!(dfg, de, blob)
222-
return de=>db
223-
end
224-
225-
function deleteBlob!(
226-
dfg::AbstractDFG,
227-
label::Symbol,
228-
key::Symbol
229-
)
230-
de = deleteBlobEntry!(dfg, label, key)
231-
db = deleteBlob!(dfg, de)
232-
return de=>db
233-
end

0 commit comments

Comments
 (0)