Skip to content

Commit 07d3035

Browse files
authored
Merge pull request #238 from JuliaRobotics/master
Release 0.5.2 RC1
2 parents a2c5f83 + c5c7bd9 commit 07d3035

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1916
-927
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ deps/deps.jl
55
docs/build
66
Manifest.toml
77
dev
8+
test/sandbox.jl

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DistributedFactorGraphs"
22
uuid = "b5cc3c7e-6572-11e9-2517-99fb8daf2f04"
3-
version = "0.5.1"
3+
version = "0.5.2"
44

55
[deps]
66
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# DistributedFactorGraphs.jl
22

3-
[![Build Status](https://travis-ci.org/JuliaRobotics/DistributedFactorGraphs.jl.svg?branch=master)](https://travis-ci.org/JuliaRobotics/DistributedFactorGraphs.jl)
4-
[![Codecov Status](https://codecov.io/gh/JuliaRobotics/DistributedFactorGraphs.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaRobotics/DistributedFactorGraphs.jl)
5-
[![Coverage Status](https://img.shields.io/coveralls/JuliaRobotics/DistributedFactorGraphs.jl.svg)](https://coveralls.io/r/JuliaRobotics/DistributedFactorGraphs.jl?branch=master)
6-
[![docs](https://img.shields.io/badge/docs-latest-blue.svg)](http://juliarobotics.github.io/DistributedFactorGraphs.jl/latest/)
3+
Release | Dev | Coverage | Docs
4+
---------|-----|----------|------
5+
[![Build Status](https://travis-ci.org/JuliaRobotics/DistributedFactorGraphs.jl.svg?branch=release/v0.5)](https://travis-ci.org/JuliaRobotics/DistributedFactorGraphs.jl) | [![Build Status](https://travis-ci.org/JuliaRobotics/DistributedFactorGraphs.jl.svg?branch=master)](https://travis-ci.org/JuliaRobotics/DistributedFactorGraphs.jl) | [![Codecov Status](https://codecov.io/gh/JuliaRobotics/DistributedFactorGraphs.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaRobotics/DistributedFactorGraphs.jl) [![Coverage Status](https://img.shields.io/coveralls/JuliaRobotics/DistributedFactorGraphs.jl.svg)](https://coveralls.io/r/JuliaRobotics/DistributedFactorGraphs.jl?branch=master) | [![docs](https://img.shields.io/badge/docs-latest-blue.svg)](http://juliarobotics.github.io/DistributedFactorGraphs.jl/latest/)
76

87
DistributedFactorGraphs.jl provides a flexible factor graph API for use in the [Caesar.jl](https://github.com/JuliaRobotics/Caesar.jl) ecosystem. The package supplies:
98
* A standardized API for interacting with factor graphs

src/BigData.jl

Lines changed: 0 additions & 139 deletions
This file was deleted.

src/BigData/BigData.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
include("entities/AbstractDataStore.jl")
2+
include("entities/AbstractBigDataEntries.jl")
3+
include("entities/InMemoryDataStore.jl")
4+
include("entities/FileDataStore.jl")
5+
6+
include("services/AbstractDataStore.jl")
7+
include("services/AbstractBigDataEntries.jl")
8+
include("services/InMemoryDataStore.jl")
9+
include("services/FileDataStore.jl")
10+
11+
export AbstractDataStore
12+
13+
export GeneralBigDataEntry, MongodbBigDataEntry, FileBigDataEntry
14+
export InMemoryDataStore, FileDataStore
15+
16+
export getBigData, addBigData!, updateBigData!, deleteBigData!, listStoreEntries
17+
export copyStore
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
"""
2+
$(TYPEDEF)
3+
GeneralBigDataEntry is a generic multipurpose data entry that creates a unique
4+
reproducible key using userId_robotId_sessionId_variableId_key.
5+
"""
6+
mutable struct GeneralBigDataEntry <: AbstractBigDataEntry
7+
key::Symbol
8+
storeKey::Symbol # Could swap this to string, but using it as an index later, so better as a symbol I believe.
9+
createdTimestamp::DateTime
10+
lastUpdatedTimestamp::DateTime
11+
mimeType::String
12+
end
13+
14+
"""
15+
$(SIGNATURES)
16+
Internal function to generate a unique key for the entry - userId_robotId_sessionId_variable_key.
17+
Simple symbol.
18+
"""
19+
function _uniqueKey(dfg::G, v::V, key::Symbol)::Symbol where {G <: AbstractDFG, V <: AbstractDFGVariable}
20+
key = join(String.([dfg.userId, dfg.robotId, dfg.sessionId, label(v), String(key)]), "_")
21+
return Symbol(key)
22+
end
23+
24+
GeneralBigDataEntry(key::Symbol, storeKey::Symbol;
25+
mimeType::String="application/octet-stream") =
26+
GeneralBigDataEntry(key, storeKey, now(), now(), mimeType)
27+
28+
function GeneralBigDataEntry(dfg::G, var::V, key::Symbol;
29+
mimeType::String="application/octet-stream") where {G <: AbstractDFG, V <: AbstractDFGVariable}
30+
return GeneralBigDataEntry(key, _uniqueKey(dfg, var, key), mimeType=mimeType)
31+
end
32+
33+
"""
34+
$(TYPEDEF)
35+
BigDataEntry in MongoDB.
36+
"""
37+
struct MongodbBigDataEntry <: AbstractBigDataEntry
38+
key::Symbol
39+
oid::NTuple{12, UInt8} #mongodb object id
40+
#maybe other fields such as:
41+
#flags::Bool ready, valid, locked, permissions
42+
#MIMEType::Symbol
43+
end
44+
45+
"""
46+
$(TYPEDEF)
47+
BigDataEntry in a file.
48+
"""
49+
struct FileBigDataEntry <: AbstractBigDataEntry
50+
key::Symbol
51+
filename::String
52+
end
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
"""
3+
$(TYPEDEF)
4+
Superclass of all key-value datastores.
5+
"""
6+
abstract type AbstractDataStore{T}
7+
end

src/BigData/entities/FileDataStore.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""
2+
$(TYPEDEF)
3+
Simple file data store with a specified data type and a specified key type.
4+
"""
5+
struct FileDataStore <: AbstractDataStore{UInt8}
6+
folder::String
7+
FileDataStore(folder::String) = begin
8+
if !isdir(folder)
9+
@warn "Folder '$folder' doesn't exist - creating."
10+
mkpath(folder)
11+
end
12+
return new(folder)
13+
end
14+
end
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""
2+
$(TYPEDEF)
3+
Simple in-memory data store with a specified data type and a specified key type.
4+
"""
5+
struct InMemoryDataStore{T, E <: AbstractBigDataEntry} <: AbstractDataStore{T}
6+
data::Dict{Symbol, T}
7+
entries::Dict{Symbol, E}
8+
end
9+
10+
"""
11+
$(SIGNATURES)
12+
Create an in-memory store using a specific data type.
13+
"""
14+
function InMemoryDataStore{T, E}() where {T, E <: AbstractBigDataEntry}
15+
return InMemoryDataStore{T, E}(Dict{Symbol, T}(), Dict{Symbol, E}())
16+
end
17+
18+
"""
19+
$(SIGNATURES)
20+
Create an in-memory store using binary data (UInt8) as a type.
21+
"""
22+
function InMemoryDataStore()
23+
return InMemoryDataStore{Vector{UInt8}, GeneralBigDataEntry}()
24+
end
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import Base: ==
2+
3+
function ==(a::GeneralBigDataEntry, b::GeneralBigDataEntry)
4+
return a.key == b.key &&
5+
a.storeKey == b.storeKey &&
6+
a.mimeType == b.mimeType &&
7+
Dates.value(a.createdTimestamp - b.createdTimestamp) < 1000 &&
8+
Dates.value(a.lastUpdatedTimestamp - b.lastUpdatedTimestamp) < 1000 #1 second
9+
end
10+
11+
function ==(a::MongodbBigDataEntry, b::MongodbBigDataEntry)
12+
return a.key == b.key && a.oid == b.oid
13+
end
14+
15+
function ==(a::FileBigDataEntry, b::FileBigDataEntry)
16+
return a.key == b.key && a.filename == b.filename
17+
end

0 commit comments

Comments
 (0)