io
io
#
Analysis-side disk verbs over the type system.
The type system owns the on-disk story: a schema knows how to load/store
every value it describes. These are the thin verbs over that — load reads a
captured value, commit writes one, copy moves file paths with
broadcasting.
load reads the metadata tree (JSON leaves and file paths, never the media
bytes — a loaded Image is its path, opened only when you ask). commit is
incremental and additive: each leaf is written only when its bytes actually
change, and existing entries are never deleted — so re-committing a modified
value rewrites just the parts that changed, and committing at a sub-path updates
one slot. Because commit takes the target schema (not the value's history),
it is also how old data is ported onto a new schema: read it however, then
commit the values under the new type.
commit(path, value, schema=None)
#
Write value rooted at path, touching only the leaves that changed.
The write is incremental (an unchanged leaf is left alone) and additive (no existing entry is removed), so it is safe to re-commit a modified value — only the changed parts hit disk — or to commit at a sub-path to update one slot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path | str
|
Destination root (the schema appends its own suffixes/folders). |
required |
value
|
object
|
The value to write — a types value matching |
required |
schema
|
type[CGType] | dict[str, JSONValue] | None
|
The type describing |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The destination |
Source code in capturegraph-lib/capturegraph/types/io.py
copy(*, src, dst)
#
Copy files from source paths to destination paths.
Destination parent directories are created as needed. A missing or None source produces a Missing placeholder in the result instead of raising.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
Array
|
Array of source file paths. |
required |
dst
|
Array
|
Array of destination paths (same length as src). |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Array of destination paths that were created. |
Source code in capturegraph-lib/capturegraph/types/io.py
load(path, schema)
#
Load a captured value from path according to schema.
File leaves resolve to their path (the media is opened only on demand), so a
load is metadata-weight; to read one slot of a large target without the rest,
point path and schema at the sub-tree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path | str
|
The capture root on disk. |
required |
schema
|
type[CGType] | dict[str, JSONValue]
|
The type describing the data — a |
required |
Returns:
| Type | Description |
|---|---|
object
|
The loaded value — a |
object
|
attribute access for vectorized analysis. |