UNPKG

@hashgraph/solo

Version:

An opinionated CLI tool to deploy and manage private Hedera Networks.

39 lines (38 loc) 1.58 kB
/** * SPDX-License-Identifier: Apache-2.0 */ import { type ListrTaskWrapper } from 'listr2'; import { type Lease } from './lease.js'; /** * A utility class for managing lease acquisition tasks in Listr2 based workflows. */ export declare class ListrLease { /** * The default number of attempts to try acquiring the lease before failing. */ static readonly DEFAULT_LEASE_ACQUIRE_ATTEMPTS = 10; /** * The title of the lease acquisition task used by Listr2. */ static readonly ACQUIRE_LEASE_TASK_TITLE = "Acquire lease"; /** * Prevents instantiation of this utility class. */ private constructor(); /** * Creates a new Listr2 task for acquiring a lease with retry logic. * @param lease - the lease to be acquired. * @param task - the parent task to which the lease acquisition task will be added. * @returns a new Listr2 task for acquiring a lease with retry logic. */ static newAcquireLeaseTask(lease: Lease, task: ListrTaskWrapper<any, any, any>): import("listr2").Listr<any, any, any>; /** * Acquires a lease with retry logic and appropriate Listr2 status updates. This method is called by the Listr2 task * created by the newAcquireLeaseTask() method. * * @param lease - the lease to be acquired. * @param task - the task to be updated with the lease acquisition status. * @throws LeaseAcquisitionError if the lease could not be acquired after the maximum number of attempts or an unexpected error occurred. */ private static acquireWithRetry; }