Skip to main content

LockingWindow

@iota/audit-trails API documentation


Class: LockingWindow

Delete-window definition used in the trail's LockingConfig.

Remarks

A window describes the period during which a record stays locked against deletion: time-based windows lock a record while its age is below the configured number of seconds; count-based windows lock the last count records currently present in trail order. Records outside the window may be deleted, subject to remaining permission and tag checks.

Properties

args

readonly args: any

Returns the window argument for parameterized variants.

Returns

The numeric argument for TimeBased/CountBased variants, or undefined otherwise.


type

readonly type: LockingWindowType

Returns the window variant.

Returns

The LockingWindowType discriminant for this window.

Methods

toJSON()

toJSON(): Object

  • Return copy of self without private attributes.

Returns

Object


toString()

toString(): string

Return stringified version of self.

Returns

string


withCountBased()

static withCountBased(count): LockingWindow

Creates a count-based delete window.

Parameters

count

bigint

Number of most recent records that stay locked against deletion. Must be greater than zero; use LockingWindow.withNone for no deletion lock.

Returns

LockingWindow

A window that protects the last count records currently present in trail order.


withNone()

static withNone(): LockingWindow

Creates a disabled delete window.

Returns

LockingWindow

A window that does not lock records against deletion.


withTimeBased()

static withTimeBased(seconds): LockingWindow

Creates a time-based delete window.

Parameters

seconds

bigint

Maximum record age, in seconds, for which the record stays locked against deletion.

Returns

LockingWindow

A window that locks records younger than seconds.