import StateChangeKind from "./StateChangeKind"; /** * Tracks the current value and modification state of a cached actor state item. * * The actor state manager uses StateMetadata to maintain a local cache of state * during an actor method invocation. Each state item tracks both its current value * and the kind of modification that has been applied to it since it was loaded or * created. * * This metadata is transient—it is cleared at the beginning of each actor method * invocation and persisted at the end through the state provider. * * @typeParam T - The type of the state value. * * @internal Intended for use by ActorStateManager; not typically used directly by application code. */ export default class StateMetadata { private value; private changeKind; /** * Constructs a StateMetadata instance. * * @param value - The current state value. * @param changeKind - The type of modification applied to this state ({@link StateChangeKind}). */ constructor(value: T, changeKind: StateChangeKind); /** * Retrieves the current state value. * * @returns The state value. */ getValue(): T; /** * Retrieves the modification kind for this state item. * * @returns The {@link StateChangeKind} indicating ADD, UPDATE, REMOVE, or NONE. */ getChangeKind(): StateChangeKind; /** * Updates the state value. * * @param value - The new state value. */ setValue(value: T): void; /** * Updates the modification kind for this state item. * * @param changeKind - The new {@link StateChangeKind}. */ setChangeKind(changeKind: StateChangeKind): void; }