Persistence: Stores, Records and Clash States#

The Suite API saves clash results in a store that the caller opens explicitly. Every store holds the same four record types: queries, clashes, frames and point-cloud settings. Two built-in stores keep them, a SQLite database file and a folder of JSON files, and both work through one data API: the Python ClashData facade over a serializer, the class that reads and writes one kind of store, and the C ovclash_suite_data_t handle.

This page covers what all stores share:

SQLite serializer and Directory serializer document each store’s format. Legacy Containers covers the .clashDetection file of Kit’s clash detection extension, a legacy container, and Export turns records into JSON or HTML reports.

Choosing a store#

SQLite serializer

Directory serializer

Python class

ClashDataSerializerSqlite; ClashData() creates one

ClashDataSerializerDirectory

C constructor

ovclash_suite_data_create()

ovclash_suite_data_create_directory()

Store

One SQLite database file, by convention with the .ovclashdb extension

One folder of readable JSON files, one file per record

Legacy .clashDetection containers

Opens them, and exports them through save_as()

Not supported; the suffix is part of the folder name

Handles on one store

Several, serialized by SQLite file locking

One at a time, through an operating-system lock

NaN in scalar values

Rejected

Stored

Sign of a scalar zero

Lost

Kept

Format versions

Per-table schema versions with forward migration

One format version, no migration

Interrupted commits

SQLite’s own journal

Restored after a process stops; not guaranteed after an operating-system crash or power loss

Runtime requirement

The system SQLite library

None

Choose the SQLite serializer for large stores, compact storage and write throughput. It is the default. Choose the directory serializer when people or tools must read, diff or version the records as text. It costs more than SQLite in parsing, memory and file count, and it keeps every clash header in memory while the store is open.

Neither store converts the other’s format. To move records from one store to the other, read them through one handle and insert them through another. A NaN that the directory store holds cannot be written to a SQLite store. A custom store keeps records in storage that you implement, under the same transaction contract.

Walkthrough#

Before you begin, Step 1 to Step 3 need:

  • dynamic.ovclashdb in the current directory. Run the script from Step 3 of Suite Workflows to create it. It holds one query with 8 clashes.

  • The ovclash_suite Python package for the Python steps. Run each script from the directory that holds dynamic.ovclashdb.

  • For the C step, <ovclash_suite/ovclash_suite.h> and the ovclash library from the SDK archive.

The steps use the default SQLite serializer. Apart from creating and destroying the serializer (Directory serializer shows how), the Python code is the same for a directory store.

Step 1: Read the store#

This script lists the queries, the clashes of each query and the first frames of one clash:

from ovclash_suite import ClashData

data = ClashData()
try:
    data.open("dynamic.ovclashdb")
    if not data.is_open():
        raise RuntimeError(data.last_error() or "could not open dynamic.ovclashdb")

    for query_id, query in data.fetch_all_queries().items():
        print(f"Query {query_id}: {query.query_name}")
        overlaps = data.find_all_overlaps_by_query_id(query_id, False)  # without frames
        for info in overlaps.values():
            mesh = info.object_a_path.rsplit("/", 1)[-1]
            kind = "hard" if info.is_hard_clash else "soft"
            print(
                f"  {mesh}: {kind}, {info.state.name}, {info.num_records} frames,"
                f" min distance {info.min_distance:.3f}"
            )

        first = next(iter(overlaps.values()))
        frames = data.fetch_clash_frame_info_by_clash_info_id(first.identifier, num_frames_to_load=3)
        print(f"First frames of {first.object_a_path.rsplit('/', 1)[-1]}:")
        for frame in frames:
            print(f"  t={frame.timecode:.3f} s, {frame.overlap_tris} triangles")
finally:
    data.destroy()

Expected output:

Query 1: Example Dynamic Query
  NV_Mesh1: soft, NEW, 5 frames, min distance 2.952
  NV_Mesh11: hard, NEW, 61 frames, min distance 0.000
  NV_Mesh3: hard, NEW, 6 frames, min distance 0.000
  NV_Mesh12: hard, NEW, 9 frames, min distance 0.000
  NV_Mesh2: hard, NEW, 6 frames, min distance 0.000
  NV_Mesh4: hard, NEW, 8 frames, min distance 0.000
  NV_Mesh5: hard, NEW, 8 frames, min distance 0.000
  NV_Mesh0: soft, NEW, 5 frames, min distance 2.372
First frames of NV_Mesh1:
  t=4.208 s, 108 triangles
  t=4.250 s, 118 triangles
  t=4.292 s, 64 triangles
  • find_all_overlaps_by_query_id() returns a dict keyed by overlap_id, the clash hash as text. The clashes come in overlap_id order.

  • is_hard_clash is true for a hard clash: a mesh clash with min_distance 0 that is not a contact. is_contact is true when such a pair’s max_local_depth stays within depth_epsilon, or is exactly 0 when depth_epsilon is not positive.

  • is_soft_clash is true for a soft clash, a mesh clash with a positive min_distance. The meshes do not touch, but they are closer than the query’s tolerance of 5 units.

  • Every clash starts as NEW. Fetch-and-save maintains the state; see Clash states.

Step 2: Review clashes in one transaction#

This script approves the soft clashes and writes all changes in one transaction:

from ovclash_suite import ClashData, ClashState

data = ClashData()
try:
    data.open("dynamic.ovclashdb")
    query_id = next(iter(data.fetch_all_queries()))
    for info in data.find_all_overlaps_by_query_id(query_id, False).values():
        if info.is_soft_clash:  # closer than the tolerance, but not touching
            info.state = ClashState.APPROVED  # also refreshes last_modified_*
            info.comment = "Clearance accepted in review."
            data.update_overlap(info, update_also_frame_info=False, commit=False)
    data.commit()  # one transaction for the whole batch

    counts = data.get_overlaps_count_by_query_id_grouped_by_state(query_id)
    for state, count in counts.items():
        print(f"{state.name}: {count}")
finally:
    data.destroy()

Expected output:

NEW: 6
APPROVED: 2
  • commit=False batches the writes. The single commit() writes them together. See CRUD for the batching and rollback rules.

  • update_also_frame_info=False keeps the stored frames. The default True replaces the stored frames with the frames attached to info. A ClashInfo read with fetch_also_frame_info=False has none attached, so the default would delete its frames.

  • Assigning a review field refreshes the modification metadata. See The object model for the fields you can assign.

Step 3: Read the store from C#

This program opens the same store, reads the first query and walks its clashes with a cursor. Save it as a C source file, and build and link it against the SDK archive as C/C++ Quickstart shows. When the build cannot find the headers or the program does not start, see Configuring with CMake and Starting a C or C++ program. Run it from the directory that holds dynamic.ovclashdb:

#include <ovclash_suite/ovclash_suite.h>

#include <stdio.h>

static int ok(ovclash_suite_result_t result)
{
    return result.status == OVCLASH_SUITE_STATUS_SUCCESS;
}

int main(void)
{
    static const char path[] = "dynamic.ovclashdb";
    const ovclash_suite_string_t store = { path, sizeof(path) - 1u };
    ovclash_suite_data_t* data = NULL;
    ovclash_suite_overlap_cursor_t* cursor = NULL;
    ovclash_suite_query_view_t query;
    ovclash_suite_clash_info_record_view_t overlap;
    uint32_t has_value = 0u;
    int64_t query_id = -1;
    int status = 1;

    if (!ok(ovclash_suite_data_create(&data)) || !ok(ovclash_suite_data_open(data, store)) ||
        !ok(ovclash_suite_data_get_query_at(data, 0u, &query)))
        goto cleanup;
    query_id = query.identifier; /* the view is reused by the next query read */
    printf("Query %lld: %.*s\n", (long long)query_id, (int)query.query_name.length, query.query_name.ptr);

    /* offset 0, limit 0: every overlap of the query, without frame payloads */
    if (!ok(ovclash_suite_data_get_overlaps_by_query(data, query_id, 0, 0, &cursor))) goto cleanup;
    for (;;)
    {
        /* has_value is 0 both at the end and on error, so check the status first */
        if (!ok(ovclash_suite_overlap_cursor_next(cursor, &overlap, &has_value))) goto cleanup;
        if (!has_value) break; /* running out of rows is not an error */
        /* overlap borrows cursor memory until the next advance: copy what you keep */
        printf("  %.*s: state %u, %u frames\n", (int)overlap.overlap_id.length, overlap.overlap_id.ptr,
               overlap.state, overlap.frame_count);
    }
    status = 0;

cleanup:
    if (status != 0)
    {
        ovclash_suite_string_t error = ovclash_suite_get_thread_last_error();
        fprintf(stderr, "error: %.*s\n", (int)error.length, error.ptr ? error.ptr : "");
    }
    ovclash_suite_overlap_cursor_destroy(cursor); /* destroy cursors before their data handle */
    ovclash_suite_data_destroy(data);
    return status;
}

Expected output after Step 2 (state 1 is NEW, state 2 is APPROVED):

Query 1: Example Dynamic Query
  0x19cd3f588ebbe2ceb23cc376f9087468: state 2, 5 frames
  0x25f2f5911be3e91fef42b2afd3180bc1: state 1, 61 frames
  0x5d8c8297e92d15be6ca04d7842fd78cd: state 1, 6 frames
  0x69e4fae9370fa52b7ea3db54ad637eca: state 1, 9 frames
  0x7689304c8a4904a09ead603b938dd79f: state 1, 6 frames
  0xa872e774aa37600c3cf14ddc3ae7d4ae: state 1, 8 frames
  0xbf454dfc1d8736ec3b36be0e4141862: state 1, 8 frames
  0xfc4b56832f4edf849d49ff547777a49f: state 2, 5 frames

Frames explains why sequential reads should use a cursor. You can now open a store, read its queries, clashes and frames, and review clashes in one transaction, in either language.

The object model#

Four record types are persisted:

Record

Python class

C record view

Holds

Belongs to

Query

ClashQuery

ovclash_suite_query_view_t

Query name, both scope paths, settings JSON, ROI paths, comment and modification metadata

–

Clash

ClashInfo

ovclash_suite_clash_info_record_view_t

One mesh, duplicate or point-cloud clash: detection results and review fields

A query, through query_id

Frame

ClashFrameInfo

ovclash_suite_clash_frame_info_record_view_t

One sample of a clash: metrics, both object matrices, and face, outline and point buffers

A clash, through clash_info_id

Point-cloud settings

PointCloudSettings

ovclash_suite_point_cloud_settings_view_t

Source prim path, destination path, rendering flags and level-of-detail (LOD) limit

–

The tables in this section list the fields of the Python classes. Every field is an optional constructor keyword argument with the default shown. The C record views carry the same fields: strings as ovclash_suite_string_t, flags as uint32_t, timestamps as storage strings, and the query settings as settings_json text. The field comments in <ovclash_suite/ovclash_suite_types.h> define each C field.

ClashQuery is the root of a run.

Field

Type

Default

Description

identifier

int

-1

Signed 64-bit record identifier. -1 until an insert assigns one.

query_name

str

""

The user-facing query name.

object_a_path, object_b_path

str

""

The scope of search sets A and B as text: prim paths separated by spaces, tabs or newlines, the form that ClashDetection.set_scope() takes.

clash_detect_settings

dict

{}

SettingId member names, such as SettingId.SETTING_TOLERANCE.name, mapped to JSON values. Persisted query settings lists each key and its JSON type. Integer or enum keys are stored as decimal strings, and settings lookups ignore them.

creation_timestamp, last_modified_timestamp

datetime

The current time

When the query was created and last modified.

last_modified_by

str

The current user name

Who modified the query last.

comment

str

""

A free-form comment.

roi_include_path, roi_exclude_path

str

""

The ROI paths, region-of-interest include and exclude paths. They are stored, serialized and read back unchanged, but detection does not use them, so two queries that differ only in them produce identical results.

get_settings_as_str() and load_settings_from_str() convert clash_detect_settings to and from its stored JSON text.

ClashInfo is the row a report renders, a clash record.

Field

Type

Default

Description

identifier

int

-1

The store’s record identifier. -1 until an insert assigns one.

query_id

int

0

The identifier of the owning query.

overlap_id

str

""

The clash hash as text: 0x followed by lowercase hexadecimal digits.

overlap_type

OverlapType

NORMAL

NORMAL (alias MESH_MESH), DUPLICATE, POINT_CLOUD_MESH or UNDEFINED.

present

bool

True

False when the last fetch-and-save into the query did not detect the clash.

min_distance

float

0.0

Minimum distance in stage units; 0 when the meshes touch or interpenetrate.

max_local_depth

float

0.0

Maximum local depth in stage units.

depth_epsilon, tolerance

float

-1.0, 0.0

The depth epsilon and tolerance that the clash was detected with.

object_a_path, object_b_path

str

""

The prim paths of the two objects.

object_a_mesh_crc, object_b_mesh_crc

str

""

The mesh hashes of the two objects as text.

start_time, end_time

float

0.0

The first and last sample time of the clash, in seconds.

num_records

int

0

The number of frames.

overlap_elements

int

0

The number of overlapping elements, triangles or points.

state

ClashState

NEW

The clash state; see Clash states.

priority

int

0

A priority that your application assigns.

person_in_charge

str

""

The person who owns the review.

creation_timestamp, last_modified_timestamp

datetime

The current time

When the record was created and last modified.

last_modified_by

str

The current user name

Who modified the record last.

comment

str

""

A review comment.

clash_frame_info_items

list[ClashFrameInfo] or None

None

The attached frames; None when the record was read without frames.

penetration_depth_px, penetration_depth_nx, penetration_depth_py, penetration_depth_ny, penetration_depth_pz, penetration_depth_nz

float

-1.0

Penetration depths along the positive and negative X, Y and Z axes, in stage units.

The detection fields run from overlap_type to overlap_elements, plus the six penetration_depth_* axes. The review fields are state, priority, person_in_charge and comment, and the two timestamps and last_modified_by record changes. is_contact, is_hard_clash, is_soft_clash, is_duplicate and is_point_cloud_clash classify a record from its own fields, without a native call.

Two ClashInfo rules:

  • Most fields are read-only after construction. Assigning identifier, query_id, overlap_id, overlap_type, present, min_distance, depth_epsilon, tolerance, an object_a_* or object_b_* field, start_time, end_time, num_records, overlap_elements, creation_timestamp or last_modified_by raises AttributeError.

  • Editable fields refresh the modification metadata. Assigning state, priority, person_in_charge, comment, max_local_depth or a penetration_depth_* field goes through the native model. It sets last_modified_timestamp to the current time and last_modified_by to the current user.

The underscore-prefixed legacy aliases, such as _state, bypass both rules. Fetch-and-save maintains present and state; see Clash states.

ClashFrameInfo is one sample of a clash, a frame.

Field

Type

Default

Description

timecode

float

0.0

The sample time, in seconds despite the name.

min_distance

float

0.0

Minimum distance in this frame, in stage units.

max_local_depth

float

-1.0

Maximum local depth in this frame, in stage units.

overlap_elements

int

0

The number of overlapping elements in this frame.

usd_faces_0, usd_faces_1

ArrayView of uint32

Empty

The authored face indices of each object that collide.

collision_outline

ArrayView of float32

Empty

The intersection outline as segments, x y z x y z per segment, from touching or interpenetrating triangle pairs only.

object_0_matrix, object_1_matrix

Four rows of four float

Identity

The row-major local-to-world transforms of the two objects.

usd_points_0

ArrayView of uint32

Empty

The colliding point indices of a point-cloud clash.

usd_points_0_sizes

ArrayView of float32

Empty

The point sizes of a point-cloud clash.

penetration_depth_px, penetration_depth_nx, penetration_depth_py, penetration_depth_ny, penetration_depth_pz, penetration_depth_nz

float

-1.0

Penetration depths along the positive and negative X, Y and Z axes, in stage units.

  • overlap_tris returns overlap_elements when the frame has no usd_points_0, as in a mesh frame. overlap_points returns it when the frame has usd_points_0, as in a point-cloud frame. The other property returns 0.

  • A static clash and a duplicate have one frame. A dynamic clash has one frame per sample where the pair still overlapped.

PointCloudSettings belongs to no query. ovclash stores and reads it back but never acts on it.

Field

Type

Default

Description

identifier

int

-1

The store’s record identifier. -1 until an insert assigns one.

point_cloud_prim_path

str

""

The source point-cloud prim path.

destination_path

str

""

The destination path for generated data.

save_to_session_layer

bool

True

Whether generated data goes to the session layer.

skip_rendering

bool

True

Whether rendering of the point cloud is skipped.

max_lod_level

int

PointCloudSettings.MAX_LOD_LEVEL (1000000)

The maximum level of detail (LOD), stored as given; no value has a special meaning, and the default is effectively unlimited.

Each of the four classes has a class-level VERSION, equal to its SQLite table’s schema version. Each also has a serialize_to_dict() / deserialize_from_dict() pair for the legacy dictionary format. deserialize_from_dict() returns None for malformed data.

Opening and committing#

ClashDataSerializerSqlite and ClashDataSerializerDirectory each own a native ovclash_suite_data_t, created by ovclash_suite_data_create() and ovclash_suite_data_create_directory(). ClashData is a facade over any AbstractClashDataSerializer:

  • ClashData() creates and owns a closed SQLite serializer.

  • ClashData(serializer) uses a serializer you own. destroy() then only closes it, and you destroy the serializer yourself.

This script opens or creates results.ovclashdb in the current directory, adds one query and commits it:

from ovclash_suite import ClashData, ClashQuery

data = ClashData()
try:
    data.open("results.ovclashdb")
    if not data.is_open():
        raise RuntimeError(data.last_error() or "could not open results.ovclashdb")
    query = ClashQuery(query_name="Example query")
    data.insert_query(query, commit=False)  # pending until commit()
    data.commit()
    print(f"Saved query {query.identifier}")
finally:
    data.destroy()

It prints Saved query <identifier>, where <identifier> is the identifier that the store assigned.

Call

Behavior

open(path)

Closes any open store, then opens path. Does nothing for an empty path, or when the store was opened through an absolute path that path resolves to.

is_open()

Reports whether a store is open, including an unnamed one.

commit()

Commits pending writes.

save(path=None)

Without a path, commits pending writes. On a SQLite store opened or migrated from a .clashDetection container, it also exports to that container until a save() or save_as() succeeds; after that it only commits to the temporary copy, so pass the container path to save_as() to export again. See Legacy Containers. With a path, calls save_as(path).

save_as(path)

SQLite copies the store to path and makes the copy current. A .clashDetection target instead exports a snapshot and keeps the current store. A directory store copies itself to an absent or empty directory outside itself and makes the copy current. Saving to the store’s own path only commits.

close()

Attempts to commit pending writes, including partial fetch results, then closes. A failed commit requests rollback, raises, and keeps the store for inspection and retry.

destroy()

Closes like close(). Then destroys the serializer that ClashData() created, with its native handle. A serializer you passed in is only closed.

These rows describe ClashData over a built-in serializer. A custom store defines its own behavior. SQLite serializer and Directory serializer give each store’s details.

The C calls follow the same sequence. This function belongs in a C source file of your program; it opens the same store, prints its query count and commits:

#include <stdio.h>

#include <ovclash_suite/ovclash_suite.h>

/* Returns 0 on success. */
static int count_queries(void)
{
    ovclash_suite_data_t* data = NULL;
    const char path[] = "results.ovclashdb";
    const ovclash_suite_string_t store = { path, sizeof(path) - 1 };
    uint32_t count = 0u;
    int status = 1;
    if (ovclash_suite_data_create(&data).status == OVCLASH_SUITE_STATUS_SUCCESS &&
        ovclash_suite_data_open(data, store).status == OVCLASH_SUITE_STATUS_SUCCESS &&
        ovclash_suite_data_get_query_count(data, &count).status == OVCLASH_SUITE_STATUS_SUCCESS &&
        ovclash_suite_data_commit(data).status == OVCLASH_SUITE_STATUS_SUCCESS)
    {
        printf("%u queries\n", count);
        status = 0;
    }
    ovclash_suite_data_destroy(data); /* accepts NULL */
    return status;
}

ovclash_suite_data_get_file_path() and ovclash_suite_data_get_file_size() report the store’s path and size. ovclash_suite_data_get_last_error() returns the handle’s last failure text.

Handle and cursor lifetime:

  • Python read methods materialize their results and release their native cursors before returning.

  • A live fetch operation blocks writes, commit and store lifecycle changes (open, save, save-as, migrate, close and destroy) until it is destroyed. An async fetch also blocks reads from other threads.

  • A live overlap or frame cursor blocks lifecycle changes, even when it is exhausted.

  • In Python, exhaust or close the fetch generator and any fetch_iter_saved_frames() iterator before you close or reopen the store.

Suite fetch and cursor lifetime has the full table.

Deferred creation and unnamed stores#

  • Creating a missing store waits for the first write by default. Opening a missing path creates no file or folder; the first write creates it. Change this with ovclash_suite_data_set_deferred_file_creation_until_first_write_op() or the ClashData.deferred_file_creation_until_first_write_op property.

  • open("") on a built-in serializer opens an unnamed store: a private temporary database for SQLite, a private temporary folder for a directory store. Its path is empty, and ovclash_suite_data_get_file_size() fails for it. It supports reads, writes and fetch-and-save.

  • Closing or destroying an unnamed store deletes its records. To keep them, call save_as(path) before closing. The named copy becomes the current store.

  • ClashData.open("") does nothing. Open the unnamed store through the serializer, then pass that serializer to ClashData(serializer).

Each store has its own path rules: see SQLite store path and Directory store path.

Use the class constants instead of literal extensions:

  • ClashDataSerializerSqlite.SERIALIZED_FILE_EXT is .ovclashdb.

  • ClashData.CLASH_DATA_LAYER_FILE_EXT is .clashDetection.

  • ClashDataSerializerDirectory.SERIALIZED_FILE_EXT is empty.

CRUD#

CRUD stands for create, read, update and delete, the record operations of the data API. Every C insert, update and remove function has two forms: a plain one and a _with_commit one.

  • The plain form is not “no commit”: it calls the _with_commit form with commit = 1.

  • To batch a run’s writes into one transaction, pass commit = 0 to the _with_commit form and call ovclash_suite_data_commit() once at the end.

  • The bulk ovclash_suite_data_replace_frames_by_overlap_with_commit() has only the _with_commit form.

  • In Python, the commit keyword argument makes the same choice and defaults to True.

  • Pending writes are committed by commit(), save(), save_as(), close(), destroy() or a later write with commit=True.

Note

A write that fails after its storage write began rolls back the handle’s whole pending transaction, on both built-in stores. Every earlier write made with commit = 0 is discarded, including writes that returned success. Committed data is kept. Such failures include:

  • constraint, SQLite and filesystem errors, and a failed commit;

  • a NaN REAL value on a SQLite store;

  • a non-finite frame matrix;

  • a record string containing NUL on a directory store.

Argument, open-state, fetch-reservation and not-found failures are reported before the write begins and leave pending writes untouched. Validate inputs before a batch, or commit before a write that may fail.

Return values with the built-in serializers:

  • Python inserts return the stored identifier. insert_clash_frame_info_from_clash_info() instead returns the number of frames it wrote.

  • Update methods and single-record remove methods return 1, or 0 when the identifier is not stored.

  • remove_all_overlaps_by_query_id() and remove_clash_frame_info_by_clash_info_id() return the number of records removed.

  • find_query() and the find_point_cloud_settings*() methods return None when no record matches. A C find function then fails with an empty last-error text, which separates absence from an error.

In C, fill a record view from the object model table and call the insert and update functions:

  • The insert and update functions copy input strings and buffers.

  • Views returned by a read are borrowed. A getter that is not a cursor reuses a per-kind scratch record on the data handle. Copy its view before the next read of the same kind, any write, close or destroy.

  • A cursor view belongs to its cursor.

In the tables of Queries, Overlaps, Frames and Point-cloud settings, the C column names the plain form.

Queries#

Python

C

insert_query(clash_query, update_identifier=True, commit=True)

ovclash_suite_data_insert_query

update_query(clash_query, commit=True)

ovclash_suite_data_update_query

find_query(clash_query_id)

ovclash_suite_data_find_query

fetch_all_queries()

ovclash_suite_data_get_query_count + ovclash_suite_data_get_query_at

remove_query_by_id(query_id, commit=True)

ovclash_suite_data_remove_query

  • With update_identifier=True (nonzero in C), an insert generates a new identifier. Python also writes it back to the object.

  • With False, the store keeps the record’s own identifier. A negative identifier still gets a generated one, which Python does not write back.

  • Clash and point-cloud-settings inserts work the same way.

  • Removing a query also removes its clashes and their frames.

  • fetch_all_queries() returns dict[int, ClashQuery] keyed by identifier. It raises RuntimeError when the count or any counted row cannot be read; it never returns a partial inventory. fetch_all_point_cloud_settings() follows the same rule.

  • Neither inventory call holds one snapshot across its count and row reads. Writes through another handle can change the inventory between them.

Overlaps#

These calls read and write clash records (ClashInfo); the data API names them overlaps.

Python

C

insert_overlap(clash_info, insert_also_frame_info=True, update_identifier=True, commit=True)

ovclash_suite_data_insert_overlap

update_overlap(clash_info, update_also_frame_info=True, commit=True)

ovclash_suite_data_update_overlap

find_all_overlaps_by_query_id(clash_query_id, fetch_also_frame_info, ...)

ovclash_suite_data_get_overlaps_by_query + ovclash_suite_overlap_cursor_next

find_all_overlaps_by_overlap_id(overlap_id, fetch_also_frame_info, ...)

ovclash_suite_data_find_overlap

get_overlaps_count_by_query_id(clash_query_id)

ovclash_suite_data_get_overlap_count_by_query

get_overlaps_count_by_query_id_grouped_by_state(clash_query_id)

ovclash_suite_data_get_overlap_state_count_by_query + ovclash_suite_data_get_overlap_state_count_at

remove_all_overlaps_by_query_id(clash_query_id, commit=True)

ovclash_suite_data_remove_overlaps_by_query

remove_overlap_by_id(overlap_id, commit=True)

ovclash_suite_data_remove_overlap

Reading clashes:

  • The overlap_id parameter of find_all_overlaps_by_overlap_id() and remove_overlap_by_id() takes record identifiers (ClashInfo.identifier), not clash hashes. Identifiers that are not stored are skipped.

  • Both find_all_overlaps_* methods return dict[str, ClashInfo] keyed by overlap_id, the clash-hash text, not by record identifier.

  • Both take num_frames_to_load and first_frame_offset. The by-query form also takes num_overlaps_to_load and first_overlap_offset. A count of -1 loads all; 0 or another negative count loads none.

  • Pass fetch_also_frame_info=False to read summaries without frame geometry.

  • The grouped-by-state form returns dict[ClashState, int] and omits states without clashes. A stored state that names no ClashState counts as NEW. In C, ovclash_suite_data_get_overlap_state_count_by_query() returns the number of state buckets, and ovclash_suite_data_get_overlap_state_count_at() reads one bucket, in ascending state order, into an ovclash_suite_state_count_view_t.

ovclash_suite_state_count_view_t, in <ovclash_suite/ovclash_suite_types.h>:

Field

Type

Required

Default or values

Description

state

uint32_t

Yes

An ovclash_suite_clash_state_t value, or a stored value that names no state

The state of the bucket, as stored. The C ABI does not merge unknown values into NEW.

count

uint32_t

Yes

1 or more

The clashes of the query in that state.

Writing clashes with frames:

  • insert_overlap() and update_overlap() convert every attached frame before writing anything. They write the clash row uncommitted, and the frame replacement applies commit to both.

  • With update_also_frame_info=True, the stored frames are replaced by the attached ones. An update of a ClashInfo read without frames therefore deletes its stored frames.

  • A frame that cannot be converted raises ValueError with nothing written.

  • A frame write the store rejects, such as a non-finite matrix, rolls back the whole pending transaction, the clash row included.

  • More than 1,000,000 frames are rejected before the frame write begins, and the clash row stays pending.

  • insert_overlap() sets clash_info.identifier only after both writes succeed.

Turning frames off still writes placeholder frames. With insert_also_frame_info=False, the store creates one placeholder frame (identity matrices, no geometry) for each frame attached to clash_info. An insert that reuses an identifier replaces that clash’s stored frames with the placeholders. With update_also_frame_info=False, the store creates placeholders only while the clash has no stored frames. In C, the frame_count field of ovclash_suite_clash_info_record_view_t controls these placeholders. Set it to 0 and write real frames with ovclash_suite_data_replace_frames_by_overlap_with_commit().

Frames#

Python

C

insert_clash_frame_info(clash_frame_info, clash_info_id, commit=True)

ovclash_suite_data_insert_frame

insert_clash_frame_info_from_clash_info(clash_info, commit=True)

ovclash_suite_data_replace_frames_by_overlap_with_commit

fetch_clash_frame_info_by_clash_info_id(clash_info_id, num_frames_to_load=-1, first_frame_offset=0)

ovclash_suite_data_get_frames_by_overlap + ovclash_suite_frame_cursor_next

get_clash_frame_info_count_by_clash_info_id(clash_info_id)

ovclash_suite_data_get_frame_count_by_overlap

remove_clash_frame_info_by_clash_info_id(clash_info_id, commit=True)

ovclash_suite_data_remove_frames_by_overlap

clash_info_id must name a stored clash. insert_clash_frame_info_from_clash_info() replaces every stored frame of the clash with the frames attached to clash_info. It does so in one bulk call that validates all frames before it changes anything.

Read records sequentially through a cursor, not by index. ovclash_suite_data_get_frames_by_overlap() and ovclash_suite_data_get_overlaps_by_query() each open one forward-only cursor, and stepping it reads each row once. An indexed getter such as ovclash_suite_data_get_frame_by_overlap_at() can instead skip the preceding rows on every call; SQLite reads gives the cost. The Python read methods already use cursors.

The two cursors spell “all” differently. The overlap cursor’s limit is 0 for all remaining clashes. The frame cursor’s max_frame_count is negative for all and 0 for none. Negative offsets start at zero in both.

Cursor rules:

  • A view from ovclash_suite_overlap_cursor_next() or ovclash_suite_frame_cursor_next() borrows cursor-owned memory. The next advance or the cursor’s destruction invalidates it, so copy what you need first.

  • Running out of rows is not an error. The call succeeds and sets *out_has_value (overlaps) or *out_has_frame (frames) to 0.

  • Destroy every cursor with ovclash_suite_overlap_cursor_destroy() or ovclash_suite_frame_cursor_destroy() before its data handle.

Both stores validate stored data when they read it, and a malformed record fails the read instead of being skipped. SQLite reads and Indexes and record locations list the checks.

Point-cloud settings#

Python

C

insert_point_cloud_settings(point_cloud_settings, update_identifier=True, commit=True)

ovclash_suite_data_insert_point_cloud_settings

update_point_cloud_settings(point_cloud_settings, commit=True)

ovclash_suite_data_update_point_cloud_settings

find_point_cloud_settings(point_cloud_settings_id)

ovclash_suite_data_find_point_cloud_settings

find_point_cloud_settings_by_point_cloud_prim_path(point_cloud_prim_path)

ovclash_suite_data_find_point_cloud_settings_by_prim_path

find_point_cloud_settings_by_destination_path(destination_path)

ovclash_suite_data_find_point_cloud_settings_by_destination_path

fetch_all_point_cloud_settings()

ovclash_suite_data_get_point_cloud_settings_count + ovclash_suite_data_get_point_cloud_settings_at

remove_point_cloud_settings_by_id(point_cloud_settings_id, commit=True)

ovclash_suite_data_remove_point_cloud_settings

Saving detection results#

Fetch-and-save writes the results of a completed detection run into a store, as the clashes and frames of one stored query. It keeps the identifiers and review fields of the clashes that the store already holds, and it maintains their present flag and clash state (Clash states).

Caller

Calls

Python, on the calling thread

ClashDetection.fetch_and_save_overlaps(stage, clash_data, clash_query), a generator that yields progress

Python, on a background worker

fetch_and_save_overlaps(..., async_mode=True), or ClashDetection.run_async_fetch_and_save(stage, clash_data, clash_query), which returns an AsyncFetchAndSave

C, in bounded steps on the calling thread

ovclash_suite_runtime_fetch_and_save_begin(), then ovclash_suite_runtime_fetch_and_save_next() until it reports completion, then ovclash_suite_runtime_fetch_and_save_destroy()

C, on a background worker

ovclash_suite_runtime_fetch_and_save_async(), then ovclash_suite_fetch_async_finish() and ovclash_suite_fetch_async_destroy_owned()

C, one overlap at a time

ovclash_suite_runtime_save_overlap_to_data()

The destination is an open built-in store, or a custom store. In Python, pass a ClashData or a serializer as clash_data. In C, pass the data handle with a NULL serializer. Fetching Suite runtime results describes the Python generator and AsyncFetchAndSave.

The bounded C loop, as a function for a C source file of your program. Call it after a completed run of runtime, with data open and query_id stored in it:

#include <ovclash_suite/ovclash_suite.h>

/* Saves the completed run as the clashes of the stored query query_id. Pass the query's own
 * SETTING_TOLERANCE, SETTING_DEPTH_EPSILON and SETTING_DUP_MESHES values. Returns 0 on success. */
static int fetch_and_save(ovclash_suite_runtime_t* runtime,
                          ovclash_suite_data_t* data,
                          int64_t query_id,
                          double tolerance,
                          double depth_epsilon,
                          uint32_t include_duplicates)
{
    ovclash_suite_fetch_and_save_t* fetch = NULL;
    uint32_t complete = 0u;
    ovclash_suite_result_t r = ovclash_suite_runtime_fetch_and_save_begin(
        runtime, data, NULL, query_id, tolerance, depth_epsilon, include_duplicates,
        1u /* resolve_stale */, &fetch);
    while (r.status == OVCLASH_SUITE_STATUS_SUCCESS && !complete)
    {
        double progress = 0.0;
        r = ovclash_suite_runtime_fetch_and_save_next(fetch, &progress, &complete);
    }
    ovclash_suite_runtime_fetch_and_save_destroy(fetch); /* accepts NULL; consumes it, even on error */
    return r.status == OVCLASH_SUITE_STATUS_SUCCESS ? 0 : 1;
}

Step 4 of Suite Workflows runs this loop in a complete program. The SDK archive’s samples/clash_suite_api/ClashSuiteApi.cpp runs it with progress reporting, and also runs the background ovclash_suite_runtime_fetch_and_save_async() variant.

Rules for the fetch operation:

  • Pass the values the query stores: SETTING_TOLERANCE as tolerance, SETTING_DEPTH_EPSILON as depth_epsilon and SETTING_DUP_MESHES as include_duplicates. The Python wrapper does the same, with 0.0, -1.0 and false for a missing setting. include_duplicates does not follow the runtime’s current only_find_duplicates setting.

  • Each step bounds its work, not its time. Each ovclash_suite_runtime_fetch_and_save_next() call handles at most 1,024 frame reports and 1,024 overlaps, and stops once about 8 MiB of report payload is acquired; one indivisible report can exceed that. Reconciling absent clashes scans at most 1,024 stored identifiers per call, so it can take several calls. begin enumerates every stored identifier of the query and is not bounded. The call that reports completion has committed.

  • Threading follows the runtime’s settings. Fetch preparation uses single_threaded, new_task_manager and nb_tasks, which may differ from the ones detection used. Set them before begin and keep them until destroy. Frame preparation for a directory store, or for a custom store with a prepare_frame callback, can use worker threads. SQLite frame encoding and every storage write stay on the driving thread: the calling thread for the bounded C calls and the Python generator, the background worker for the asynchronous calls. Python progress, modification and timing callbacks stay on the iterating thread.

  • Destroy the operation before you close its runtime or data handle. A live operation leases both; Suite fetch and cursor lifetime lists what it blocks.

ovclash_suite_runtime_save_overlap_to_data() persists one runtime overlap and its frames in one call. It keeps the review fields of a stored clash with the same query_id and overlap_id. A record the engine cannot report is dropped instead of failing the call; compare out_frame_count with nb_records from ovclash_suite_get_overlap_data() to detect the loss.

Fetch-and-save failures and transaction boundaries#

Fetch-and-save is not all-or-nothing for every failure. The rules in this section hold for every fetch call of Saving detection results, on both built-in stores and custom stores, and in serial and parallel modes. The storage transaction belongs to the data handle, so a rollback or the final commit also affects unrelated writes pending on that handle.

Outcome

Transaction behavior

Successful completion

Reconciles absent clashes and commits before it reports completion, even for an empty result. The commit publishes every pending write on the handle. Intermediate batches do not commit.

A storage callback, a transaction, a frame release or a saved-data read fails after initialization

Requests rollback of the whole pending transaction, including earlier batches of the same fetch and other uncommitted writes on the same destination.

Extraction, frame preparation (including a failed prepare_frame), scheduling or other native processing fails

Restores the incomplete streamed clash record, if any, and keeps earlier completed pending writes. If that restore fails, it requests a full rollback.

Initialization fails

Leaves writes that were pending before begin alone.

Cancellation is observed before the commit

Stops further reconciliation and the commit. Completed writes and absent-state updates already applied stay pending, unless restoring the incomplete clash record fails and forces a full rollback.

The operation is destroyed before completion

Restores the incomplete clash record, falls back to a full rollback if that fails, and never commits. Completed writes stay pending.

A clash record is streamed when fetch-and-save writes it before all the reports of its overlap are captured, as for a long dynamic clash.

  • Committed data is always kept.

  • A failed operation cannot resume. Destroy it and start a new one. Destruction consumes the operation even when its cleanup reports an error. In Python, close an abandoned generator before closing the store.

  • Closing or destroying a built-in data handle attempts to commit. Error cleanup can therefore save partial results. If that commit fails, the handle requests a rollback and stays available for inspection or retry, so the pending writes may be gone.

  • Callbacks after the final commit cannot undo it. In Python, the last modification notification, the final progress_callback call and timing_callback run after the final commit. An exception they raise leaves the results committed.

  • A record without an available report is skipped. The engine can report OVCLASH_SUITE_STATUS_UNAVAILABLE for a record while the overlap’s data stays readable. The fetch then drops that frame, prints a persisted X of Y records notice to stderr, and continues. The stored num_records then counts only the persisted frames. Compare it with nb_records from ovclash_suite_get_overlap_data() when the loss matters. An overlap whose records all fail fails the fetch.

The public data API has no rollback function, and destruction is not one. To publish results only after complete success, fetch into a separate staging store and publish it once completion is confirmed.

Clash states#

Every stored clash has a clash state, its review state: ClashState in Python, ovclash_suite_clash_state_t in C.

State

Value

Set by

NEW

1

Fetch-and-save, for a clash it stores for the first time

APPROVED

2

Your application

RESOLVED

3

Fetch-and-save with state updates, for a stored clash that the run no longer detects

CLOSED

4

Your application

INVALID

5

Your application

ACTIVE

6

Fetch-and-save with state updates, for a stored clash that the run detects again

Fetch-and-save keeps record identifiers and review fields, and it marks a stored clash that the run no longer detects as not present (present = False) in every mode. With state updates enabled, it also reconciles the states:

Stored clash

State updates on

State updates off

Detected again, normal or duplicate

Becomes ACTIVE. An APPROVED clash stays APPROVED when its detected contents are exactly unchanged.

Keeps its state.

Absent from the new results

Becomes RESOLVED and is marked not present.

Keeps its state and is marked not present.

New

Starts NEW and is not promoted during its first fetch.

Starts NEW and is not promoted during its first fetch.

Select the mode:

  • In C, pass a nonzero resolve_stale to the fetch call for state updates, or zero to keep the stored states.

  • In Python, state updates are on by default. Set ExtensionConfig.update_clash_states_after_detection (from omni.physxclashdetectioncore.config) to False before the fetch starts to keep the stored states. The same flag controls the ACTIVE update in ClashDetection.process_overlap() and process_duplicate().

The approval comparison#

An APPROVED clash keeps its approval only when the new run detects exactly what the store holds:

  • Identity. The query and the clash hash, the hash of the ordered pair of prim paths, establish result identity. A matching clash hash alone does not preserve an approval.

  • Compared contents. Type, tolerance, depth epsilon, object paths and mesh checksums, the aggregate results, and every frame’s times, matrices, metrics and geometry, in persisted order.

  • Ignored. Record identifiers, review fields, timestamps and user penetration-depth annotations.

  • Precision. Values compare at the precision of the Suite C ABI: binary64 for scalars, times and matrices, and binary32 for outlines and point sizes. The comparison uses no epsilon. Signed zeros are equal, a NaN never counts as unchanged, and subnormals stay distinct from zero, whatever the caller’s floating-point controls.

The comparison needs a reader for the stored results:

  • Built-in stores and Python custom stores supply it automatically. A Python custom store serves the saved frames through fetch_iter_saved_frames(); see Custom stores.

  • A custom C or C++ store passes an ovclash_suite_fetch_saved_data_reader_t to ovclash_suite_runtime_fetch_and_save_begin_with_reader() or ovclash_suite_runtime_fetch_and_save_async_with_reader(). Pass a null reader with a built-in destination.

  • With state updates on and no reader, a re-detected APPROVED clash becomes ACTIVE, because unchanged contents cannot be proven.

ovclash_suite_fetch_saved_data_reader_t, in <ovclash_suite/ovclash_suite_serializer.h>. Every callback runs on the thread that drives the fetch, takes user_data first, and acknowledges success by writing exactly 1 to out_success after it has built complete outputs:

Member

C type

Required

Default or values

Purpose

user_data

void*

No

Any pointer, or null

Your context, passed unchanged as the first argument of every reader callback.

read_overlap

void (*)(void*, int64_t identifier, ovclash_suite_clash_info_record_view_t* out_overlap, uint32_t* out_success)

Yes

Non-null

Reads the saved header of identifier, the identifier that find_overlap returned, with every detected field and the actual saved frame_count.

read_frame

void (*)(void*, int64_t identifier, uint32_t frame_index, ovclash_suite_clash_frame_info_record_view_t* out_frame, uint32_t* out_success)

Yes

Non-null

Reads the complete saved frame at the zero-based persisted frame_index.

close

void (*)(void*, uint32_t* out_success)

No

Null: nothing is released

Releases a reader-owned cursor. It must succeed when no cursor is open.

Output strings and arrays stay valid until the next reader callback.

Kit’s clash-detection extension sets every re-detected clash to ACTIVE; Kit compatibility lists that difference.

Custom stores#

A custom store keeps records in storage that you implement, and receives fetch-and-save results under the same transaction contract as the built-in stores. The built-in lifetime guards protect only the built-in stores: a custom store keeps its destination stable for the whole fetch and enforces its own lifetime and connection rules.

In Python, derive from AbstractClashDataSerializer, implement its record methods, and pass an instance to ClashData(serializer) or directly to the fetch call.

  • Override fetch_transaction(operation). Without that override, fetching raises NotImplementedError before any work starts, because rollback cannot be emulated through the record methods.

  • The other fetch_* hooks have defaults built on the record methods: fetch_visit_existing(), fetch_find_overlap(), fetch_write_overlap(), fetch_clear_frames(), fetch_append_frame(), fetch_mark_absent() and fetch_iter_saved_frames(). The defaults need record methods that raise on persistence errors. Override a hook when its default is slow for your store. Override fetch_visit_existing() when the store allows several records with the same clash hash.

  • Identifiers that the hooks return fit a signed 64-bit integer and are never -1, which ClashInfo reserves for an unsaved record.

  • For long APPROVED histories, override fetch_iter_saved_frames(identifier, first_frame_offset=0) with a forward cursor. The cursor yields owned frames in persisted order and has a close() method. The fetch may close it and reopen it at a nonzero offset around writes. The default issues one ranged read per frame.

  • Threads. The hooks run on the calling thread, or on the background worker of an asynchronous fetch. Progress, modification and timing notifications stay on the iterating thread.

The docstrings of AbstractClashDataSerializer and its fetch_* hooks give the full contract.

In C or C++, fill an ovclash_suite_fetch_serializer_t callback table, the serializer interface of a custom store, and pass it to the fetch call with a NULL data handle; exactly one of the two is non-null. Each callback acknowledges success by writing exactly 1 to its out_success argument, and no exception may cross the C ABI.

Member

C type

Required

Default or values

Purpose

user_data

void*

No

Any pointer, or null

Your context, passed unchanged as the first argument of every callback.

visit_existing

void (*)(void* user_data, int64_t query_id, ovclash_suite_visit_identifier_fn visitor, void* visitor_data, uint32_t* out_success)

Yes

Non-null

Enumerates the stored identifiers of the query once, during initialization, by calling visitor(visitor_data, identifier) once per stored row.

find_overlap

void (*)(void* user_data, int64_t query_id, ovclash_suite_string_t overlap_id, ovclash_suite_clash_info_record_view_t* out_record, uint32_t* out_found, uint32_t* out_success)

Yes

Non-null

Looks up one stored clash header by query and clash hash text (overlap_id).

write_overlap

void (*)(void* user_data, const ovclash_suite_clash_info_record_view_t* record, int64_t* out_identifier, uint32_t* out_success)

Yes

Non-null

Inserts or updates one clash header and returns its stable identifier.

clear_frames

void (*)(void* user_data, int64_t identifier, uint32_t* out_success)

Yes

Non-null

Removes all stored frames of one clash.

append_frame

void (*)(void* user_data, int64_t identifier, const ovclash_suite_clash_frame_info_view_t* frame, const void* prepared, uint32_t* out_success)

Yes

Non-null

Appends one frame to a clash. prepared is the output of prepare_frame, or null.

mark_absent

void (*)(void* user_data, int64_t identifier, uint32_t resolve, uint32_t* out_success)

Yes

Non-null

Marks a stored clash not present, and also RESOLVED when resolve is nonzero.

transaction

void (*)(void* user_data, uint32_t operation, uint32_t* out_success)

Yes

Non-null

Applies one ovclash_suite_serializer_transaction_t operation.

prepare_frame

void (*)(void* user_data, const ovclash_suite_clash_frame_info_view_t* frame, void** out_prepared, uint32_t* out_success)

No; set both or neither with release_frame

Null: frames are not prepared, and append_frame receives a null prepared

Encodes a frame, possibly on a worker thread, for a later append_frame.

release_frame

void (*)(void* user_data, void* prepared, uint32_t* out_success)

No; set both or neither with prepare_frame

Null with a null prepare_frame

Releases one non-null encoded payload.

last_error

void (*)(void* user_data, ovclash_suite_string_t* out_error, uint32_t* out_success)

No

Null: the engine reports a generic diagnostic

Publishes the store’s diagnostic text after a failed callback.

Custom serializers gives the thread and borrowed-input rules, and the comments in <ovclash_suite/ovclash_suite_serializer.h> define every callback.

Both languages implement the same transaction operations:

Python

C

The store must

FETCH_BEGIN

OVCLASH_SUITE_SERIALIZER_BEGIN

Start the pending transaction, or reuse the open one. It precedes every write batch and every reconciliation batch, so it must be idempotent.

FETCH_COMMIT

OVCLASH_SUITE_SERIALIZER_COMMIT

Publish every pending write, unrelated ones included. It is requested only when the fetch completes, always after a BEGIN, even for an empty result.

FETCH_ROLLBACK

OVCLASH_SUITE_SERIALIZER_ROLLBACK

Discard the whole pending transaction, including earlier batches and unrelated pending writes. It is requested at most once per operation, after a persistence failure, so it need not be idempotent.

FETCH_BEGIN_OVERLAP

OVCLASH_SUITE_SERIALIZER_BEGIN_OVERLAP

Set a restore point before a streamed clash record is replaced.

FETCH_END_OVERLAP

OVCLASH_SUITE_SERIALIZER_END_OVERLAP

Release the restore point after the final header of the streamed clash record is written.

FETCH_ABORT_OVERLAP

OVCLASH_SUITE_SERIALIZER_ABORT_OVERLAP

Restore the incomplete streamed clash record to its restore point and keep the other pending writes. A failed abort leads to a rollback.

The engine cannot recover when your rollback fails, and a failed commit or rollback cannot undo side effects your store already published. Such a store may need recovery at the application level. Fetch-and-save failures and transaction boundaries says when the engine requests each operation. To keep unchanged approvals in a C store, also supply the saved-data reader described in The approval comparison.

Numeric fidelity#

The stores keep numbers as follows:

Value

SQLite store

Directory store

Integers

64 bits

64 bits

Finite scalars

Exact, except that a negative zero reads back as a positive zero

Exact, negative zero included

Infinite scalars

Stored

Stored as the strings "+Infinity" and "-Infinity"

NaN scalars

Rejected: the write fails and rolls back the pending transaction

Stored as the string "NaN"; its payload and sign are lost

Frame matrices

Exact; must be finite

Exact; must be finite

Face, outline and point buffers

Exact, stored as raw bytes

Exact for finite values

  • Persisted values, and the JSON that the native layer writes for settings and models, do not depend on the caller’s locale, rounding or denormal controls.

  • That JSON spells negative zero as -0.0, matrix and float-array elements included.

  • A record that holds a NaN scalar cannot be copied unchanged from a directory store into a SQLite store.

  • The approval comparison compares values at the precision of the Suite C ABI.

SQLite values and Directory values give each store’s encoding.

Schema compatibility#

Each store records the version of its format, and open refuses a store newer than the build:

  • A SQLite store records a schema version per table. An older file with a registered migration path must be migrated before it opens. An older file without one, and a file newer than the build, never open, and no migration recovers them. See Schema versions and forward compatibility.

  • A directory store records one format version in manifest.json, and has no migration path. See Manifest and internal files.

Purpose

Python

C

Is the open store’s format current?

ClashData.data_structures_compatible

ovclash_suite_data_structures_compatible

Could it be migrated?

ClashData.data_structures_migration_to_latest_version_possible

ovclash_suite_data_migration_to_latest_possible

Migrate it in place

migrate_data_structures_to_latest_version(path)

ovclash_suite_data_migrate_to_latest

On a serializer, data_structures_compatible() and data_structures_migration_to_latest_version_possible() are methods; on ClashData they are properties of the same names.

Failures that do not raise#

A native failure normally becomes a Python exception that carries the native error text. The data and serializer classes keep the legacy return contract in these places:

  • ClashData without an open store, or without a serializer, returns False, 0, None, {} or [] from its record methods, save() and save_as(), according to the result type, and logs nothing. Its close() and commit() then do nothing. A destroyed built-in serializer returns the same values from its record methods and does nothing on close() and commit(). Its open(), save() and save_as() raise.

  • SQLite open() leaves an incompatible database closed without raising. It logs the reason as a warning through the ovclash_suite logger, as ovclash_suite: store left closed after open(<path>): <reason>, where <path> is the path you passed and <reason> is SQLite database tables are incompatible; migration to the latest version is possible or SQLite database tables are incompatible and cannot be migrated to the latest version. Inspect is_open(), data_structures_compatible and data_structures_migration_to_latest_version_possible.

  • migrate_data_structures_to_latest_version() returns False instead of raising, and logs the reason as a warning: ovclash_suite: migrate_data_structures_to_latest_version(<path>) failed: <reason>, where <reason> is the native error text.

  • ClashQuery.load_settings_from_str() returns False for empty or invalid JSON, and logs nothing.

For the SQLite open and the migration, last_error() returns the reason the call recorded. Without it, a store left closed looks exactly like an empty one.

Everything else raises: other open failures, directory format errors included, and native close, commit and destroy failures. fetch_all_queries() and fetch_all_point_cloud_settings() raise RuntimeError instead of returning a partial dictionary.