Class: ResourceRental
resource-rental/resource-rental.ResourceRental
Combines an agreement, activity, exe unit and payment process into a single high-level abstraction.
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new ResourceRental(agreement
, storageProvider
, paymentProcess
, marketModule
, activityModule
, logger
, resourceRentalOptions?
): ResourceRental
Parameters
Name | Type |
---|---|
agreement | Agreement |
storageProvider | StorageProvider |
paymentProcess | AgreementPaymentProcess |
marketModule | MarketModule |
activityModule | ActivityModule |
logger | Logger |
resourceRentalOptions? | ResourceRentalOptions |
Returns
Defined in
src/resource-rental/resource-rental.ts:45
Properties
events
• Readonly
events: EventEmitter
<ResourceRentalEvents
, any
>
Defined in
src/resource-rental/resource-rental.ts:37
networkNode
• Optional
Readonly
networkNode: NetworkNode
Defined in
src/resource-rental/resource-rental.ts:38
agreement
• Readonly
agreement: Agreement
Defined in
src/resource-rental/resource-rental.ts:46
Methods
stopAndFinalize
▸ stopAndFinalize(signalOrTimeout?
): Promise
<void
>
Terminates the activity and agreement (stopping any ongoing work) and finalizes the payment process. Resolves when the rental will be fully terminated and all pending business operations finalized. If the rental is already finalized, it will resolve immediately.
Parameters
Name | Type | Description |
---|---|---|
signalOrTimeout? | number | AbortSignal | timeout in milliseconds or an AbortSignal that will be used to cancel the finalization process, especially the payment process. Please note that canceling the payment process may fail to comply with the terms of the agreement. If this method is called multiple times, it will return the same promise, ignoring the signal or timeout. |
Returns
Promise
<void
>
Defined in
src/resource-rental/resource-rental.ts:107
hasActivity
▸ hasActivity(): boolean
Returns
boolean
Defined in
src/resource-rental/resource-rental.ts:117
getExeUnit
▸ getExeUnit(signalOrTimeout?
): Promise
<ExeUnit
>
Creates an activity on the Provider, and returns a exe-unit that can be used to operate within the activity
Parameters
Name | Type | Description |
---|---|---|
signalOrTimeout? | number | AbortSignal | timeout in milliseconds or an AbortSignal that will be used to cancel the exe-unit request, especially when the exe-unit is in the process of starting, deploying and preparing the environment (including setup function) |
Returns
Promise
<ExeUnit
>
Defined in
src/resource-rental/resource-rental.ts:126
destroyExeUnit
▸ destroyExeUnit(): Promise
<void
>
Destroy previously created exe-unit. Please note that if ResourceRental is left without ExeUnit for some time (default 90s) the provider will terminate the Agreement and ResourceRental will be unuseble
Returns
Promise
<void
>
Defined in
src/resource-rental/resource-rental.ts:152
fetchAgreementState
▸ fetchAgreementState(): Promise
<"Proposal"
| "Pending"
| "Cancelled"
| "Rejected"
| "Approved"
| "Expired"
| "Terminated"
>
Returns
Promise
<"Proposal"
| "Pending"
| "Cancelled"
| "Rejected"
| "Approved"
| "Expired"
| "Terminated"
>
Defined in
Was this helpful?