Skip to content

Commit 592fb89

Browse files
committed
refactor: wip
1 parent 27b1506 commit 592fb89

File tree

2 files changed

+430
-6
lines changed

2 files changed

+430
-6
lines changed

packages/utils/src/lib/wal.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export function filterValidRecords<T>(
7070
/**
7171
* Pure helper function to recover records from WAL file content.
7272
* @param content - Raw file content as string
73-
* @param codec - Codec for decoding records
73+
* @param decode - function fo decoding records
7474
* @returns Recovery result with records, errors, and partial tail
7575
*/
7676
export function recoverFromContent<T>(
@@ -213,7 +213,7 @@ export class WriteAheadLogFile<T> implements AppendableSink<T> {
213213
* Format descriptor that binds codec and file extension together.
214214
* Prevents misconfiguration by keeping related concerns in one object.
215215
*/
216-
export type WalFormat<T> = {
216+
export type WalFormat<T extends object | string> = {
217217
/** Base name for the WAL (e.g., "trace") */
218218
baseName: string;
219219
/** Shard file extension (e.g., ".jsonl") */
@@ -267,8 +267,8 @@ export function parseWalFormat<T extends object | string = object>(
267267
walExtension = '.log',
268268
finalExtension = walExtension,
269269
codec = stringCodec<T>(),
270-
shardPath = (id: string) => `${baseName}.${id}.${walExtension}`,
271-
finalPath = () => `${baseName}.${finalExtension}`,
270+
shardPath = (id: string) => `${baseName}.${id}${walExtension}`,
271+
finalPath = () => `${baseName}${finalExtension}`,
272272
finalizer = (encodedRecords: (T | InvalidEntry<string>)[]) =>
273273
`${encodedRecords.join('\n')}\n`,
274274
} = format;

0 commit comments

Comments
 (0)