import { DeviceInfo } from '../types/device'; export interface ManagedInstall { instanceName: string; // Which Instance handling this install: DeviceInfo; updatedMillisecond: number; } export abstract class InstallStoreBase { /** * Get an install. * @param id obnizId */ public abstract get(id: string): Promise; /** * Get all installs specified in the ID array. */ public abstract getMany( ids: string[] ): Promise<{ [id: string]: ManagedInstall | undefined }>; /** * Get the Installs on a specific Worker. */ public abstract getByWorker( name: string ): Promise<{ [id: string]: ManagedInstall }>; /** * Get all the installs on the InstallStore. */ public abstract getAll(): Promise<{ [id: string]: ManagedInstall }>; /** * Automatically selects an optimal Slave and creates an Install. * @param id obnizId */ public abstract autoCreate( id: string, deviceInfo: DeviceInfo ): Promise; /** * Create an Install from the data. * @param id obnizId * @param install Install Data */ public abstract manualCreate( id: string, install: ManagedInstall ): Promise; /** * Update the Install data. * @param id obnizId * @param props Install Data */ public abstract update( id: string, props: Partial ): Promise; /** * Automatically relocates the Install. * @param id obnizId */ public abstract autoRelocate( id: string, force?: boolean ): Promise; /** * Remove Install. * @param id obnizId */ public abstract remove(id: string): Promise; }