Skip to content

Commit f690f1a

Browse files
authored
Merge pull request #899 from JuliaRobotics/22Q3/maint/dataentrenti
2 parents 54805b2 + a933f78 commit f690f1a

File tree

3 files changed

+47
-42
lines changed

3 files changed

+47
-42
lines changed

src/DataBlobs/entities/AbstractDataEntries.jl

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,50 @@ struct MongodbDataEntry <: AbstractDataEntry
4848
#flags::Bool ready, valid, locked, permissions
4949
#MIMEType::String
5050
end
51+
52+
53+
##==============================================================================
54+
## FileDataEntryBlob Types
55+
##==============================================================================
56+
export FileDataEntry
57+
"""
58+
$(TYPEDEF)
59+
Data Entry in a file.
60+
"""
61+
struct FileDataEntry <: AbstractDataEntry
62+
label::Symbol
63+
id::UUID
64+
folder::String
65+
hash::String #using bytes2hex or perhaps Vector{Uint8}?
66+
createdTimestamp::ZonedDateTime
67+
68+
function FileDataEntry(label, id, folder, hash, timestamp)
69+
if !isdir(folder)
70+
@info "Folder '$folder' doesn't exist - creating."
71+
# create new folder
72+
mkpath(folder)
73+
end
74+
return new(label, id, folder, hash, timestamp)
75+
end
76+
end
77+
78+
79+
##==============================================================================
80+
## InMemoryDataEntry Types
81+
##==============================================================================
82+
export InMemoryDataEntry
83+
"""
84+
$(TYPEDEF)
85+
Store data temporary in memory.
86+
NOTE: Neither Entry nor Blob will be persisted.
87+
"""
88+
struct InMemoryDataEntry{T} <: AbstractDataEntry
89+
label::Symbol
90+
id::UUID
91+
#hash::String #Is this needed?
92+
createdTimestamp::ZonedDateTime
93+
data::T
94+
end
95+
96+
# getHash(::InMemoryDataEntry) = UInt8[]
97+
assertHash(de::InMemoryDataEntry, db; hashfunction = sha256) = true

src/DataBlobs/services/FileDataEntryBlob.jl

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,4 @@
1-
##==============================================================================
2-
## FileDataEntryBlob Types
3-
##==============================================================================
4-
export FileDataEntry
5-
"""
6-
$(TYPEDEF)
7-
Data Entry in a file.
8-
"""
9-
struct FileDataEntry <: AbstractDataEntry
10-
label::Symbol
11-
id::UUID
12-
folder::String
13-
hash::String #using bytes2hex or perhaps Vector{Uint8}?
14-
createdTimestamp::ZonedDateTime
151

16-
function FileDataEntry(label, id, folder, hash, timestamp)
17-
if !isdir(folder)
18-
@info "Folder '$folder' doesn't exist - creating."
19-
# create new folder
20-
mkpath(folder)
21-
end
22-
return new(label, id, folder, hash, timestamp)
23-
end
24-
end
252

263
# @generated function ==(x::FileDataEntry, y::FileDataEntry)
274
# mapreduce(n -> :(x.$n == y.$n), (a,b)->:($a && $b), fieldnames(x))

src/DataBlobs/services/InMemoryDataEntryBlob.jl

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,3 @@
1-
##==============================================================================
2-
## InMemoryDataEntry Types
3-
##==============================================================================
4-
export InMemoryDataEntry
5-
"""
6-
$(TYPEDEF)
7-
Store data temporary in memory.
8-
NOTE: Neither Entry nor Blob will be persisted.
9-
"""
10-
struct InMemoryDataEntry{T} <: AbstractDataEntry
11-
label::Symbol
12-
id::UUID
13-
#hash::String #Is this needed?
14-
createdTimestamp::ZonedDateTime
15-
data::T
16-
end
17-
18-
# getHash(::InMemoryDataEntry) = UInt8[]
19-
assertHash(de::InMemoryDataEntry, db; hashfunction = sha256) = true
201

212

223
##==============================================================================

0 commit comments

Comments
 (0)