Skip to content

@codesoul-co/hypha-core / modules/runtime/resource-coordinator

Using this module

Use the Resource coordinator module for executing runtime behavior at this boundary. It exports 1 class, 1 function, 1 interface.

Import from the package entrypoint

ts
import {
  InMemoryRuntimeResourceCoordinator,
  resourceClaimGuard,
} from '@codesoul-co/hypha-core';

import type {
  InMemoryRuntimeResourceCoordinatorOptions,
} from '@codesoul-co/hypha-core';

Usage patterns

  • Use the 1 type/interface export as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.
  • The module exposes 1 class as constructable runtime implementations. Each symbol entry lists its constructor and public methods.
  • The module exposes 1 function as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.

Public exports

SymbolKindSignatureDescription
InMemoryRuntimeResourceCoordinatorclassnew InMemoryRuntimeResourceCoordinator(options: InMemoryRuntimeResourceCoordinatorOptions): InMemoryRuntimeResourceCoordinatorIn Memory Runtime Resource Coordinator class with 6 public constructor or member entries; its exact declarations are listed below.
resourceClaimGuardfunctionresourceClaimGuard(claim: RuntimeResourceClaim): { claimId: string; ownerId: string; fencingToken: number; }Resource Claim Guard function with 1 public call signature; parameters and return types are listed below.
InMemoryRuntimeResourceCoordinatorOptionsinterfaceinterface InMemoryRuntimeResourceCoordinatorOptionsIn Memory Runtime Resource Coordinator Options interface with 1 public fields or methods.

InMemoryRuntimeResourceCoordinator

In Memory Runtime Resource Coordinator class with 6 public constructor or member entries; its exact declarations are listed below.

Declaration

text
export declare class InMemoryRuntimeResourceCoordinator implements RuntimeResourceCoordinator {
    constructor(options: InMemoryRuntimeResourceCoordinatorOptions);
    acquire(request: ResourceAcquireRequest): Promise<RuntimeResourceClaim[]>;
    renew(request: ResourceRenewRequest): Promise<RuntimeResourceClaim[]>;
    release(request: ResourceReleaseRequest): Promise<void>;
    list(request: ResourceListRequest): Promise<RuntimeResourceClaim[]>;
    assertCurrent(request: ResourceClaimAssertionRequest): Promise<RuntimeResourceClaim>;
}

Public members

MemberKindSignatureDescription
acquiremethodacquire(request: ResourceAcquireRequest): Promise<RuntimeResourceClaim[]>Public method; parameters and return type are shown in the signature.
assertCurrentmethodassertCurrent(request: ResourceClaimAssertionRequest): Promise<RuntimeResourceClaim>Public method; parameters and return type are shown in the signature.
constructorconstructor(options: InMemoryRuntimeResourceCoordinatorOptions): InMemoryRuntimeResourceCoordinatorCreates an instance of this class.
listmethodlist(request: ResourceListRequest): Promise<RuntimeResourceClaim[]>Public method; parameters and return type are shown in the signature.
releasemethodrelease(request: ResourceReleaseRequest): Promise<void>Public method; parameters and return type are shown in the signature.
renewmethodrenew(request: ResourceRenewRequest): Promise<RuntimeResourceClaim[]>Public method; parameters and return type are shown in the signature.

resourceClaimGuard

Resource Claim Guard function with 1 public call signature; parameters and return types are listed below.

Declaration

text
export declare function resourceClaimGuard(claim: RuntimeResourceClaim): {
    claimId: string;
    ownerId: string;
    fencingToken: number;
};

Call signature

text
resourceClaimGuard(claim: RuntimeResourceClaim): { claimId: string; ownerId: string; fencingToken: number; }

Parameters

ParameterTypeRequiredDescription
claimRuntimeResourceClaimYesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: { claimId: string; ownerId: string; fencingToken: number; }
  • Description: The return contract is defined by the type shown above.

InMemoryRuntimeResourceCoordinatorOptions

In Memory Runtime Resource Coordinator Options interface with 1 public fields or methods.

Declaration

text
export interface InMemoryRuntimeResourceCoordinatorOptions {
    runLeaseStore: Pick<RunLeaseStore, 'assertCurrent'>;
}

Contract members

MemberKindSignatureDescription
runLeaseStorepropertyrunLeaseStore: Pick<RunLeaseStore, "assertCurrent">Public property; its type, readonly modifier and optionality are shown in the signature.