@gati-framework/runtime
Version:
Gati runtime execution engine for running handler-based applications
138 lines • 3.73 kB
JavaScript
/**
* @module runtime/manifest-store
* @description Manifest Store with pluggable storage backend
*
* This implements Task 15 from the runtime architecture spec:
* - Manifest persistence (handlers and modules)
* - GType schema storage and retrieval
* - Version graph storage
* - Transformer stub storage
* - Timescape metadata persistence
* - Pluggable storage contract (Task 21 Phase 3)
*
* Requirements: 11.5
*/
import { createInMemoryStorage } from './storage/in-memory-storage.js';
/**
* Manifest Store implementation with pluggable storage backend
*
* Delegates all storage operations to a StorageContract implementation.
* Defaults to in-memory storage if no storage backend is provided.
*/
export class InMemoryManifestStore {
storage;
constructor(storage) {
this.storage = storage ?? createInMemoryStorage();
}
/**
* Store a handler or module manifest
*/
async storeManifest(manifest) {
return this.storage.storeManifest(manifest);
}
/**
* Retrieve a manifest by ID and optional version
*/
async getManifest(id, version) {
return this.storage.getManifest(id, version);
}
/**
* Get all versions of a manifest
*/
async getAllManifestVersions(id) {
return this.storage.getAllManifestVersions(id);
}
/**
* Store a GType schema
*/
async storeGType(gtype) {
return this.storage.storeGType(gtype);
}
/**
* Retrieve a GType schema by reference
*/
async getGType(ref) {
return this.storage.getGType(ref);
}
/**
* Store a transformer stub
*/
async storeTransformer(transformer) {
return this.storage.storeTransformer(transformer);
}
/**
* Retrieve a transformer by ID
*/
async getTransformer(id) {
return this.storage.getTransformer(id);
}
/**
* Get transformers for a version pair
*/
async getTransformersForVersions(handlerId, fromVersion, toVersion) {
return this.storage.getTransformersForVersions(handlerId, fromVersion, toVersion);
}
/**
* Store or update a version graph
*/
async storeVersionGraph(graph) {
return this.storage.storeVersionGraph(graph);
}
/**
* Retrieve a version graph for a handler
*/
async getVersionGraph(handlerId) {
return this.storage.getVersionGraph(handlerId);
}
/**
* Store Timescape metadata
*/
async storeTimescapeMetadata(metadata) {
return this.storage.storeTimescapeMetadata(metadata);
}
/**
* Retrieve Timescape metadata
*/
async getTimescapeMetadata(handlerId, version) {
return this.storage.getTimescapeMetadata(handlerId, version);
}
/**
* Store a hook manifest
*/
async storeHookManifest(manifest) {
return this.storage.storeHookManifest(manifest);
}
/**
* Retrieve a hook manifest by handler ID
*/
async getHookManifest(handlerId) {
return this.storage.getHookManifest(handlerId);
}
/**
* List all hook manifests
*/
async listHookManifests() {
return this.storage.listHookManifests();
}
/**
* Clear all stored data (for testing)
*/
async clear() {
return this.storage.clear();
}
/**
* Get store statistics
*/
getStats() {
return this.storage.getStats();
}
}
/**
* Create a new manifest store with optional storage backend
*
* @param storage - Optional storage backend (defaults to in-memory)
*/
export function createManifestStore(storage) {
return new InMemoryManifestStore(storage);
}
//# sourceMappingURL=manifest-store.js.map