-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: feature/INT-355-storage-overhaul--sdk-core
Are you sure you want to change the base?
node: overhaul of database and storage [INT-355] #342
Conversation
bd1ca01
to
de49a7f
Compare
5ac6de3
to
efb9d91
Compare
de49a7f
to
16c9912
Compare
16c9912
to
23c058a
Compare
clientSetup.options.database?.enable && storage | ||
? { | ||
storage, | ||
reportRecordFactory: ReportBacktraceDatabaseRecordWithAttachmentsFactory.default(), |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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(), |
There was a problem hiding this comment.
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]); |
There was a problem hiding this comment.
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.
export interface BacktraceFileAttachmentFactory { | ||
create(filePath: string, name?: string): BacktraceFileAttachment; | ||
} |
There was a problem hiding this comment.
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) {} |
There was a problem hiding this comment.
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'>
Follow up to #341.
Adds required implementations for overhaul of database and storage.
Notable changes:
BacktraceStorageModuleFactory
to allow for overriding creation of storageAttachmentBacktraceDatabaseRecord
and its implementationsReportBacktraceDatabaseRecordWithAttachments
and its implementationsBacktraceFileAttachmentFactory