-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create collection implementation
- Loading branch information
1 parent
e07a4b4
commit 60a857e
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
/** @format */ | ||
|
||
export { Flotsam } from './lib'; | ||
export type { Collection, ObjectId } from './lib'; | ||
export type { FlotsamInit, FlotsamEvent, Subscriber, Unsubscriber } from './types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** @format */ | ||
|
||
import { __root } from '../utils'; | ||
import fs from 'node:fs'; | ||
|
||
export class Collection<T extends Record<string, unknown>> { | ||
#dir: string; | ||
constructor(private namespace: string) { | ||
this.#dir = __root(this.namespace); | ||
|
||
process.on('SIGINT', async () => { | ||
await this.serialize(); | ||
}); | ||
|
||
process.on('SIGTERM', async () => { | ||
await this.serialize(); | ||
}); | ||
} | ||
|
||
get count() { | ||
return 0; | ||
} | ||
|
||
get entries() { | ||
return []; | ||
} | ||
|
||
async deserialize() {} | ||
async serialize() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/** @format */ | ||
|
||
export { Flotsam } from './Flotsam'; | ||
export { Collection } from './Collection'; | ||
export { ObjectId } from './ObjectId'; |