iya-sts
    Preparing search index...

    The directory as a bounded window onto the store, in the shape of realms.map() (#349).

    Index
    • Builds the window. It asks nothing of the store until attach().

      Parameters

      • deps: WindowDeps

        the realm hooks, the containers, the bound and the registry

      Returns export=

    • Puts an entry the STORE holds: not a write. For a restore and for a row another process wrote.

      Parameters

      • realmId: string

        the realm id

      • key: string

        the normalised DN

      • entry: Entry

        the entry

      Returns void

    • Whether any windowed entry of a realm holds an attribute: a change made here first, then the store.

      Parameters

      • realmId: string

        the realm id

      • attribute: string

        the attribute name, lower-cased as stored

      Returns boolean

      true when one does

    • Asks the store one of directory_queries.js's questions, on the driver's read pool where the bridge offers it.

      Parameters

      • name: string

        the query's name

      • args: unknown[]

        its arguments

      Returns Promise<unknown>

      a promise of the answer (null before attach())

    • Gives the window its bridge, once the store is open, and drops every CLEAN answer given before it — an absence recorded before the store could be asked is not an absence.

      Parameters

      • bridge: Bridge

        the synchronous question to the store

      Returns void

    • Whether a key has a change here not yet written, or one in flight, or was handed out since the last flush — the states in which a row from another process must wait for the flush rather than replace it.

      Parameters

      • realmId: string

        the realm id

      • key: string

        the normalised DN

      Returns boolean

      true when the flush must go first

    • A realm's count for ldap.maxEntries: the store's, read again when the last reading is more than ten seconds old, plus this process's own net since. Stale by at most that much for another process's creates; the ceiling is a ceiling, not a quota to the entry.

      Parameters

      • realmId: string

        the realm id

      Returns number

      the count

    • The windowed entries strictly under a base holding any of some object classes (classesUnder, the GIN index over class_keys), asked once and asynchronously, as this process holds them: findWindowed()'s answer for a caller that can wait — an LDAP search for groups.

      Parameters

      • realmId: string

        the realm id

      • base: string

        the base's normalised DN (a windowed container)

      • classes: string[]

        the object classes, lower-cased

      • predicate: (entry: Entry, key: string) => boolean

        the service's own rule, asked of each candidate

      Returns Promise<{ entry: Entry; key: string }[]>

      a promise of [{ key, entry }], local additions last

    • Empties a realm: the restore's replaceRealm(). Changes not yet written are dropped with the rest — a restore is "this is the directory".

      Parameters

      • realmId: string

        the realm id

      Returns void

    • What the flush writes for the windowed keys, and the release of every entry handed out and left unchanged.

      Parameters

      • named: Set<string>

        the journal's keys (without a realm), or null when a write named nothing: then every held and evicted-but-held entry is a candidate

      Returns { deletes: Change[]; upserts: Change[] }

      the upserts (entry, json, base) and deletes (base)

    • The flush wrote what collect() answered: each base is what was sent, and a key unchanged since is released. A key the store answered differently for (outcomes) is forgotten, or — changed again since — given the store's row as its base.

      Parameters

      • changes: { deletes: Change[]; upserts: Change[] }

        what collect() answered

      • Optionaloutcomes: { entry?: Entry; key: string; outcome: string; realm: string }[]

        the driver's { realm, key, outcome, entry } rows

      Returns void

    • One numbered page of a parent's direct children in key order, asked asynchronously (#359). asked counts rows the store answered before a delete made here dropped one, so a short page is the end of the container and not a page of deletions.

      Parameters

      • realmId: string

        the realm id

      • parentKey: string

        the parent's normalised DN

      • offset: number

        rows to skip

      • limit: number

        the page size (at most 1,000)

      Returns Promise<{ asked: number; rows: { entry: Entry; key: string }[] }>

      { rows, asked }

    • How many windowed entries under a base the store says hold an attribute.

      Parameters

      • realmId: string

        the realm id

      • base: string

        the base's normalised DN

      • attribute: string

        the attribute name, lower-cased as stored

      • OptionalupTo: number

      Returns Promise<number>

      a promise of the count (0 before attach())

    • How many entries are strictly under a base and how many of them hold an attribute, now: the store's two counts in one statement and this process's changes not yet written (#610). An entry "holds" an attribute when it carries the NAME with at least one value — what the store's attr_names says, the only reading of an entry's attributes the database can make, its values being sealed.

      Parameters

      • realmId: string

        the realm id

      • base: string

        the base's normalised DN

      • attribute: string

        the attribute name, lower-cased as stored

      Returns { holding: number; n: number }

      { n, holding }

    • countHolding(), the store asked asynchronously.

      Parameters

      • realmId: string

        the realm id

      • base: string

        the base's normalised DN

      • attribute: string

        the attribute name, lower-cased as stored

      Returns Promise<{ holding: number; n: number }>

      a promise of { n, holding }

    • How many entries are strictly under a base, from the store's count and this process's changes not yet written.

      Parameters

      • realmId: string

        the realm id

      • base: string

        the base's normalised DN

      • Optionalasked: number

        the store's count, when a caller already asked for it asynchronously; omitted, the store is asked here

      Returns number

      the count

    • countUnder(), the store asked asynchronously.

      Parameters

      • realmId: string

        the realm id

      • base: string

        the base's normalised DN

      Returns Promise<number>

      a promise of the count

    • Parameters

      • realmId: string
      • base: string
      • seen: Set<string>

      Returns [string, Entry][]

    • Removes a key: a write, pinned until the flush writes it.

      Parameters

      • realmId: string

        the realm id

      • key: string

        the normalised DN

      Returns boolean

      true when it held an entry

    • Drops the held count of every container above a key another process just created, changed or deleted.

      Parameters

      • realmId: string

        the realm id

      • key: string

        the changed entry's normalised DN

      Returns void

    • Calls fn for each RESIDENT entry of a realm: for a walk whose filter can only match an entry outside the windowed containers.

      Parameters

      • realmId: string

        the realm id

      • fn: (entry: Entry, key: string) => void

        called with each entry and its key

      Returns void

    • The entries at many keys, as this process holds them: a key held here (in the window, handed out, or evicted and still held by a caller) is answered from what is held — an absence or a delete made here included — and the rest are asked of the store with byKeys, a page at a time, asynchronously.

      Parameters

      • realmId: string

        the realm id

      • keys: string[]

        normalised DNs; a resident key is answered from memory

      • Optionalcounter: { pages: number; rows: number }

        optional; pages and rows are added to

      Returns Promise<Map<string, Entry>>

      a promise of a Map from each key to its entry, or to null

    • A realm's count read from the store now, for ldap.maxEntries and for a report.

      Parameters

      • realmId: string

        the realm id

      Returns number

      the count

    • The facade ldap_server.js holds as entries: the ambient realm's view for every Map member, realmMap(id) for a named realm, and the window itself as window.

      Returns any

      the facade

    • The flush failed: the keys it took are still changed, and are taken again by the next one.

      Parameters

      • changes: { deletes: Change[]; upserts: Change[] }

        what collect() answered

      Returns void

    • The windowed entries of a realm matching an indexed question, as this process holds them.

      Parameters

      • realmId: string

        the realm id

      • name: string

        one of persistence/directory_queries.js's queries

      • args: unknown[]

        its arguments

      • predicate: (entry: Entry, key: string) => boolean

        the service's own rule, asked of each candidate

      • Optionalinfo: { readOnly?: boolean; rows?: number }

        optional; rows is set to how many rows the store answered, before any was dropped, so a caller that asked with a limit can tell a capped answer (#320); readOnly takes each row as the store answered it where this process holds nothing newer, as holdersAsync() does, rather than reading it again by key

      Returns { entry: Entry; key: string }[]

      [{ key, entry }], in key order, local additions last

    • findWindowed(), asked asynchronously and read-only: the windowed entries of a realm matching an indexed question and predicate, each as this process holds it, in the store's key order, the entries changed here and not yet written that match added last — the order findWindowed() answers in, so a caller taking the first answer takes the entry it would have taken.

      Parameters

      • realmId: string

        the realm id

      • name: string

        one of persistence/directory_queries.js's queries

      • args: unknown[]

        its arguments

      • predicate: (entry: Entry, key: string) => boolean

        the service's own rule, asked of each candidate

      Returns Promise<{ entry: Entry; key: string }[]>

      a promise of [{ key, entry }]

    • Forgets a key: a row another process wrote or removed, read again when next asked for. A resident key is removed.

      Parameters

      • realmId: string

        the realm id

      • key: string

        the normalised DN

      Returns boolean

      true when something was held

    • The entry at a key, or undefined.

      Parameters

      • realmId: string

        the realm id

      • key: string

        the normalised DN

      Returns Entry

      the entry

    • Whether anything is under a key.

      Parameters

      • realmId: string

        the realm id

      • key: string

        the normalised DN

      Returns boolean

      true when something is

    • Whether a key holds an entry.

      Parameters

      • realmId: string

        the realm id

      • key: string

        the normalised DN

      Returns boolean

      true when it does

    • What this process holds at a key, WITHOUT asking the store (#618): the group index's question "is the entry just written a group", which must never cost a round trip. A resident key is always known (the Map is the whole truth); a windowed key is known when the window, what was handed out since the last flush, or an evicted entry a caller still holds has it — an absence held counts — and is NOT known otherwise.

      Parameters

      • realmId: string

        the realm id

      • key: string

        the normalised DN

      Returns { entry: Entry; known: boolean }

      { known, entry }; entry null for none

    • The windowed entries under a base that hold an attribute, as this process holds them: the store's holders a page at a time, each read back through the window and asked predicate, and changes made here added.

      Parameters

      • realmId: string

        the realm id

      • base: string

        the base's normalised DN (a windowed container, usually)

      • attribute: string

        the attribute name, lower-cased as stored

      • predicate: (entry: Entry, key: string) => boolean

        the service's own rule, asked of each candidate

      Returns { entry: Entry; key: string }[]

      [{ key, entry }]

    • The windowed entries under a base that hold an attribute, as this process holds them, asked a page at a time without blocking the event loop between pages.

      Parameters

      • realmId: string

        the realm id

      • base: string

        the base's normalised DN (a windowed container, usually)

      • attribute: string

        the attribute name, lower-cased as stored

      • predicate: (entry: Entry, key: string) => boolean

        the service's own rule, asked of each candidate

      • Optionalcontrol: { stop?: () => any }

        optionally { stop }, asked before each page; a truthy answer (the reason) ends the read with a thrown error whose stopped is true, so a caller whose budget ran out stops the store too (#1002: a report's holders read on 8081 outlived its request by minutes, a page at a time, with nobody waiting for the answer)

      Returns Promise<{ entry: Entry; key: string }[]>

      a promise of [{ key, entry }]

    • One page of the windowed entries under a base that hold an attribute, in key order at an offset.

      Parameters

      • realmId: string

        the realm id

      • base: string

        the base's normalised DN

      • attribute: string

        the attribute name, lower-cased as stored

      • offset: number

        holders to skip

      • limit: number

        the page size

      • predicate: (entry: Entry, key: string) => boolean

        the service's own rule, asked of each row

      Returns Promise<{ read: number; rows: { entry: Entry; key: string }[] }>

      a promise of { rows: [{ key, entry }], read }, read the rows the store answered (for a caller paging on)

    • Whether a key of a realm is windowed: strictly under one of its windowed containers.

      Parameters

      • realmId: string

        the realm id

      • key: string

        the normalised DN

      Returns boolean

      true when windowed

    • keysUnderAsync(), asked synchronously: for a caller that cannot wait. At most limit + 1 keys and no attribute, so a bounded handful of statements (one per thousand keys), never a walk.

      Parameters

      • realmId: string

        the realm id

      • base: string

        the base's normalised DN (a windowed container)

      • limit: number

        how many at most

      Returns { more: boolean; rows: { dn: string; key: string }[] }

      { rows: [{ key, dn }], more }

    • The first keys strictly under a base, with their DNs and nothing else, asked asynchronously a page at a time (keysUnder: no attribute is read or opened) until limit + 1 are found — as this process holds them: a key deleted here is left out, and below the cap the entries created here and not yet written are added.

      Parameters

      • realmId: string

        the realm id

      • base: string

        the base's normalised DN (a windowed container)

      • limit: number

        how many at most

      • Optionalcounter: { pages: number; rows: number }

        optional; pages and rows are added to

      Returns Promise<{ more: boolean; rows: { dn: string; key: string }[] }>

      a promise of { rows: [{ key, dn }], more }, more when there were more than limit

    • Another process changed a key this one is busy with: once this process's flush has let it go — written and merged by the store, or found unchanged — it is dropped, and read again when next asked for. Without this a key merely HANDED OUT when the change arrived would keep the older copy until it was evicted.

      Parameters

      • realmId: string

        the realm id

      • key: string

        the normalised DN

      Returns void

    • The windowed entries strictly under a base whose keys follow afterKey, at most limit of them, in key order.

      Parameters

      • realmId: string

        the realm id

      • base: string

        the base's normalised DN

      • afterKey: string

        the last key of the previous page, or ''

      • limit: number

        the page size

      Returns { more: boolean; rows: { entry: Entry; key: string }[] }

      { rows: [{ key, entry }], more } — more when the store answered a full page

    • The entry held at a key, without asking the store and without handing it out: persistence.js's entryAt() for a windowed key.

      Parameters

      • realmId: string

        the realm id

      • key: string

        the normalised DN

      Returns Entry

      the entry, or null

    • One page of a parent's direct children in rdn_value order, asked asynchronously (#359). Nothing is put in the LRU. asked is how many rows the store answered, including ones this process has deleted; last is the last of those rows' RDN, so a cursor moves past a row this process no longer holds.

      Parameters

      • realmId: string

        the realm id

      • parentKey: string

        the parent's normalised DN

      • afterRdn: string

        the previous page's last RDN, or ''

      • limit: number

        the page size (at most 1,000)

      • Optionaloptions: {
            countCapped?: boolean;
            matched?: number;
            needle?: string;
            offset?: number;
            total?: number;
        }

        offset and needle; with a needle, the caller's count (matched, total, countCapped), which lets the store read a needle with few matches through its trigram index (#1310)

      Returns Promise<
          {
              asked: number;
              last: string;
              rows: { entry: Entry; key: string; rdn: string }[];
          },
      >

      { rows, asked, last }

    • One page of a realm's entries in the store's key order, asked asynchronously.

      Parameters

      • realmId: string

        the realm id

      • afterKey: string

        the last key of the previous page, or ''

      • limit: number

        the page size (at most 1,000)

      • Optionaloptions: { offset?: number; origin?: string }

        offset (rows past the cursor to skip) and origin

      Returns Promise<
          {
              asked: number;
              last: string;
              more: boolean;
              rows: { entry: Entry; key: string }[];
          },
      >

      a promise of { rows: [{ key, entry }], more, asked, last } — asked how many rows the store answered, more when that was a full page, last the last key it answered (the next page's cursor, '' for none)

    • How many entries are strictly under a base: the store's count, read again when the last reading is more than ten seconds old, plus this process's own net since.

      Parameters

      • realmId: string

        the realm id

      • base: string

        the base's normalised DN

      Returns number

      the count

    • recentCountUnder(), the store asked asynchronously.

      Parameters

      • realmId: string

        the realm id

      • base: string

        the base's normalised DN

      Returns Promise<number>

      a promise of the count

    • The resident entries of a realm, keyed: what persistence.js's write shadow covers. A windowed entry is never in that shadow — the window holds its own base.

      Parameters

      • realmId: string

        the realm id

      Returns { entry: Entry; key: string }[]

      [{ key, entry }]

    • One page of the windowed entries under a base, in key order after a cursor: those holding an attribute, or every one.

      Parameters

      • realmId: string

        the realm id

      • base: string

        the base's normalised DN (a windowed container)

      • attribute: string

        the attribute held, lower-cased as stored; '' for every entry under the base

      • after: string

        the last key of the page before, or ''

      • limit: number

        the page size (at most PAGE)

      • predicate: (entry: Entry, key: string) => boolean

        the service's own rule, asked of each row

      Returns Promise<{ last: string; read: number; rows: { entry: Entry; key: string }[] }>

      a promise of { rows: [{ key, entry }], last, read }: last the last key the store answered (the next page's cursor), read how many rows it answered

    • Puts an entry at a key: a write, pinned until the flush writes it.

      Parameters

      • realmId: string

        the realm id

      • key: string

        the normalised DN

      • entry: Entry

        the entry

      Returns void

    • How many entries a realm holds, from the store's count of the windowed containers the first time and this process's own net since.

      Parameters

      • realmId: string

        the realm id

      Returns number

      the count

    • The window's figures, for a status page and tests.

      Returns Record<string, unknown>

      the LRU's figures, and the dirty, in-flight, handed-out and evicted-but-held counts

    • At most limit direct children of a realm's ou=users whose RDN value contains needle, asked asynchronously (directory_queries.js's uidContains, 2026-10-20, /portal/delegate). Each row is what this process holds for its key, or the store's row; asked is how many rows the store answered, so a caller can tell a full answer from one the limit cut short.

      Parameters

      • realmId: string

        the realm id

      • parentKey: string

        the realm's ou=users, normalised

      • needle: string

        the substring, lower-cased

      • limit: number

        the most rows

      Returns Promise<{ asked: number; rows: { entry: Entry; key: string }[] }>

      { rows, asked }

    • A Map-shaped view of one realm.

      Parameters

      • realmId: string

        the realm id

      Returns any

      the view

    • Walks a realm's entries at or under a base, lazily.

      Parameters

      • realmId: string

        the realm id

      • base: string

        the base's normalised DN, or '' for the whole realm

      • OptionalreadOnly: boolean

        true when the caller edits nothing it is handed

      Returns Generator<[string, Entry]>

      an iterator of [key, entry]

    • walk(), read-only, with every page asked asynchronously and the event loop given back between pages: a realm's entries at or under a base, lazily, so a consumer that stops (a size or time limit) pages no further.

      Parameters

      • realmId: string

        the realm id

      • base: string

        the base's normalised DN, or '' for the whole realm

      • Optionalcounter: { pages: number; rows: number }

        optional; pages and rows are added to as the store is asked, for a caller (or a test) that reports what it read

      Returns AsyncGenerator<[string, Entry]>

      an async iterator of [key, entry]

    • Reads the slots of some windowed keys from the store, asynchronously, and puts in the window those that nothing here changed meanwhile — absences included, as slotFor() holds them.

      Parameters

      • realmId: string

        the realm id

      • keys: string[]

        normalised DNs; resident or held keys are skipped

      Returns Promise<number>

      a promise of how many slots were put