Skip to content

Commit

Permalink
feat: add queue system to collection
Browse files Browse the repository at this point in the history
  • Loading branch information
IamSebastianDev committed Nov 26, 2022
1 parent b50e629 commit c754996
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/lib/Collection.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
/** @format */

import { __root } from '../utils';
import { __root, safeAsyncAbort } from '../utils';
import { Flotsam } from './Flotsam';
import { readdir, mkdir, rmdir, stat, readFile, writeFile } from 'node:fs/promises';
import { readdir, mkdir, rm, stat, readFile, writeFile } from 'node:fs/promises';
import { existsSync } from 'node:fs';
import { ObjectId } from './ObjectId';
import { Document } from './Document';
import { JSONDocument } from './JSONDocument';
import { resolve } from 'node:path';
import { Queue } from './Queue';
import type { Document, Rejector, FindOptions } from '../types';

export class Collection<T extends Record<string, unknown>> {
dir: string;
#files: string[] = [];
#documents: Map<ObjectId, Document<T>> = new Map();
#documents: Map<string, JSONDocument<T>> = new Map();
#queue: Queue = new Queue();
constructor(private ctx: Flotsam, private namespace: string) {
this.dir = resolve(ctx.root, this.namespace);

Expand Down

0 comments on commit c754996

Please sign in to comment.