mirror of
https://github.com/morluto/rea
synced 2026-10-25 22:08:11 -04:00
refactor(resources): remove redundant helper exports and lease aliases
Keep ASAR header details and the Godot header parser module-local. Use the canonical lease types in Hopper consumers, including release-cache publication, while preserving acquisition and cleanup behavior.
This commit is contained in:
@@ -29,10 +29,8 @@ import { verifyDetachedPgpSignature } from "../process/DetachedPgpSignature.js";
|
||||
import { execFileOutput } from "../process/ExecFileOutput.js";
|
||||
import { PrivateRuntimeRoot } from "../process/PrivateRuntimeRoot.js";
|
||||
import { waitForAbortableDelay } from "../process/ProviderDeadline.js";
|
||||
import {
|
||||
acquireHopperReleaseCacheLease,
|
||||
type HopperTargetLease,
|
||||
} from "../process/HopperLease.js";
|
||||
import { acquireHopperReleaseCacheLease } from "../process/HopperLease.js";
|
||||
import type { OwnedLease } from "../process/OwnedLease.js";
|
||||
import {
|
||||
downloadHopperPackage,
|
||||
HOPPER_DOWNLOAD_BYTES,
|
||||
@@ -412,7 +410,7 @@ export class LinuxHopperPublisher {
|
||||
async #acquireCacheLease(
|
||||
digest: string,
|
||||
signal?: AbortSignal,
|
||||
): Promise<HopperTargetLease> {
|
||||
): Promise<OwnedLease> {
|
||||
const deadline = performance.now() + 120_000;
|
||||
const runId = randomUUID();
|
||||
let delay = 25;
|
||||
|
||||
@@ -59,7 +59,7 @@ export const asarHeaderAdmissionFailure = (
|
||||
});
|
||||
|
||||
/** Absolute archive prefix required to inspect a header under this admission. */
|
||||
export const asarHeaderProbeBytes = (admission: AsarHeaderAdmission): number =>
|
||||
const asarHeaderProbeBytes = (admission: AsarHeaderAdmission): number =>
|
||||
admission.maximumBytes + 8;
|
||||
|
||||
export interface AsarHeaderExtents {
|
||||
@@ -113,7 +113,7 @@ export type FinalAsarHeaderProbeObservation = Exclude<
|
||||
* observed archive size. This establishes byte extents only; JSON validity and
|
||||
* the ASAR header schema belong to the decoder at the interpretation boundary.
|
||||
*/
|
||||
export const parseAsarHeaderExtents = (
|
||||
const parseAsarHeaderExtents = (
|
||||
prefix: Uint8Array,
|
||||
archiveBytes?: number,
|
||||
): Result<Omit<AsarHeaderExtents, "archiveBytes">, ArtifactReaderFailure> => {
|
||||
|
||||
@@ -384,7 +384,7 @@ export class GodotPckArtifactReader implements ArtifactReader {
|
||||
}
|
||||
|
||||
/** Decode header fields once; unsupported content does not erase observed headers. */
|
||||
export const readGodotPckHeader = async (
|
||||
const readGodotPckHeader = async (
|
||||
handle: FileHandle,
|
||||
size: number,
|
||||
signal?: AbortSignal,
|
||||
|
||||
@@ -49,7 +49,7 @@ import {
|
||||
acquireHopperTargetLease,
|
||||
acquireLinuxHopperApplicationLease,
|
||||
} from "../process/HopperLease.js";
|
||||
import type { HopperTargetLease } from "../process/HopperLease.js";
|
||||
import type { OwnedLease } from "../process/OwnedLease.js";
|
||||
import {
|
||||
MAXIMUM_BRIDGE_MAX_REQUEST_BYTES,
|
||||
MINIMUM_BRIDGE_MAX_REQUEST_BYTES,
|
||||
@@ -367,7 +367,7 @@ export class HopperApplicationLauncher implements BridgeLauncher {
|
||||
readonly bootstrapPath: string;
|
||||
readonly loadedPath: string;
|
||||
readonly ownsProcessLifetime: boolean;
|
||||
readonly lease: HopperTargetLease | undefined;
|
||||
readonly lease: OwnedLease | undefined;
|
||||
}): Promise<
|
||||
Result<
|
||||
BridgeLaunch,
|
||||
@@ -497,7 +497,7 @@ export class HopperApplicationLauncher implements BridgeLauncher {
|
||||
|
||||
async #acquireLaunchLease(
|
||||
runId: string,
|
||||
): Promise<Result<HopperTargetLease | undefined, HopperStartError>> {
|
||||
): Promise<Result<OwnedLease | undefined, HopperStartError>> {
|
||||
const platform = this.dependencies.platform ?? process.platform;
|
||||
const applicationLease =
|
||||
platform === "linux" && usesLinuxDemo(this.options);
|
||||
|
||||
@@ -5,13 +5,8 @@ import {
|
||||
acquireOwnedLease,
|
||||
type LeaseAcquisition,
|
||||
type LeaseFailure,
|
||||
type OwnedLease,
|
||||
} from "./OwnedLease.js";
|
||||
|
||||
export type HopperTargetLease = OwnedLease;
|
||||
|
||||
export type HopperTargetLeaseAcquisition = LeaseAcquisition;
|
||||
|
||||
/** Shared private parent of Hopper lease sockets; it outlives individual sessions. */
|
||||
export const HOPPER_TARGET_LEASE_DIRECTORY = join(
|
||||
"/tmp",
|
||||
@@ -25,7 +20,7 @@ export const acquireHopperTargetLease = async (input: {
|
||||
readonly loaderArgs: readonly string[];
|
||||
readonly runId: string;
|
||||
readonly directory?: string;
|
||||
}): Promise<HopperTargetLeaseAcquisition> => {
|
||||
}): Promise<LeaseAcquisition> => {
|
||||
// Canonicalization is required for lease identity. A lexical fallback could
|
||||
// let two aliases reserve independent sockets for the same Hopper document.
|
||||
let targetPath: string;
|
||||
@@ -51,7 +46,7 @@ export const acquireHopperTargetLease = async (input: {
|
||||
export const acquireLinuxHopperApplicationLease = (input: {
|
||||
readonly runId: string;
|
||||
readonly directory?: string;
|
||||
}): Promise<HopperTargetLeaseAcquisition> =>
|
||||
}): Promise<LeaseAcquisition> =>
|
||||
acquireLease({ ...input, identity: { application: "linux-hopper-demo" } });
|
||||
|
||||
/** Serialize approved publication/repair of one canonical signed-package entry. */
|
||||
@@ -59,7 +54,7 @@ export const acquireHopperReleaseCacheLease = async (input: {
|
||||
readonly cacheDirectory: string;
|
||||
readonly launcherSha256: string;
|
||||
readonly runId: string;
|
||||
}): Promise<HopperTargetLeaseAcquisition> =>
|
||||
}): Promise<LeaseAcquisition> =>
|
||||
acquireLease({
|
||||
runId: input.runId,
|
||||
identity: {
|
||||
@@ -73,7 +68,7 @@ const acquireLease = async (input: {
|
||||
readonly identity: Readonly<Record<string, unknown>>;
|
||||
readonly runId: string;
|
||||
readonly directory?: string;
|
||||
}): Promise<HopperTargetLeaseAcquisition> =>
|
||||
}): Promise<LeaseAcquisition> =>
|
||||
acquireOwnedLease({
|
||||
identity: input.identity,
|
||||
runId: input.runId,
|
||||
|
||||
Reference in New Issue
Block a user