/** * @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. * * The Write Request is the transaction's durable write, so it goes out in commit phase one. The values the peer * accepts are settled in the cache right away, while the transaction still holds its locks; a declined attribute fails * phase one, which rolls back every participant. Accepted values are device truth and stay either way. Their change * notifications are released when the transaction concludes, so no observer runs inside the commit. */ 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. * * @param receiver settles the values the peer accepts * @param epoch the receiver's epoch when this write is queued, so it can tell a value the peer settled afterwards * from one that predates the write */ set(endpointNumber: EndpointNumber, behaviorId: string, values: Val.Struct, receiver: RemoteWriteParticipant.Receiver, epoch: number): void; commit1(): Promise; conclusion(): Promise; rollback(): void; toString(): string; constructor(writer: RemoteWriter, name: string); } export declare namespace RemoteWriteParticipant { /** * Settles the values of a write the peer accepted in the local cache. */ interface Receiver { /** * Settle {@link values}, except for an attribute the peer settled after {@link epoch}: what the device * reported while the write was in flight outranks the write. The values apply in memory even when persisting * them fails. */ settleAccepted(values: Val.Struct, epoch: number): Promise; } /** * The result of {@link Receiver.settleAccepted}. */ interface Settled { /** * Releases the change notifications of the settled values. They are announced in settlement order, after the * announcements of earlier changes of the cluster, including those held until their own transaction ends, so * they may complete after this resolves. */ release: () => Promise; /** * The error that kept the values from being persisted locally, if any. A failure thrown as `undefined` is not * reported. */ persistFailure?: unknown; } /** * The values of one cluster a transaction writes, with the receiver that settles those the peer accepts and its * epoch when the write was queued. */ interface PendingWrite { receiver: Receiver; epoch: number; values: Val.Struct; } } //# sourceMappingURL=RemoteWriteParticipant.d.ts.map