mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-13 08:12:40 +10:00
feat: identify unused objects
This commit is contained in:
@ -152,6 +152,9 @@ export class FsObjectBackend extends ObjectBackend {
|
||||
await store.save(id, hashResult);
|
||||
return typeof hashResult;
|
||||
}
|
||||
async listAll(): Promise<string[]> {
|
||||
return fs.readdirSync(this.baseObjectPath);
|
||||
}
|
||||
}
|
||||
|
||||
class FsHashStore {
|
||||
|
||||
@ -65,6 +65,7 @@ export abstract class ObjectBackend {
|
||||
metadata: ObjectMetadata,
|
||||
): Promise<boolean>;
|
||||
abstract fetchHash(id: ObjectReference): Promise<string | undefined>;
|
||||
abstract listAll(): Promise<string[]>;
|
||||
}
|
||||
|
||||
export class ObjectHandler {
|
||||
@ -244,4 +245,11 @@ export class ObjectHandler {
|
||||
async deleteAsSystem(id: ObjectReference) {
|
||||
return await this.backend.delete(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* List all objects
|
||||
*/
|
||||
async listAll() {
|
||||
return await this.backend.listAll();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user