diff --git a/Project.toml b/Project.toml index b557bf2..a86dd79 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Zarr" uuid = "0a941bbe-ad1d-11e8-39d9-ab76183a1d99" authors = ["Fabian Gans "] -version = "0.7.2" +version = "0.7.3" [deps] AWS = "fbe9abb3-538b-5e4e-ba9e-bc94f4f92ebc" diff --git a/src/Storage/dictstore.jl b/src/Storage/dictstore.jl index 3314d02..7815ed2 100644 --- a/src/Storage/dictstore.jl +++ b/src/Storage/dictstore.jl @@ -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 diff --git a/test/storage.jl b/test/storage.jl index 9176eb1..b05b744 100644 --- a/test/storage.jl +++ b/test/storage.jl @@ -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 @@ -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")