@freedomofpress/webcat
    Preparing search index...

    A persistence interface for enrollment information and origin states.

    interface Database {
        nonOrigins: LRUSet<CacheKey<CachePartition>>;
        origins: LRUCache<CacheKey<CachePartition>, OriginState>;
        getBlockMeta(): Promise<BlockMeta | null>;
        getFQDNEnrollment(
            fqdn: string,
            cachePartition: CachePartition,
        ): Promise<Uint8Array<ArrayBufferLike>>;
        getLastChecked(): Promise<number | null>;
        getLastUpdated(): Promise<number | null>;
        listAllFQDNs(): Promise<string[]>;
        setLastChecked(): Promise<void>;
        setLastUpdated(): Promise<void>;
        updateList(
            leaves: readonly (readonly [string, string])[],
            meta: BlockMeta,
        ): Promise<void>;
    }

    Implemented by

    Index

    A partitioned LRU set of fully-qualified domain names not enrolled in WEBCAT.

    A partitioned LRU cache of origin states.

    • Reads an enrollment hash from the database.

      Parameters

      • fqdn: string

        The fully-qualified domain name whose enrollment hash to read.

      • cachePartition: CachePartition

        The cache partition to use for cache lookups.

      Returns Promise<Uint8Array<ArrayBufferLike>>

      A Promise that resolves to the locally persisted enrollment hash corresponding to fqdn.

    • Reads the timestamp of the most recent enrollment update attempt.

      Returns Promise<number | null>

      A Promise that resolves to a time in milliseconds.

    • Reads the timestamp of the most recent successful enrollment update.

      Returns Promise<number | null>

      A Promise that resolves to a time in milliseconds.

    • Reads fully-qualified domain names of enrolled origins from the database.

      Returns Promise<string[]>

      A Promise that resolves to an array of the FQDNs whose enrollment is persisted locally.

    • Persists current time as the time of the latest enrollment update attempt.

      Returns Promise<void>

    • Persists the current time as the time of the latest successful enrollment update.

      Returns Promise<void>

    • Updates the list of enrolled fully-qualified domain names.

      Parameters

      • leaves: readonly (readonly [string, string])[]
      • meta: BlockMeta

      Returns Promise<void>