mirror of
https://github.com/wukko/cobalt.git
synced 2025-05-21 15:47:06 +02:00
lib/storage: add abstract storage class
This commit is contained in:
parent
e0ced00806
commit
dd507e1dcd
@ -1,11 +1,14 @@
|
||||
import { AbstractStorage } from "./storage";
|
||||
|
||||
const COBALT_PROCESSING_DIR = "cobalt-processing-data";
|
||||
|
||||
export class OPFSStorage {
|
||||
export class OPFSStorage extends AbstractStorage {
|
||||
#root;
|
||||
#handle;
|
||||
#io;
|
||||
|
||||
constructor(root: FileSystemDirectoryHandle, handle: FileSystemFileHandle, reader: FileSystemSyncAccessHandle) {
|
||||
super();
|
||||
this.#root = root;
|
||||
this.#handle = handle;
|
||||
this.#io = reader;
|
||||
|
15
web/src/lib/storage/storage.ts
Normal file
15
web/src/lib/storage/storage.ts
Normal file
@ -0,0 +1,15 @@
|
||||
export abstract class AbstractStorage {
|
||||
static init(): Promise<AbstractStorage> {
|
||||
throw "init() call on abstract implementation";
|
||||
}
|
||||
|
||||
static isAvailable(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
abstract res(): Promise<File>;
|
||||
abstract read(size: number, offset: number): Uint8Array;
|
||||
abstract write(data: Uint8Array | Int8Array, offset: number): Promise<number>;
|
||||
abstract destroy(): Promise<void>;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user