Skip to content

Commit edb74b8

Browse files
authored
Fix dict tree splitting bug (#93)
* Fix dict tree splitting bug * add some tests and fix
1 parent 6703dbf commit edb74b8

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Zarr"
22
uuid = "0a941bbe-ad1d-11e8-39d9-ab76183a1d99"
33
authors = ["Fabian Gans <[email protected]>"]
4-
version = "0.7.2"
4+
version = "0.7.3"
55

66
[deps]
77
AWS = "fbe9abb3-538b-5e4e-ba9e-bc94f4f92ebc"

src/Storage/dictstore.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ end
55
DictStore() = DictStore(Dict{String,Vector{UInt8}}())
66

77
Base.show(io::IO,d::DictStore) = print(io,"Dictionary Storage")
8-
_pdict(d::DictStore,p) = filter(((k,v),)->startswith(k,p),d.a)
8+
function _pdict(d::DictStore,p)
9+
p = (isempty(p) || endswith(p,'/')) ? p : p*'/'
10+
filter(((k,v),)->startswith(k,p),d.a)
11+
end
912
function storagesize(d::DictStore,p)
1013
sum(i->last(split(i[1],'/')) (".zattrs",".zarray") ? sizeof(i[2]) : zero(sizeof(i[2])), _pdict(d,p))
1114
end

test/storage.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ function test_store_common(ds)
4242
@test !Zarr.isinitialized(ds,"bar",CartesianIndex((0,0,0)))
4343
@test !Zarr.isinitialized(ds,"bar/0.0.0")
4444
ds["bar/0.0.0"] = data
45+
#Add tests for empty storage
46+
@test Zarr.isemptysub(ds,"ba")
47+
@test Zarr.isemptysub(ds,"ba/")
48+
@test !Zarr.isemptysub(ds,"bar")
49+
@test !Zarr.isemptysub(ds,"bar/")
4550
end
4651

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

0 commit comments

Comments
 (0)