@holochain/tryorama
Version:
Toolset to manage Holochain conductors and facilitate running test scenarios
81 lines (80 loc) • 3.27 kB
TypeScript
import { DhtArc, DnaHash } from "@holochain/client";
import { PlayerApp } from "./scenario.js";
import { ConductorCell } from "./types.js";
/**
* A utility function to wait the given amount of time.
*
* @param milliseconds - The number of milliseconds to wait.
* @returns A promise that is resolved after the given amount of milliseconds.
*
* @public
*/
export declare const pause: (milliseconds: number) => Promise<unknown>;
/**
* A utility function to compare conductors' integrated DhtOps.
*
* @param conductors - Array of conductors.
* @param cellId - Cell id to compare integrated DhtOps from.
* @returns A promise that is resolved after conductors' Integrated DhtOps match.
*
* @public
*/
export declare const areDhtsSynced: (playerApps: PlayerApp[], dnaHash: DnaHash) => Promise<boolean>;
/**
* A utility function to compare conductors' integrated DhtOps.
*
* @param conductorCells - Array of ConductorCells
* @returns A promise that is resolved after conductors' Integrated DhtOps match.
*
* @public
*/
export declare const areConductorCellsDhtsSynced: (conductorCells: ConductorCell[]) => Promise<boolean>;
/**
* A utility function to wait until all conductors' DhtOps have been integrated,
* and are identical for a given DNA.
*
* @param players - Array of players.
* @param dnaHash - DNA hash to compare integrated DhtOps from.
* @param intervalMs - Interval to pause between comparisons (defaults to 500 milliseconds).
* @param timeoutMs - A timeout for the delay (defaults to 60000 milliseconds).
* @returns A promise that is resolved after all agents' DHT states match.
*
* @public
*/
export declare const dhtSync: (players: PlayerApp[], dnaHash: DnaHash, intervalMs?: number, timeoutMs?: number) => Promise<void>;
/**
* A utility function to wait until all conductors' integrated DhtOps are
* identical for a DNA.
*
* @param conductorCells - Array of ConductorCell.
* @param interval - Interval to pause between comparisons.
* @param timeout - A timeout for the delay (optional).
* @returns A promise that is resolved after all agents' DHT states match.
*
* @public
*/
export declare const conductorCellsDhtSync: (conductorCells: ConductorCell[], intervalMs: number, timeoutMs: number) => Promise<void>;
/**
* A utility function to wait until a player's storage arc matches a desired
* storage arc for a DNA
*
* @param player - A Player.
* @param dnaHash - The DNA to check the storage arc for.
* @param storageArc - The desired storage DhtArc to wait for.
* @param intervalMs - Interval between comparisons in milliseconds (default 500).
* @param timeoutMs - Timeout in milliseconds (default 40_000).
* @returns A promise that resolves when the player's storage arc matches; rejects on timeout.
*
* @public
*/
export declare const storageArc: (player: PlayerApp, dnaHash: DnaHash, storageArc: DhtArc, intervalMs?: number, timeoutMs?: number) => Promise<void>;
/**
* A utility function to get the storage arc for a given player and dna hash.
*
* @param player - A Player.
* @param dnaHash - The DNA to get the storage arc for.
* @returns A Promise containing the storage DhtArc
*
* @public
*/
export declare const getPlayerStorageArc: (player: PlayerApp, dnaHash: DnaHash) => Promise<DhtArc>;