Skip to content

AsyncOperationBuilder

Class: warmhub.AsyncOperationBuilder

AsyncOperationBuilder(submit: AsyncSubmitCallable, *, options: CommitOptions | None = None, shapes: Mapping[str, ShapeFields] | None = None)

The awaitable half of the pair.

Identical to OperationBuilder apart from commit, which is a coroutine function:

batch = repo.batch(message="seed")
batch.add("probe-1", shapes=["Reading"], data={"temp_celsius": 21.0})
result = await batch.commit()

Forgetting the await is inert rather than damaging: the body does not run, nothing is submitted, no state changes, and Python’s own RuntimeWarning: coroutine ... was never awaited names the mistake. The builder is still usable afterwards.

add(name: str, *, shapes: Sequence[str] | Unset = UNSET, shapeless: bool | Unset = UNSET, data: JsonValue | Unset = UNSET, affirmed_targets: Sequence[str] | Unset = UNSET, skip_existing: bool | Unset = UNSET)

Queue an add of the Thing name, stating its Shapes with shapes or shapeless. Returns self so calls chain.

revise(name: str, *, shapes: Sequence[str] | Unset = UNSET, shapeless: bool | Unset = UNSET, keep_shapes: bool | Unset = UNSET, data: JsonValue | Unset = UNSET, affirmed_targets: Sequence[str] | Unset = UNSET, expected_version: int | Unset = UNSET, lease_id: str | Unset = UNSET)

Queue a revise of the Thing name, stating its Shapes with shapes, shapeless or keep_shapes. Returns self.

keep_shapes reads the current set and version at submit and sends the version as expectedVersion. It sends the Shapes bare, so the revise re-certifies under each Shape’s head version. keep_shapes pins the version it read; a cross-process resubmit of the same submission_id can conflict; explicit shapes is the retry-safe form.

retract(name: str, *, reason: str | Unset = UNSET, expected_version: int | Unset = UNSET, lease_id: str | Unset = UNSET)

Queue a retract of name. Returns self so calls chain.

restore(name: str, *, new_name: str | Unset = UNSET, expected_version: int | Unset = UNSET, lease_id: str | Unset = UNSET)

Queue a restore of a retracted Thing, by durable ID.

Returns self so calls chain.

reaffirm(name: str, *, add: Sequence[str] | Unset = UNSET, remove: Sequence[str] | Unset = UNSET, expected_version: int | Unset = UNSET, lease_id: str | Unset = UNSET)

Queue a reaffirm. Returns self so calls chain.

Edits which pinned target versions the assertion’s claim is affirmed for, without changing claim data. add and remove compose in one operation; already-present and already-absent targets are reported as ignored rather than failing.

rename(name: str, new_name: str)

Queue a rename of name to new_name, both full names. A Shape renames to a Shape. Returns self so calls chain.

has(name: str)

Whether an add for name is already queued.

validate()

Run client-side validation without contacting the server.

commit(*, extra_headers: Omittable[Mapping[str, str]] = UNSET, extra_query: Omittable[Mapping[str, str]] = UNSET)

Validate, submit, and seal the builder.

Validation failures raise before any request is issued, and before the first suspension point. Ambiguous failures surface as PartialStreamSubmissionError; a deterministic all-failed batch surfaces as AllStreamOperationsFailedError.

operations

The queued operations, as an immutable snapshot.

size

Documentation is not yet available.

submitted

Documentation is not yet available.