Skip to content

Commit 329e6e1

Browse files
committed
Merge branch 'refs/heads/main' into further-tests
# Conflicts: # src/main/java/dev/zarr/zarrjava/v3/Group.java
2 parents f7086e6 + f762534 commit 329e6e1

30 files changed

Lines changed: 2241 additions & 226 deletions

.github/workflows/ci.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ jobs:
1414
os: [ ubuntu-latest, windows-latest, macos-latest ]
1515
fail-fast: false
1616
runs-on: ${{ matrix.os }}
17+
services:
18+
s3mock:
19+
# This service will only start if the runner is Linux
20+
image: ${{ matrix.os == 'ubuntu-latest' && 'adobe/s3mock:3.11.0' || '' }}
21+
ports:
22+
- 9090:9090
23+
env:
24+
initialBuckets: zarr-test-bucket
1725
defaults:
1826
run:
1927
shell: bash
@@ -49,8 +57,12 @@ jobs:
4957
- name: Test
5058
env:
5159
MAVEN_OPTS: "-Xmx6g"
52-
run: mvn --no-transfer-progress test -DargLine="-Xmx6g"
53-
60+
run: |
61+
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
62+
mvn --no-transfer-progress test -DargLine="-Xmx6g" -DrunS3Tests=true
63+
else
64+
mvn --no-transfer-progress test -DargLine="-Xmx6g"
65+
fi
5466
- name: Assemble JAR
5567
run: mvn package -DskipTests
5668

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@ build/
4545
/main.py
4646
/pyproject.toml
4747
/uv.lock
48-
**/__pycache__
48+
**/__pycache__
49+
/dependency-reduced-pom.xml

pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@
121121
<version>4.13.1</version>
122122
<scope>test</scope>
123123
</dependency>
124+
<dependency>
125+
<groupId>org.apache.commons</groupId>
126+
<artifactId>commons-compress</artifactId>
127+
<version>1.28.0</version>
128+
</dependency>
124129
</dependencies>
125130

126131
<repositories>
@@ -139,6 +144,10 @@
139144
<version>3.2.5</version>
140145
<configuration>
141146
<useSystemClassLoader>false</useSystemClassLoader>
147+
<environmentVariables>
148+
<!-- Force Testcontainers to use a newer Docker API version supported by your local Daemon -->
149+
<DOCKER_API_VERSION>1.44</DOCKER_API_VERSION>
150+
</environmentVariables>
142151
</configuration>
143152
</plugin>
144153
<plugin>

src/main/java/dev/zarr/zarrjava/core/Array.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import dev.zarr.zarrjava.ZarrException;
44
import dev.zarr.zarrjava.core.codec.CodecPipeline;
55
import dev.zarr.zarrjava.store.FilesystemStore;
6+
import dev.zarr.zarrjava.store.Store;
67
import dev.zarr.zarrjava.store.StoreHandle;
78
import dev.zarr.zarrjava.utils.IndexingUtils;
89
import dev.zarr.zarrjava.utils.MultiArrayUtils;
@@ -16,6 +17,9 @@
1617
import java.nio.file.Path;
1718
import java.nio.file.Paths;
1819
import java.util.Arrays;
20+
import java.util.List;
21+
import java.util.Set;
22+
import java.util.stream.Collectors;
1923
import java.util.stream.Stream;
2024

2125
public abstract class Array extends AbstractNode {
@@ -404,9 +408,9 @@ public ucar.ma2.Array read(final long[] offset, final int[] shape, final boolean
404408

405409
final String[] chunkKeys = metadata.chunkKeyEncoding().encodeChunkKey(chunkCoords);
406410
final StoreHandle chunkHandle = storeHandle.resolve(chunkKeys);
407-
if (!chunkHandle.exists()) {
408-
return;
409-
}
411+
412+
if (!chunkHandle.exists()) return;
413+
410414
if (codecPipeline.supportsPartialDecode()) {
411415
final ucar.ma2.Array chunkArray = codecPipeline.decodePartial(chunkHandle,
412416
Utils.toLongArray(chunkProjection.chunkOffset), chunkProjection.shape);

src/main/java/dev/zarr/zarrjava/core/Group.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import java.io.IOException;
1010
import java.nio.file.Path;
1111
import java.nio.file.Paths;
12-
import java.util.Objects;
1312
import java.util.stream.Stream;
1413

1514
public abstract class Group extends AbstractNode {
@@ -64,20 +63,15 @@ public static Group open(String path) throws IOException, ZarrException {
6463
}
6564

6665
@Nullable
67-
public abstract Node get(String key) throws ZarrException, IOException;
66+
public abstract Node get(String[] key) throws ZarrException, IOException;
6867

69-
public Stream<Node> list() {
70-
return storeHandle.list()
71-
.map(key -> {
72-
try {
73-
return get(key);
74-
} catch (Exception e) {
75-
throw new RuntimeException(e);
76-
}
77-
})
78-
.filter(Objects::nonNull);
68+
@Nullable
69+
public Node get(String key) throws ZarrException, IOException {
70+
return get(new String[]{key});
7971
}
8072

73+
public abstract Stream<Node> list();
74+
8175
public Node[] listAsArray() {
8276
try (Stream<Node> nodeStream = list()) {
8377
return nodeStream.toArray(Node[]::new);

0 commit comments

Comments
 (0)