Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ uuid = "f3e6a059-199c-4ada-8143-fcefb97e6165"
keywords = ["navability", "navigation", "slam", "sdk", "robotics", "robots"]
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."
authors = ["NavAbility <info@navability.io>"]
version = "0.8.5"
version = "0.8.6"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand All @@ -24,7 +24,7 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
Aqua = "0.8"
Base64 = "1.10"
Dates = "1.10"
DistributedFactorGraphs = "0.25.2"
DistributedFactorGraphs = "0.25.2, 0.26"
DocStringExtensions = "0.8, 0.9"
Downloads = "1"
GraphQLClient = "0.7"
Expand Down
53 changes: 53 additions & 0 deletions docs/PublicAPI_design.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
### Public API - supported in all SDKs

# All funcitons should follow DistributedFactorGraphs.jl and we use Julia here to define the signitures.

# Other lanuages should follow DFG.jl/NvaSDK.jl as closely as possible with the following exceptions
# - labels are Symbols in julia and strings elsewhere.
# - mutation in julia is done with ! at the end of the function name and not in other languages.
# - notably C and Rust do not support function overloading and may also be different or more explicit and perhaps using adjectives.

## Structs

## Functions

### Singular `get`

getVariable(dfg::NavAbilityDFG, label::Symbol)

getFactor(dfg::NavAbilityDFG, label::Symbol)

getBlobentry(dfg::NavAbilityDFG, variableLabel::Symbol, label::Symbol)

getVariableBlobentry(dfg::NavAbilityDFG, variableLabel::Symbol, label::Symbol)

getFactorBlobentry(dfg::NavAbilityDFG, factorLabel::Symbol, label::Symbol)

getGraphBlobentry(dfg::NavAbilityDFG, label::Symbol)

getAgentBlobentry(dfg::NavAbilityDFG, label::Symbol)

getVariableState(dfg::NavAbilityDFG, variableLabel::Symbol, label::Symbol)

getFactorState(dfg::NavAbilityDFG, factorLabel::Symbol)

getBlob(store::NavAbilityBlobstore, blobId::UUID)

### Plural `get`

### Singular `add`

addBlob!(store::NavAbilityBlobstore, blobId::UUID, blob::Vector{UInt8})


### Plural `add`

### Singular `update`

### Plural `update`

### Singular `delete`

### Plural `delete`

### `list`
10 changes: 10 additions & 0 deletions src/services/BlobEntry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@
return entry
end

function DFG.deleteGraphBlobEntry!(fgclient::NavAbilityDFG, entry::BlobEntry)
response = executeGql(

Check warning on line 101 in src/services/BlobEntry.jl

View check run for this annotation

Codecov / codecov/patch

src/services/BlobEntry.jl#L100-L101

Added lines #L100 - L101 were not covered by tests
fgclient,
GQL_DELETE_BLOBENTRY,
(id = getId(fgclient.fg, entry.label),),
)
#TOOD check response.data["deleteBlobEntry"]["nodesDeleted"]
return entry

Check warning on line 107 in src/services/BlobEntry.jl

View check run for this annotation

Codecov / codecov/patch

src/services/BlobEntry.jl#L107

Added line #L107 was not covered by tests
end

# =========================================================================================
# BlobEntry CRUD on other nodes
# =========================================================================================
Expand Down
23 changes: 17 additions & 6 deletions src/services/BlobStore.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@
filepath::AbstractString,
blobId::UUID = uuid4();
chunkSize::Integer = UPLOAD_CHUNK_SIZE_HASH,
mimeType::String = "application/octet-stream",
)
# locate large file on fs, ready to read in chunks
fid = open(filepath,"r")
Expand All @@ -195,7 +196,8 @@

# custom header for pushing the file up
headers_ = [
# "Content-Length" => filesize,
"Content-Length" => filesize(filepath),
"Content-Type" => mimeType,
"Accept" => "application/json, text/plain, */*",
"Accept-Encoding" => "gzip, deflate, br",
"Sec-Fetch-Dest" => "empty",
Expand Down Expand Up @@ -241,14 +243,22 @@
blobId
end

function getMimetype(io::IO)
getFormat(s::DFG.FileIO.Stream{T}) where T = T
stream = DFG.FileIO.query(io)

Check warning on line 248 in src/services/BlobStore.jl

View check run for this annotation

Codecov / codecov/patch

src/services/BlobStore.jl#L246-L248

Added lines #L246 - L248 were not covered by tests
# not sure if we need restrict to only our mimetypes, but better than nothing
mime = findfirst(==(getFormat(stream)), DFG._MIMETypes)
if isnothing(mime)
return MIME("application/octet-stream")

Check warning on line 252 in src/services/BlobStore.jl

View check run for this annotation

Codecov / codecov/patch

src/services/BlobStore.jl#L250-L252

Added lines #L250 - L252 were not covered by tests
else
return mime

Check warning on line 254 in src/services/BlobStore.jl

View check run for this annotation

Codecov / codecov/patch

src/services/BlobStore.jl#L254

Added line #L254 was not covered by tests
end
end

function DFG.addBlob!(
store::NavAbilityBlobStore,
blobId::UUID,
blob::Vector{UInt8},
)
function DFG.addBlob!(store::NavAbilityBlobStore, blobId::UUID, blob::Vector{UInt8})

Check warning on line 258 in src/services/BlobStore.jl

View check run for this annotation

Codecov / codecov/patch

src/services/BlobStore.jl#L258

Added line #L258 was not covered by tests
client = store.client

mimeType = getMimetype(IOBuffer(blob))

Check warning on line 261 in src/services/BlobStore.jl

View check run for this annotation

Codecov / codecov/patch

src/services/BlobStore.jl#L261

Added line #L261 was not covered by tests
filesize = length(blob)
# TODO: Use about a 50M file part here.
np = 1 # TODO: ceil(filesize / 50e6)
Expand All @@ -261,6 +271,7 @@
# custom header for pushing the file up
headers = [
"Content-Length" => filesize,
"Content-Type" => string(mimeType),
"Accept" => "application/json, text/plain, */*",
"Accept-Encoding" => "gzip, deflate, br",
"Sec-Fetch-Dest" => "empty",
Expand Down
Loading