@@ -230,7 +230,7 @@ func (v VendorDataExporter) condition() *sqlutil.QueryConditionSet {
230230 return cond
231231}
232232
233- // CSV exports data to w.
233+ // CSV writes vendor data records to w.
234234func (v VendorDataExporter ) CSV (ctx context.Context , w io.Writer , header bool ) error {
235235 q := sqlutil .Select (
236236 "vendor.version AS version" ,
@@ -306,7 +306,7 @@ func (v VendorDataExporter) CSV(ctx context.Context, w io.Writer, header bool) e
306306 return nil
307307}
308308
309- // JSON exports NVD CVE JSON to w.
309+ // JSON writes NVD CVE JSON to w.
310310func (v VendorDataExporter ) JSON (ctx context.Context , w io.Writer , indent string ) error {
311311 q := sqlutil .Select (
312312 "cve_id" ,
@@ -361,9 +361,12 @@ func (v VendorDataExporter) JSON(ctx context.Context, w io.Writer, indent string
361361
362362// VendorDataTrimmer is a helper for trimming vendor data.
363363//
364+ // It deletes all versions but the latest.
365+ //
364366// Deleting would be easier in common scenarions, but we have some hard
365367// constraints:
366368//
369+ // * Vendor data is versioned
367370// * No foreign key between vendor_data and vendor tables
368371// * MySQL in safe mode forbids deleting from SELECT queries, wants values
369372// * Must keep the binlog smaller than 500M, not enough for the NVD database
@@ -372,9 +375,9 @@ func (v VendorDataExporter) JSON(ctx context.Context, w io.Writer, indent string
372375//
373376// * Select versions from the vendor table based on the provided settings
374377// * Operate on vendor records with ready=true or older versions
375- // * By default, delete all versions but the latest for each provider
378+ // * By default, delete all versions but the latest, for each provider
376379// * Delete from vendor table first, effectively making data records orphans
377- // * Delete any orphan records from vendor_data, effectively crow sourcing deletions
380+ // * Delete any orphan records from vendor_data, effectively crowd sourcing deletions
378381// * Delete data in chunks, keeping binlog small
379382//
380383// Deletion operations are expensive.
0 commit comments