|
1 |
| -""" |
2 |
| - $(TYPEDEF) |
3 |
| -GeneralDataEntry is a generic multipurpose data entry that creates a unique |
4 |
| -reproducible key using userId_robotId_sessionId_variableId_key. |
5 |
| -""" |
6 |
| -mutable struct GeneralDataEntry <: AbstractDataEntry |
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 |
| 1 | +##============================================================================== |
| 2 | +## AbstractDataEntry - Defined in src/entities/AbstractDFG.jl |
| 3 | +##============================================================================== |
| 4 | +# Fields to be implemented |
| 5 | +# label |
| 6 | +# id |
13 | 7 |
|
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, getLabel(v), String(key)]), "_") |
21 |
| - return Symbol(key) |
22 |
| -end |
| 8 | +getLabel(entry::AbstractDataEntry) = entry.label |
| 9 | +getId(entry::AbstractDataEntry) = entry.id |
| 10 | +getHash(entry::AbstractDataEntry) = hex2bytes(entry.hash) |
| 11 | +getCreatedTimestamp(entry::AbstractDataEntry) = entry.createdTimestamp |
23 | 12 |
|
24 | 13 |
|
25 |
| -GeneralDataEntry(key::Symbol, storeKey::Symbol; |
26 |
| - mimeType::String="application/octet-stream") = |
27 |
| - GeneralDataEntry(key, storeKey, now(), now(), mimeType) |
| 14 | +##============================================================================== |
| 15 | +## BlobStoreEntry |
| 16 | +##============================================================================== |
| 17 | +export BlobStoreEntry |
28 | 18 |
|
29 |
| -function GeneralDataEntry(dfg::G, var::V, key::Symbol; |
30 |
| - mimeType::String="application/octet-stream") where {G <: AbstractDFG, V <: AbstractDFGVariable} |
31 |
| - return GeneralDataEntry(key, _uniqueKey(dfg, var, key), mimeType=mimeType) |
| 19 | +""" |
| 20 | + $(TYPEDEF) |
| 21 | +Genaral Data Store Entry. |
| 22 | +""" |
| 23 | +struct BlobStoreEntry <: AbstractDataEntry |
| 24 | + label::Symbol |
| 25 | + id::UUID |
| 26 | + blobstore::Symbol |
| 27 | + hash::String # Probably https://docs.julialang.org/en/v1/stdlib/SHA |
| 28 | + origin::String # E.g. user|robot|session|varlabel |
| 29 | + description::String |
| 30 | + mimeType::String |
| 31 | + createdTimestamp::ZonedDateTime # of when the entry was created |
32 | 32 | end
|
33 | 33 |
|
| 34 | +# TODO |
34 | 35 | """
|
35 | 36 | $(TYPEDEF)
|
36 | 37 | Data Entry in MongoDB.
|
37 | 38 | """
|
38 | 39 | struct MongodbDataEntry <: AbstractDataEntry
|
39 |
| - key::Symbol |
40 |
| - oid::NTuple{12, UInt8} #mongodb object id |
| 40 | + label::Symbol |
| 41 | + id::UUID |
| 42 | + oid::NTuple{12, UInt8} #mongodb object id - TODO Not needed with id::UUID unique, but perhaps usefull |
| 43 | + hash::String |
| 44 | + createdTimestamp::ZonedDateTime |
| 45 | + # mongodb |
| 46 | + # mongoConfig::MongoConfig |
41 | 47 | #maybe other fields such as:
|
42 | 48 | #flags::Bool ready, valid, locked, permissions
|
43 | 49 | #MIMEType::String
|
44 | 50 | end
|
45 |
| - |
46 |
| - |
47 |
| -""" |
48 |
| - $(TYPEDEF) |
49 |
| -Data Entry in a file. |
50 |
| -""" |
51 |
| -struct FileDataEntry <: AbstractDataEntry |
52 |
| - key::Symbol |
53 |
| - filename::String |
54 |
| -end |
0 commit comments