-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v4 rewrite ~80% + some tests passing
- Loading branch information
1 parent
0164cdc
commit c9c8fd8
Showing
15 changed files
with
347 additions
and
326 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
## --.--. - .-. .- .--.-.- .- .---- ... . .-.-.-.- | ||
import Base.show | ||
function Base.show(io::IO, B::Bloberia) | ||
print(io, "Bloberia") | ||
_isdir = isdir(B.root) | ||
_pretty_print_pairs(io, | ||
"\n filesys", | ||
hasfilesys(B) ? B.root : "" | ||
) | ||
_pretty_print_pairs(io, | ||
"\n batch(es)", | ||
_isdir ? batchcount(B) : 0 | ||
) | ||
_pretty_print_pairs(io, | ||
"\n blob(s)", | ||
_isdir ? vblobcount(B) : 0 | ||
) | ||
val, unit = _isdir ? _canonical_bytes(filesize(B)) : (0.0, "bytes") | ||
_pretty_print_pairs(io, | ||
"\n disk usage", | ||
_isdir ? string(round(val; digits = 3), " ", unit) : 0.0 | ||
) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,4 @@ | ||
# # random blobs | ||
# random blobs | ||
|
||
# # return blob if exist in DISK | ||
# function blob(B::Bloberia, id::String) | ||
# rb = dBlob(B, id) | ||
# path = rablobpath(rb) | ||
# isdir(path) || error("dBlob(\"", id, "\") not found.") | ||
# return rb | ||
# end | ||
# blob(B::Bloberia) = blob(B, BLOBERIA_DEFAULT_RABLOB_ID) | ||
|
||
# # existing or new blob | ||
# # in practice an unchecked blob | ||
# function blob!(B::Bloberia, id::String) | ||
# rb = dBlob(B, id) | ||
# return rb | ||
# end | ||
# blob!(B::Bloberia) = blob!(B, BLOBERIA_DEFAULT_RABLOB_ID) | ||
# return the only dblob | ||
dblob(bb::BlobBatch) = dBlob(bb) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,39 @@ | ||
# ## --.--. - .-. .- .--.-.- .- .---- ... . .-.-.-.- | ||
# function eachblob(bb::BlobBatch) | ||
# return Channel{vBlob}(0) do _ch | ||
# ondemand_loadvuuids!(bb) | ||
# for uuid in bb.vuuids | ||
# b = vBlob(bb, uuid) # I do not need to check if blob exist | ||
# put!(_ch, b) | ||
# end | ||
# end | ||
# end | ||
# The blobbatch iterate accross the blobs | ||
|
||
# ## --.--. - .-. .- .--.-.- .- .---- ... . .-.-.-.- | ||
# # Iterator | ||
# function _bb_iterate_next(ch::Channel, ch_next) | ||
# isnothing(ch_next) && return nothing | ||
# item, ch_state = ch_next | ||
# bb_state = (ch, ch_state) | ||
# return (item, bb_state) | ||
# end | ||
## --.--. - .-. .- .--.-.- .- .---- ... . .-.-.-.- | ||
function eachblob(bb::BlobBatch) | ||
return Channel{vBlob}(0) do _ch | ||
vuuids = getvuuids(bb) | ||
for uuid in vuuids | ||
# I do not need to check if blob exist | ||
b = vBlob(bb, uuid) | ||
put!(_ch, b) | ||
end | ||
end | ||
end | ||
|
||
# import Base.iterate | ||
# function Base.iterate(bb::BlobBatch) | ||
# ch = eachblob(bb) | ||
# ch_next = iterate(ch) | ||
# return _bb_iterate_next(ch, ch_next) | ||
# end | ||
# --.--. - .-. .- .--.-.- .- .---- ... . .-.-.-.- | ||
# Iterator | ||
function _bb_iterate_next(ch::Channel, ch_next) | ||
isnothing(ch_next) && return nothing | ||
item, ch_state = ch_next | ||
bb_state = (ch, ch_state) | ||
return (item, bb_state) | ||
end | ||
|
||
# function Base.iterate(::BlobBatch, bb_state) | ||
# isnothing(bb_state) && return nothing | ||
# ch, ch_state = bb_state | ||
# ch_next = iterate(ch, ch_state) | ||
# return _bb_iterate_next(ch, ch_next) | ||
# end | ||
import Base.iterate | ||
function Base.iterate(bb::BlobBatch) | ||
ch = eachblob(bb) | ||
ch_next = iterate(ch) | ||
return _bb_iterate_next(ch, ch_next) | ||
end | ||
|
||
# import Base.length | ||
# Base.length(bb::BlobBatch) = vblobcount(bb) | ||
function Base.iterate(::BlobBatch, bb_state) | ||
isnothing(bb_state) && return nothing | ||
ch, ch_state = bb_state | ||
ch_next = iterate(ch, ch_state) | ||
return _bb_iterate_next(ch, ch_next) | ||
end | ||
|
||
import Base.length | ||
Base.length(bb::BlobBatch) = vblobcount(bb) |
Oops, something went wrong.