Skip to content

Commit ca9fc6a

Browse files
committed
run formatter 4
1 parent c22eb2c commit ca9fc6a

File tree

4 files changed

+320
-265
lines changed

4 files changed

+320
-265
lines changed

attic/DataBlobs/FileDataEntryBlob.jl

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11

2-
32
# @generated function ==(x::BlobEntry, y::BlobEntry)
43
# mapreduce(n -> :(x.$n == y.$n), (a,b)->:($a && $b), fieldnames(x))
54
# end
65

76
#
87
# getHash(entry::AbstractBlobEntry) = hex2bytes(entry.hash)
98

10-
119
##==============================================================================
1210
## BlobEntry Common
1311
##==============================================================================
14-
blobfilename(entry::BlobEntry) = joinpath(entry.folder,"$(entry.id).dat")
15-
entryfilename(entry::BlobEntry) = joinpath(entry.folder,"$(entry.id).json")
16-
12+
blobfilename(entry::BlobEntry) = joinpath(entry.folder, "$(entry.id).dat")
13+
entryfilename(entry::BlobEntry) = joinpath(entry.folder, "$(entry.id).json")
1714

1815
##==============================================================================
1916
## BlobEntry Blob CRUD
@@ -37,10 +34,10 @@ function addBlob!(dfg::AbstractDFG, entry::BlobEntry, data::Vector{UInt8})
3734
error("Key '$(entry.id)' entry already exists, but no blob.")
3835
else
3936
open(blobfilename(entry), "w") do f
40-
write(f, data)
37+
return write(f, data)
4138
end
4239
open(entryfilename(entry), "w") do f
43-
JSON.print(f, entry)
40+
return JSON.print(f, entry)
4441
end
4542
# FIXME update for entry.blobId vs entry.originId
4643
return UUID(entry.id)
@@ -71,11 +68,20 @@ end
7168
## BlobEntry CRUD Helpers
7269
##==============================================================================
7370

74-
function addData!(::Type{BlobEntry}, dfg::AbstractDFG, label::Symbol, key::Symbol, folder::String, blob::Vector{UInt8}, timestamp=now(localzone());
75-
id::UUID = uuid4(), hashfunction = sha256)
71+
function addData!(
72+
::Type{BlobEntry},
73+
dfg::AbstractDFG,
74+
label::Symbol,
75+
key::Symbol,
76+
folder::String,
77+
blob::Vector{UInt8},
78+
timestamp = now(localzone());
79+
id::UUID = uuid4(),
80+
hashfunction = sha256,
81+
)
7682
fde = BlobEntry(key, id, folder, bytes2hex(hashfunction(blob)), timestamp)
7783
blobId = addBlob!(dfg, fde, blob) |> UUID
78-
newEntry = BlobEntry(fde; id=blobId, blobId)
84+
newEntry = BlobEntry(fde; id = blobId, blobId)
7985
de = addBlobEntry!(dfg, label, newEntry)
8086
return de # de=>db
8187
end

0 commit comments

Comments
 (0)