Skip to content

Commit 13f04d9

Browse files
authored
Merge pull request #290 from NavAbility/develop
release v0.8.6-rc1
2 parents 08d0c7f + f79a427 commit 13f04d9

File tree

4 files changed

+82
-8
lines changed

4 files changed

+82
-8
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ uuid = "f3e6a059-199c-4ada-8143-fcefb97e6165"
33
keywords = ["navability", "navigation", "slam", "sdk", "robotics", "robots"]
44
desc = "NavAbility SDK: Access NavAbility Cloud factor graph features. Note that this SDK and the related API are still in development. Please let us know if you have any issues at info@navability.io."
55
authors = ["NavAbility <info@navability.io>"]
6-
version = "0.8.5"
6+
version = "0.8.6"
77

88
[deps]
99
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
@@ -24,7 +24,7 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
2424
Aqua = "0.8"
2525
Base64 = "1.10"
2626
Dates = "1.10"
27-
DistributedFactorGraphs = "0.25.2"
27+
DistributedFactorGraphs = "0.25.2, 0.26"
2828
DocStringExtensions = "0.8, 0.9"
2929
Downloads = "1"
3030
GraphQLClient = "0.7"

docs/PublicAPI_design.jl

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
### Public API - supported in all SDKs
2+
3+
# All funcitons should follow DistributedFactorGraphs.jl and we use Julia here to define the signitures.
4+
5+
# Other lanuages should follow DFG.jl/NvaSDK.jl as closely as possible with the following exceptions
6+
# - labels are Symbols in julia and strings elsewhere.
7+
# - mutation in julia is done with ! at the end of the function name and not in other languages.
8+
# - notably C and Rust do not support function overloading and may also be different or more explicit and perhaps using adjectives.
9+
10+
## Structs
11+
12+
## Functions
13+
14+
### Singular `get`
15+
16+
getVariable(dfg::NavAbilityDFG, label::Symbol)
17+
18+
getFactor(dfg::NavAbilityDFG, label::Symbol)
19+
20+
getBlobentry(dfg::NavAbilityDFG, variableLabel::Symbol, label::Symbol)
21+
22+
getVariableBlobentry(dfg::NavAbilityDFG, variableLabel::Symbol, label::Symbol)
23+
24+
getFactorBlobentry(dfg::NavAbilityDFG, factorLabel::Symbol, label::Symbol)
25+
26+
getGraphBlobentry(dfg::NavAbilityDFG, label::Symbol)
27+
28+
getAgentBlobentry(dfg::NavAbilityDFG, label::Symbol)
29+
30+
getVariableState(dfg::NavAbilityDFG, variableLabel::Symbol, label::Symbol)
31+
32+
getFactorState(dfg::NavAbilityDFG, factorLabel::Symbol)
33+
34+
getBlob(store::NavAbilityBlobstore, blobId::UUID)
35+
36+
### Plural `get`
37+
38+
### Singular `add`
39+
40+
addBlob!(store::NavAbilityBlobstore, blobId::UUID, blob::Vector{UInt8})
41+
42+
43+
### Plural `add`
44+
45+
### Singular `update`
46+
47+
### Plural `update`
48+
49+
### Singular `delete`
50+
51+
### Plural `delete`
52+
53+
### `list`

src/services/BlobEntry.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,16 @@ function DFG.deleteAgentBlobEntry!(fgclient::NavAbilityDFG, entry::BlobEntry)
9797
return entry
9898
end
9999

100+
function DFG.deleteGraphBlobEntry!(fgclient::NavAbilityDFG, entry::BlobEntry)
101+
response = executeGql(
102+
fgclient,
103+
GQL_DELETE_BLOBENTRY,
104+
(id = getId(fgclient.fg, entry.label),),
105+
)
106+
#TOOD check response.data["deleteBlobEntry"]["nodesDeleted"]
107+
return entry
108+
end
109+
100110
# =========================================================================================
101111
# BlobEntry CRUD on other nodes
102112
# =========================================================================================

src/services/BlobStore.jl

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ function DFG.addBlob!(
180180
filepath::AbstractString,
181181
blobId::UUID = uuid4();
182182
chunkSize::Integer = UPLOAD_CHUNK_SIZE_HASH,
183+
mimeType::String = "application/octet-stream",
183184
)
184185
# locate large file on fs, ready to read in chunks
185186
fid = open(filepath,"r")
@@ -195,7 +196,8 @@ function DFG.addBlob!(
195196

196197
# custom header for pushing the file up
197198
headers_ = [
198-
# "Content-Length" => filesize,
199+
"Content-Length" => filesize(filepath),
200+
"Content-Type" => mimeType,
199201
"Accept" => "application/json, text/plain, */*",
200202
"Accept-Encoding" => "gzip, deflate, br",
201203
"Sec-Fetch-Dest" => "empty",
@@ -241,14 +243,22 @@ function DFG.addBlob!(
241243
blobId
242244
end
243245

246+
function getMimetype(io::IO)
247+
getFormat(s::DFG.FileIO.Stream{T}) where T = T
248+
stream = DFG.FileIO.query(io)
249+
# not sure if we need restrict to only our mimetypes, but better than nothing
250+
mime = findfirst(==(getFormat(stream)), DFG._MIMETypes)
251+
if isnothing(mime)
252+
return MIME("application/octet-stream")
253+
else
254+
return mime
255+
end
256+
end
244257

245-
function DFG.addBlob!(
246-
store::NavAbilityBlobStore,
247-
blobId::UUID,
248-
blob::Vector{UInt8},
249-
)
258+
function DFG.addBlob!(store::NavAbilityBlobStore, blobId::UUID, blob::Vector{UInt8})
250259
client = store.client
251260

261+
mimeType = getMimetype(IOBuffer(blob))
252262
filesize = length(blob)
253263
# TODO: Use about a 50M file part here.
254264
np = 1 # TODO: ceil(filesize / 50e6)
@@ -261,6 +271,7 @@ function DFG.addBlob!(
261271
# custom header for pushing the file up
262272
headers = [
263273
"Content-Length" => filesize,
274+
"Content-Type" => string(mimeType),
264275
"Accept" => "application/json, text/plain, */*",
265276
"Accept-Encoding" => "gzip, deflate, br",
266277
"Sec-Fetch-Dest" => "empty",

0 commit comments

Comments
 (0)