Skip to content

V0.2.3/spatial streaming - #47

Merged
thanos merged 6 commits into
mainfrom
v0.2.3/spatial-streaming
Jul 18, 2026
Merged

thanos merged 6 commits into
mainfrom
v0.2.3/spatial-streaming

Conversation

@thanos

@thanos thanos commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Incremental EXCP / GSPL / PLY stream_decode from files (bounded memory), plus schema-driven stream_encode_to_file
  • Spatial Rust acceleration (DirtyCpu pack/unpack, mmap file streams, binary PLY unpack)
  • Pre-release review blockers: NIF availability registration, stale docs removed from Hex package, streaming/docs/livebook fixes, Accel skip tags, CHANGELOG 0.2.1/0.2.2 notes

thanos and others added 6 commits July 17, 2026 17:26
…ntal I/O.

**Behavior**

`source: :file` (or `:auto` path detection): read 16-byte EXCP / 18-byte GSPL header, then one fixed-size record via `IO.binread/2`
Peak memory ≈ header + one record (file handle stays open for the stream lifetime)
In-memory binaries still materialize through `decode/2` (mmap left for a future Rust backend)

**Wiring**

`ExCodecs.Spatial.Stream` forwards `EXCP/GSPL` sources to the codecs — no more full File.read for those formats
Docs updated in `spatial.ex`, `docs/spatial_formats.md`, the spatial guide, and `CHANGELOG` Unreleased

**Usage**
```elixir
ExCodecs.Spatial.stream_decode(path, format: :spatial_binary, source: :file)
|> Stream.take(100)
|> Enum.to_list()
ExCodecs.Spatial.stream_decode(path, format: :gsplat, source: :file)
|> Enum.each(&process/1)
```
Truncation / missing files yield a single `{:error, %ExCodecs.Error{}}` element.

closed #38 - PLY stream_decode (source: :file) — scans until end_header, then yields one vertex at a time (binary: fixed stride via IO.binread; ASCII: line reads). Supports :as / Gaussian auto-detect.

closed #39 - stream_encode_to_file/3 — EXCP and GSPL write a placeholder header, stream records, seek back to patch count. Requires explicit :schema. Spatial.Stream.encode_to_file/3 uses this when schema: + format: :spatial_binary / :gsplat.

closed #40
…plus enumerable_points/1 / enumerable_gaussians/1. Credo is clean and the stream tests pass.
Version

mix.exs → 0.2.3
native/ex_codecs_native/Cargo.toml → 0.2.3
Changelog

Moved Unreleased items into [0.2.3] - 2026-07-18 (streaming I/O, schema encode-to-file, Rust accel, Mix cli/0)
Docs

README install pin, streaming limitations, native layer note
docs/spatial_formats.md, docs/architecture.md, guides/understanding_spatial_codecs.md
All livebooks → {:ex_codecs, "~> 0.2.3"}; spatial livebook streaming section updated
Fix NIF availability registration order, drop stale docs from the Hex package,
correct streaming/work_factor/from_nif docs, repair livebook demos, and make
Accel tests skip cleanly when the spatial NIF is absent.

Co-authored-by: Cursor <[email protected]>
…xed in this final pass:

Code fixes
- A-5: Fixed doc example to use MyApp.CodecRegistry instead of the global ExCodecs.CodecRegistry (avoids name collision)
- CR-1: Added Code.ensure_loaded?/1 guard in build_codec_info/5 before probing __codec_info__/0
- CR-4: Documented the Agent's purpose (owns ETS table, state never read)
- C-3: Documented that validates?/1 checks interface conformance, not data validation
- C-4: Annotated Zstd typedoc examples with NIF precondition
- Z-1: Documented the Elixir/Rust level-clamp divergence in Zstd encode docs
- Z-2: zstd_version/0 now reads Native.codec_versions() with a static fallback
- ER-1: Unknown NIF error atoms now map to :invalid_data with the raw atom in details:
- ER-2: Widened matches?/2 spec to term() first argument
- NF-2: Removed hardcoded 268435456 from the :output_limit_exceeded message
- NF-3: Corrected safe_call/2 spec to {:ok, binary()}
- N-2: Commented the nif_loaded?/0 rescue clauses with concrete scenarios
- N-3: Documented the base_url ↔ @source_url coupling in native.ex
- SP-5: resolve_as/2 now returns {:error, :invalid_options} instead of raising CaseClauseError
- SP-6: Replaced all em-dashes and non-breaking hyphens with plain hyphens in spatial docs
- SP-9: Marked Transform as "Reserved for future use" in its moduledoc
- SP-10: Documented the atom-key restriction for literal %Point{} construction
- SP-11: Added numeric guards to Bounds.new/2
- SP-12: Added sh shape validation in Gaussian.new/2
- SP-15: Restricted safe/1 rescue to expected exception classes with warning logging
- SP-16: Removed true as an accepted endianness atom
- SP-19: EXCP decode now rejects unknown flag bits with :invalid_data
- SP-20: Collapsed 3-pass Enum.any? + length/1 into a single Enum.reduce
- SP-23: Restricted PLY encode rescue to ArithmeticError/FunctionClauseError/ArgumentError
- SP-24: Dropped redundant metadata: attrs in PLY Gaussian decode
- SP-25: Added validate_comments/1 rejecting newlis and end_header in PLY comments
- SP-27: Documented numeric-only attribute restriction in Point typedoc
- R-5/R-6: Documented partial-record caller obligation and color/SH coercion in Accel moduledoc
- R-8: Documented the N×256 MiB amplification risk in Compression.decompress/3
Documentation/test fixes
- D-1: Verified repo slug thanos/codecs is consistent with git remote
- D-2: Removed duplicate checksum reminder from 0.2.0 CHANGELOG
- D-5: Added Keep a Changelog link references at bottom of CHANGELOG
- D-10: Fixed codec chaining recommendation (spatial→zstd, not zstd→blosc2)
- T-13/T-17/T-18: Verified already fixed (exact pins, split tests, tmp cleanup)
@thanos
thanos merged commit a708f9a into main Jul 18, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant