Skip to content

Commit 2fcebe6

Browse files
committed
Add docs for new structured Blosc2 serialization
1 parent da5308a commit 2fcebe6

4 files changed

Lines changed: 41 additions & 2 deletions

File tree

doc/reference/batch_store.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,32 @@ BatchStore currently supports two serializers:
3131
- ``"arrow"``: optional and requires ``pyarrow``; mainly useful when data is
3232
already Arrow-shaped before ingestion
3333

34+
For ``"msgpack"``, python-blosc2 supports both ordinary msgpack-safe Python
35+
values and selected Blosc2 objects.
36+
37+
Blosc2 objects serialized by value via :meth:`to_cframe` /
38+
:func:`blosc2.from_cframe`:
39+
40+
- ``NDArray``
41+
- ``SChunk``
42+
- ``VLArray``
43+
- ``BatchStore``
44+
- ``EmbedStore``
45+
46+
Structured reference-style Blosc2 objects currently supported:
47+
48+
- ``C2Array``
49+
- ``LazyExpr``
50+
51+
``LazyExpr`` values preserve reference semantics and are serialized as a recipe
52+
plus durable operand references. Supported operands are:
53+
54+
- persistent local Blosc2 operands reopenable from ``urlpath``
55+
- remote ``C2Array`` operands
56+
- ``DictStore`` members reopenable from ``(.b2d|.b2z, key)``
57+
58+
Purely in-memory operands are intentionally not supported.
59+
3460
Quick example
3561
-------------
3662

doc/reference/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ API Reference
66

77
classes
88
save_load
9+
msgpack_serialization
910
storage
1011
array_operations
1112
utilities

src/blosc2/batch_store.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,13 @@ class BatchStore:
171171
containers such as :class:`blosc2.NDArray`, :class:`blosc2.SChunk`,
172172
:class:`blosc2.VLArray`, :class:`blosc2.BatchStore`, and
173173
:class:`blosc2.EmbedStore`, which are serialized transparently via
174-
:meth:`to_cframe` / :func:`blosc2.from_cframe`. ``"arrow"`` is optional
175-
and requires ``pyarrow``.
174+
:meth:`to_cframe` / :func:`blosc2.from_cframe`. Msgpack also supports
175+
structured Blosc2 reference objects, currently
176+
:class:`blosc2.C2Array` and :class:`blosc2.LazyExpr`. Lazy expressions
177+
preserve reference semantics, so only persistent local operands,
178+
:class:`blosc2.C2Array` operands, and :class:`blosc2.DictStore`
179+
members are supported; purely in-memory operands are rejected.
180+
``"arrow"`` is optional and requires ``pyarrow``.
176181
_from_schunk : blosc2.SChunk, optional
177182
Internal hook used when reopening an already-tagged BatchStore.
178183
**kwargs

src/blosc2/vlarray.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ class VLArray:
3636
:class:`blosc2.NDArray`, :class:`blosc2.SChunk`, :class:`blosc2.VLArray`,
3737
:class:`blosc2.BatchStore`, and :class:`blosc2.EmbedStore` are serialized
3838
transparently via :meth:`to_cframe` / :func:`blosc2.from_cframe`.
39+
40+
Msgpack also supports structured Blosc2 reference objects. Currently this
41+
includes :class:`blosc2.C2Array` and :class:`blosc2.LazyExpr`. Lazy
42+
expressions are serialized as recipes plus durable operand references, so
43+
only persistent local operands, :class:`blosc2.C2Array` operands, and
44+
:class:`blosc2.DictStore` members are supported. Purely in-memory operands
45+
are intentionally rejected.
3946
"""
4047

4148
@staticmethod

0 commit comments

Comments
 (0)