Skip to content

node: overhaul of database and storage [INT-355] #342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: feature/INT-355-storage-overhaul--sdk-core
Choose a base branch
from

Conversation

perf2711
Copy link
Contributor

Follow up to #341.

Adds required implementations for overhaul of database and storage.

Notable changes:

  • add BacktraceStorageModuleFactory to allow for overriding creation of storage
  • add AttachmentBacktraceDatabaseRecord and its implementations
  • add ReportBacktraceDatabaseRecordWithAttachments and its implementations
  • add BacktraceFileAttachmentFactory

@perf2711 perf2711 requested a review from konraddysput June 27, 2025 10:08
@perf2711 perf2711 self-assigned this Jun 27, 2025
@perf2711 perf2711 added the enhancement New feature or request label Jun 27, 2025
@perf2711 perf2711 force-pushed the feature/INT-355-storage-overhaul--node branch from bd1ca01 to de49a7f Compare June 27, 2025 10:11
@perf2711 perf2711 force-pushed the feature/INT-355-storage-overhaul--sdk-core branch from 5ac6de3 to efb9d91 Compare June 27, 2025 12:19
@perf2711 perf2711 force-pushed the feature/INT-355-storage-overhaul--node branch from de49a7f to 16c9912 Compare June 27, 2025 12:20
@perf2711 perf2711 force-pushed the feature/INT-355-storage-overhaul--node branch from 16c9912 to 23c058a Compare June 27, 2025 12:38
clientSetup.options.database?.enable && storage
? {
storage,
reportRecordFactory: ReportBacktraceDatabaseRecordWithAttachmentsFactory.default(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move it to helper or some kind of function outside the constructor to keep it clean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what exactly, the default() function? why?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, the whole object setup for the database

clientSetup.options.database?.enable && storage
? {
storage,
reportRecordFactory: ReportBacktraceDatabaseRecordWithAttachmentsFactory.default(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, the whole object setup for the database

const report = converter.convert(JSON.parse(recordJson));
reports.push([recordPath, report]);
reports.push([recordName, report]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the model expects to store recordPath, however you're using here recordName. Type definition in L:330 needs to be updated, or we might have a bug here.

I think it would be better if we rename recordName to recordPath and keep using it in the rest of the places in the function.

Comment on lines +27 to +29
export interface BacktraceFileAttachmentFactory {
create(filePath: string, name?: string): BacktraceFileAttachment;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion - I thought we keep interfaces in the top of the file. Any objection on this?

}

export class NodeFsBacktraceFileAttachmentFactory implements BacktraceFileAttachmentFactory {
constructor(private readonly _fs: Pick<NodeFs, 'existsSync' | 'createReadStream'> = nodeFs) {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can export a type: Pick<NodeFs, 'existsSync' | 'createReadStream'>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants