@codesoul-co/hypha-core / modules/runtime/run-lease-store
- Package index:
@codesoul-co/hypha-core - Source:
packages/core/src/modules/runtime/run-lease-store.ts - Exports: 4
Using this module
Use the Run lease store module for persisting and reading data at this boundary. It exports 1 class, 2 functions, 1 interface.
Import from the package entrypoint
ts
import {
InMemoryRunLeaseStore,
runLeaseGuard,
runLeaseScopeKey,
} from '@codesoul-co/hypha-core';
import type {
InMemoryRunLeaseStoreOptions,
} 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 2 functions as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.
Public exports
| Symbol | Kind | Signature | Description |
|---|---|---|---|
InMemoryRunLeaseStore | class | new InMemoryRunLeaseStore(options?: InMemoryRunLeaseStoreOptions): InMemoryRunLeaseStore | In Memory Run Lease Store class with 7 public constructor or member entries; its exact declarations are listed below. |
runLeaseGuard | function | runLeaseGuard(lease: FencedRunLease): { leaseId: string; ownerId: string; fencingToken: number; } | Run Lease Guard function with 1 public call signature; parameters and return types are listed below. |
runLeaseScopeKey | function | runLeaseScopeKey(scope: RunLeaseScope): string | Run Lease Scope Key function with 1 public call signature; parameters and return types are listed below. |
InMemoryRunLeaseStoreOptions | interface | interface InMemoryRunLeaseStoreOptions | In Memory Run Lease Store Options interface with 1 public fields or methods. |
InMemoryRunLeaseStore
In Memory Run Lease Store class with 7 public constructor or member entries; its exact declarations are listed below.
- Kind: class
- Import:
import { InMemoryRunLeaseStore } from '@codesoul-co/hypha-core'; - Source module:
modules/runtime/run-lease-store
Declaration
text
export declare class InMemoryRunLeaseStore implements RunLeaseStore {
constructor(options?: InMemoryRunLeaseStoreOptions);
acquire(request: RunLeaseAcquireRequest): Promise<FencedRunLease | null>;
preempt(request: RunLeasePreemptRequest): Promise<FencedRunLease>;
heartbeat(request: RunLeaseHeartbeatRequest): Promise<FencedRunLease>;
release(request: RunLeaseReleaseRequest): Promise<void>;
get(scope: RunLeaseScope, checkedAt?: string): Promise<FencedRunLease | null>;
assertCurrent(request: RunLeaseAssertionRequest): Promise<FencedRunLease>;
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
acquire | method | acquire(request: RunLeaseAcquireRequest): Promise<FencedRunLease | null> | Public method; parameters and return type are shown in the signature. |
assertCurrent | method | assertCurrent(request: RunLeaseAssertionRequest): Promise<FencedRunLease> | Public method; parameters and return type are shown in the signature. |
constructor | constructor | (options?: InMemoryRunLeaseStoreOptions): InMemoryRunLeaseStore | Creates an instance of this class. |
get | method | get(scope: RunLeaseScope, checkedAt?: string): Promise<FencedRunLease | null> | Public method; parameters and return type are shown in the signature. |
heartbeat | method | heartbeat(request: RunLeaseHeartbeatRequest): Promise<FencedRunLease> | Public method; parameters and return type are shown in the signature. |
preempt | method | preempt(request: RunLeasePreemptRequest): Promise<FencedRunLease> | Public method; parameters and return type are shown in the signature. |
release | method | release(request: RunLeaseReleaseRequest): Promise<void> | Public method; parameters and return type are shown in the signature. |
runLeaseGuard
Run Lease Guard function with 1 public call signature; parameters and return types are listed below.
- Kind: function
- Import:
import { runLeaseGuard } from '@codesoul-co/hypha-core'; - Source module:
modules/runtime/run-lease-store
Declaration
text
export declare function runLeaseGuard(lease: FencedRunLease): {
leaseId: string;
ownerId: string;
fencingToken: number;
};Call signature
text
runLeaseGuard(lease: FencedRunLease): { leaseId: string; ownerId: string; fencingToken: number; }Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
lease | FencedRunLease | Yes | Required parameter; accepted values are defined by the type column. |
Returns
- Type:
{ leaseId: string; ownerId: string; fencingToken: number; } - Description: The return contract is defined by the type shown above.
runLeaseScopeKey
Run Lease Scope Key function with 1 public call signature; parameters and return types are listed below.
- Kind: function
- Import:
import { runLeaseScopeKey } from '@codesoul-co/hypha-core'; - Source module:
modules/runtime/run-lease-store
Declaration
text
export declare function runLeaseScopeKey(scope: RunLeaseScope): string;Call signature
text
runLeaseScopeKey(scope: RunLeaseScope): stringParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
scope | RunLeaseScope | Yes | Required parameter; accepted values are defined by the type column. |
Returns
- Type:
string - Description: The return contract is defined by the type shown above.
InMemoryRunLeaseStoreOptions
In Memory Run Lease Store Options interface with 1 public fields or methods.
- Kind: interface
- Import:
import type { InMemoryRunLeaseStoreOptions } from '@codesoul-co/hypha-core'; - Source module:
modules/runtime/run-lease-store
Declaration
text
export interface InMemoryRunLeaseStoreOptions {
now?: () => string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
now | method | now?(): string | Public method; parameters and return type are shown in the signature. |
