Interface ArrayBackend

  • All Superinterfaces:
    AutoCloseable
    All Known Implementing Classes:
    ZarrJavaBackend

    public interface ArrayBackend
    extends AutoCloseable
    Storage-engine abstraction: creates, grows, writes and reads N-dimensional arrays and writes group metadata, without any knowledge of OME-NGFF semantics. This is the seam that lets OMEZarrStorage target a different engine (e.g. a future native/tensorstore backend) than the default ZarrJavaBackend.

    Arrays are identified by an opaque string id chosen by the caller. Each id maps to a relative on-disk path (an OME-Zarr array such as posName/0).

    Implementations must be safe for a single writer thread with concurrent readers: read methods may be called from other threads while writes proceed.

    • Method Detail

      • createArray

        void createArray​(String arrayId,
                         String relPath,
                         long[] shape,
                         int[] chunkShape,
                         int[] shardShape,
                         String dtype,
                         String compressionId)
                  throws Exception
        Create a new array for writing.
        Parameters:
        arrayId - opaque id used in subsequent calls
        relPath - path relative to the dataset root (forward-slash separated)
        shape - initial shape
        chunkShape - chunk shape (same rank as shape)
        shardShape - shard shape, or null for no sharding
        dtype - Zarr dtype string, e.g. "uint16"
        compressionId - codec id ("zstd", "blosc-zstd", "blosc-lz4", or "none")
        Throws:
        Exception
      • openArray

        void openArray​(String arrayId,
                       String relPath)
                throws Exception
        Open an existing array for reading (read-only load path).
        Throws:
        Exception
      • hasArray

        boolean hasArray​(String arrayId)
      • getShape

        long[] getShape​(String arrayId)
      • ensureShape

        void ensureShape​(String arrayId,
                         long[] minShape)
                  throws Exception
        Grow the array so every dimension is at least minShape; no-op if already big enough.
        Throws:
        Exception
      • writeBlock

        void writeBlock​(String arrayId,
                        long[] offset,
                        int[] blockShape,
                        Object pixels)
                 throws Exception
        Write a contiguous block of pixels.
        Parameters:
        offset - block start offset (full rank)
        blockShape - block extent (full rank); product must equal the pixel count
        pixels - primitive array (byte[], short[] or float[])
        Throws:
        Exception
      • readBlock

        Object readBlock​(String arrayId,
                         long[] offset,
                         int[] blockShape)
                  throws Exception
        Read a contiguous block of pixels as a primitive array.
        Returns:
        a fresh primitive array of product(blockShape) elements, row-major
        Throws:
        Exception
      • flush

        void flush()
            throws Exception
        Flush any buffered state to durable storage.
        Throws:
        Exception