@hashgraph/solo
Version:
An opinionated CLI tool to deploy and manage private Hedera Networks.
86 lines (85 loc) • 3.69 kB
TypeScript
/**
* A representation of a leaseholder who is identified by a username, hostname, and process id (PID). This implementation
* is serializable to/from a JSON object and is comparable to other leaseholders.
*/
export declare class LockHolder {
/** The user's identity which is typically the OS login username. */
private readonly _username;
/** The machine's identity which is typically the hostname. */
private readonly _hostname;
/** The process identifier which is typically the OS PID. */
private readonly _processId;
/**
* Constructs a new leaseholder with the given username, hostname, and process id. This constructor is private and
* should not be called directly. Use the static factory methods to create a new instance.
*
* @param username - the user's identity.
* @param hostname - the machine's identity.
* @param processId - the process identifier.
*/
private constructor();
/**
* Creates a new leaseholder with the given username. The hostname is set to the current machine's hostname and the
* process id is set to the current process's PID.
* @param username - the user's identity.
* @returns a new leaseholder instance.
*/
static of(username: string): LockHolder;
/**
* Creates a new leaseholder by retrieving the current user's identity, the current machine's hostname, and the
* current process's PID.
* @returns a new leaseholder instance.
*/
static default(): LockHolder;
/**
* The user's identity which is typically the OS login username.
* @returns the user's identity.
*/
get username(): string;
/**
* The machine's identity which is typically the hostname.
* @returns the machine's identity.
*/
get hostname(): string;
/**
* The process identifier which is typically the OS PID.
* @returns the process identifier.
*/
get processId(): number;
/**
* Returns a plain object representation of this leaseholder. This object may be serialized to JSON.
* @returns a plain object representation of this leaseholder.
*/
toObject(): any;
/**
* Compares this leaseholder to another leaseholder to determine if they are equal. Two leaseholders are equal if
* their username, hostname, and process id are the same.
* @param other - the other leaseholder to compare.
* @returns true if the leaseholders are equal; false otherwise.
*/
equals(other: LockHolder): boolean;
/**
* Compares this leaseholder to another leaseholder to determine if they are the same machine. Two leaseholders are
* the same machine if their username and hostname are the same.
* @param other - the other leaseholder to compare.
* @returns true if the leaseholders are the same machine; false otherwise.
*/
isSameMachineIdentity(other: LockHolder): boolean;
/**
* Determines if the process associated with this leaseholder is still alive. This method will return false if the
* process is not alive or an error occurs while checking the process status.
* @returns true if the process is alive; false otherwise.
*/
isProcessAlive(): boolean;
/**
* Serializes this leaseholder to a JSON string representation.
* @returns a JSON string representation of this leaseholder.
*/
toJson(): string;
/**
* Deserializes a JSON string representation of a leaseholder into a new leaseholder instance.
* @param json - the JSON string representation of a leaseholder.
* @returns a new leaseholder instance.
*/
static fromJson(json: string): LockHolder;
}