Repository navigation
OpenXISF 0.3.0
OpenXISF 0.3.0 reads and writes distributed units, alongside the monolithic units of 0.1.0 and 0.2.0. Before 1.0, minor versions may change the API.
What it reads
- A distributed unit is a header file (
.xish) whose data blocks are external: in data blocks files (.xisb), each with a block index, or in other files that hold one block each, located bypath()orurl(), with or without an index-id.openxisf::readerrecognizes a header file by its content, as before, and now reads its external blocks too. read_options::resolveropens each external file once, when the unit is opened, and the reader keeps it open for later reads, from any number of threads. A unit opened from a path getsfile_resolver()for the directory of its header file by default; a unit opened from a source gets no resolver unless the application gives one.file_resolver()openspath(@header_dir/...)locations only inside the directory of the header file, once symbolic links and Windows junctions are followed, and only regular files. Absolute paths are opened only whenfile_resolver_options::absolute_pathsallows them; on Windows,/c/dir/filenamesC:\dir\file, and network paths are refused. URLs are opened only by a resolver of the application, which can serve them from anywhere, memory included.- The block index of each data blocks file is checked as it is read: its signature, nodes inside the file, no cycles, at most
limits::max_index_nodesnodes, and no more bytes in the nodes than in the file. An index-id that is missing, free or duplicated, a block outside its file, or an uncompressed length that disagrees with the header makes that block unavailable, with a diagnostic, and the rest of the unit stays readable.limits::max_external_files(256 by default) bounds the files that a unit opens. - Seven new error codes describe these problems. With
read_options::strict, an external file that cannot be opened or read now fails the open with anio_error.
What it writes
writer::save_distributed()writes a header file and one data blocks file, to a path ending with.xish, with the.xisbnext to it, or to two output sinks. The header locates every block by the name of the data blocks file, relative to its own directory, so the two files can be moved together. Blocks get random 64-bit identifiers and are aligned as in monolithic files; small blocks stay inline in the header.- Both files are complete before either replaces an existing one, and the data blocks file is replaced first. A header file left with another data blocks file, after a failure between the two, finds none of its blocks there, rather than wrong ones.
- Every option of the writer applies to distributed units: compression, byte shuffling, subblocks, checksums and UUIDs.
- The new sample program
distributedwrites a unit next to its data blocks file and reads it back, then writes it into memory and reads it with a resolver of its own.
Compatibility
- PixInsight 1.9.4 and 1.9.5 read and write monolithic units only, so they cannot open the distributed units of this release. Every header that the tests write, header files included, validates against the official XISF 1.0 schema.
- What 0.2.0 says about PixInsight still holds with PixInsight 1.9.5: it refuses units with SHA3-256 or SHA3-512 checksums, it does not open UInt64 or one-dimensional images, and the writer stores a subblock that its codec does not make smaller as it is, which is how PixInsight writes and reads such subblocks. The documentation of
write_options::subblock_sizenow says so. read_optionsholds astd::functionnow, so it is no longer trivially copyable; existing code that builds it with designated initializers compiles unchanged.
Not yet
The colour and display algorithms of the specification, property format rendering, astrometric solutions, and signed units. The writer writes one data blocks file per unit, with a single index node, and no url() or absolute locations.
Building and testing
The library builds with CMake 3.25 or newer and installs a CMake package (find_package(openxisf CONFIG REQUIRED)) and a pkg-config file. Its dependencies are pugixml, zlib, LZ4 and Zstandard. See the README for the presets and options.
The tests of this release pass in CI on Linux (GCC 14 and Clang 18 with libstdc++ and libc++, x64 and arm64, with AddressSanitizer, UndefinedBehaviorSanitizer and ThreadSanitizer, clang-tidy and fuzzing), on Windows (MSVC x64 and arm64, clang-cl, MSYS2 UCRT64 and CLANG64) and on macOS (AppleClang, arm64 and x64), and the vcpkg port builds on all three.
The API documentation is attached as openxisf-0.3.0-docs.tar.gz.