Skip to content

Commit

Permalink
feat: begin refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
xCykrix committed Oct 15, 2024
1 parent e150333 commit e5f3d9b
Show file tree
Hide file tree
Showing 17 changed files with 460 additions and 535 deletions.
140 changes: 72 additions & 68 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export { Queue } from 'jsr:@cm-iv/queue@1.0.0';
export { delay } from 'jsr:@std/async@1.0.6/delay';
export { deepMerge as merge } from 'jsr:@cross/deepmerge@1.0.0';
8 changes: 0 additions & 8 deletions lib/interface/level.ts

This file was deleted.

7 changes: 0 additions & 7 deletions lib/interface/op.ts

This file was deleted.

39 changes: 39 additions & 0 deletions lib/interface/optiion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
export interface LedgerOptions {
/** Transport List */
workers: WorkerOptions[];

/** Control the respawn limitations. */
respawn?: {
/** The maximum number of restarts for an individual worker. */
limit: number;
/** The rolling window in ms to decrement the respawn counter. */
per: number;
};
}

export interface WorkerOptions {
/** Set the Worker Loading Mode. */
mode: 'jsr.io' | 'alternative';
/** Associated {@link TransportOptions}. */
options: TransportOptions;
/**
* The package to initialize. Approved JSR Types listed, but any string is allowed.
*
* Mode must be 'disk' to allow alternative packages.
*/
// deno-lint-ignore ban-types
package: ApprovedWorkers | string & {};
}

export interface TransportOptions {
/** Control the processing thread. */
queue?: {
/** The number of events to process concurrently. */
threadCount: number;
};
}

/** List of Approved Workers. Official or Approved Workers List for Auto Indexing. */
export type ApprovedWorkers =
| '@ledger/console-transport'
| '@ledger/file-transport';
43 changes: 0 additions & 43 deletions lib/interface/struct.ts

This file was deleted.

3 changes: 2 additions & 1 deletion lib/transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export class LedgerTransport {
*
* @abstract
*/
// deno-lint-ignore require-await
public async consume(payload: TransportHandleMessage): Promise<void> {
throw new Error(`Method not implemented when handling consume for '${payload.op}'.`);
throw new Error(`Method not implemented when handling consume for '${payload.op}'. This transport is incomplete.`);
}
}
Loading

0 comments on commit e5f3d9b

Please sign in to comment.