/** * Directory-based lock that allows only one HTTP server process per app directory. */ export default class VelociousHttpServerLock { configuration: import("../configuration.js").default; host: string; port: number; lockPath: string; acquired: boolean; /** * Build a lock for the configured application directory and server endpoint. * @param {object} args - Options object. * @param {import("../configuration.js").default} args.configuration - Configuration that owns the application directory. * @param {string} args.host - Configured HTTP host. * @param {number} args.port - Configured HTTP port. */ constructor({ configuration, host, port }: { configuration: import("../configuration.js").default; host: string; port: number; }); /** * Acquires the app-directory HTTP server lock before startup side effects run. * @returns {Promise} - Resolves after the lock has been acquired. */ acquire(): Promise; /** * Tries to create the lock directory and write owner metadata. * @returns {Promise} - Whether the lock was acquired. */ tryAcquire(): Promise; /** * Releases the held HTTP server lock directory. * @returns {Promise} - Resolves after best-effort lock release. */ release(): Promise; /** * Writes metadata used to explain or reclaim an existing server lock. * @returns {Promise} - Resolves after owner metadata has been written. */ writeOwnerMetadata(): Promise; /** * Checks whether the current lock owner is a dead process on this host. * @returns {Promise} - Whether the existing lock belongs to a dead process. */ isStale(): Promise; /** * Runs is local process owner. * @param {Record> | null} owner - Existing lock owner metadata. * @returns {boolean} - Whether owner metadata names a local process. */ isLocalProcessOwner(owner: Record> | null): boolean; /** * Runs owner hostname matches. * @param {Record>} owner - Existing lock owner metadata. * @returns {boolean} - Whether the owner hostname is local or absent. */ ownerHostnameMatches(owner: Record>): boolean; /** * Runs process is dead. * @param {number} pid - Process id. * @returns {boolean} - Whether the process no longer exists. */ processIsDead(pid: number): boolean; /** * Reads owner metadata from an existing server lock directory. * @returns {Promise> | null>} - Parsed owner metadata, when readable. */ readOwnerMetadata(): Promise> | null>; /** * Builds a duplicate-server error message with owner details when available. * @returns {Promise} - Error message explaining which server owns the lock. */ lockHeldMessage(): Promise; } //# sourceMappingURL=server-lock.d.ts.map