Skip to content

Commit

Permalink
Fix dict tree splitting bug (#93)
Browse files Browse the repository at this point in the history
* Fix dict tree splitting bug

* add some tests and fix
  • Loading branch information
meggart authored Aug 29, 2022
1 parent 6703dbf commit edb74b8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Zarr"
uuid = "0a941bbe-ad1d-11e8-39d9-ab76183a1d99"
authors = ["Fabian Gans <[email protected]>"]
version = "0.7.2"
version = "0.7.3"

[deps]
AWS = "fbe9abb3-538b-5e4e-ba9e-bc94f4f92ebc"
Expand Down
5 changes: 4 additions & 1 deletion src/Storage/dictstore.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ end
DictStore() = DictStore(Dict{String,Vector{UInt8}}())

Base.show(io::IO,d::DictStore) = print(io,"Dictionary Storage")
_pdict(d::DictStore,p) = filter(((k,v),)->startswith(k,p),d.a)
function _pdict(d::DictStore,p)
p = (isempty(p) || endswith(p,'/')) ? p : p*'/'
filter(((k,v),)->startswith(k,p),d.a)
end
function storagesize(d::DictStore,p)
sum(i->last(split(i[1],'/')) (".zattrs",".zarray") ? sizeof(i[2]) : zero(sizeof(i[2])), _pdict(d,p))
end
Expand Down
7 changes: 6 additions & 1 deletion test/storage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ function test_store_common(ds)
@test !Zarr.isinitialized(ds,"bar",CartesianIndex((0,0,0)))
@test !Zarr.isinitialized(ds,"bar/0.0.0")
ds["bar/0.0.0"] = data
#Add tests for empty storage
@test Zarr.isemptysub(ds,"ba")
@test Zarr.isemptysub(ds,"ba/")
@test !Zarr.isemptysub(ds,"bar")
@test !Zarr.isemptysub(ds,"bar/")
end

@testset "DirectoryStore" begin
Expand Down Expand Up @@ -101,7 +106,7 @@ end
chunks = (5,10)
metadata = Zarr.Metadata(A, chunks; fill_value=-1.5)
using Minio
if !isempty(Minio.getexe())
if !isnothing(Minio.minio())
s = Minio.Server(joinpath("./",tempname()), address="localhost:9001")
run(s, wait=false)
cfg = MinioConfig("http://localhost:9001")
Expand Down

2 comments on commit edb74b8

@meggart
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/67267

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.7.3 -m "<description of version>" edb74b89e64f6191a9341f3f52e8f40be64ef44e
git push origin v0.7.3

Please sign in to comment.