/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { Transaction } from "@matter/general"; import { Val } from "@matter/protocol"; import { EndpointNumber } from "@matter/types"; import type { RemoteWriter } from "./RemoteWriter.js"; /** * A transaction participant that persists changes to a remote node. * * There is one of these for node/transaction pair. All attributes in a transaction commit with a single interaction. */ export declare class RemoteWriteParticipant implements Transaction.Participant { #private; /** * There is one participant for each transaction/writer pair. We use the writer function itself as the dedup key. */ get role(): RemoteWriter; /** * Add an attribute update to the write request. * * The optional {@link snapshot} captures the pre-write values for the affected attributes plus a * {@link RemoteWriteParticipant.Compensator} the participant invokes if the remote rejects the write. */ set(endpointNumber: EndpointNumber, behaviorId: string, values: Val.Struct, snapshot?: RemoteWriteParticipant.SnapshotInput): void; commit2(): Promise; rollback(): void; toString(): string; constructor(writer: RemoteWriter); } export declare namespace RemoteWriteParticipant { /** * Restores local cache state for attribute writes the remote device declined. * * The participant invokes this with the failed attribute keys after a write fails. Implementations should only * restore values for keys present in {@link previousValues} AND only when the current local value still equals * what was just written — leaving concurrently-mutated values alone. */ interface Compensator { compensate(failedAttributeIds: Set, previousValues: Val.Struct, writtenValues: Val.Struct): Promise; } /** * The pre-write baseline supplied by the caller of {@link RemoteWriteParticipant.set} together with the * {@link Compensator} responsible for restoring it. */ interface SnapshotInput { compensator: Compensator; previousValues: Val.Struct; } /** * Internal per-cluster snapshot held by the participant for the duration of a transaction. */ interface Snapshot { compensator: Compensator; previousValues: Val.Struct; writtenValues: Val.Struct; } } //# sourceMappingURL=RemoteWriteParticipant.d.ts.map