func (p *processor) write(ctx context.Context, dirname string, groupedBundleData *correlation.GroupedBundleData) (err error) {
	ctx, endOperation := p.metrics.WriteOperation.With(ctx, &err, observation.Args{})
	defer endOperation(1, observation.Args{})

	writer, err := sqlitewriter.NewWriter(ctx, filepath.Join(dirname, "sqlite.db"))
	if err != nil {
		return err
	}
	defer func() {
		err = writer.Close(err)
	}()

	if err := writer.WriteMeta(ctx, groupedBundleData.Meta); err != nil {
		return errors.Wrap(err, "writer.WriteMeta")
	}
	if err := writer.WriteDocuments(ctx, groupedBundleData.Documents); err != nil {
		return errors.Wrap(err, "writer.WriteDocuments")
	}
	if err := writer.WriteResultChunks(ctx, groupedBundleData.ResultChunks); err != nil {
		return errors.Wrap(err, "writer.WriteResultChunks")
	}
	if err := writer.WriteDefinitions(ctx, groupedBundleData.Definitions); err != nil {
		return errors.Wrap(err, "writer.WriteDefinitions")
	}
	if err := writer.WriteReferences(ctx, groupedBundleData.References); err != nil {
		return errors.Wrap(err, "writer.WriteReferences")
	}

	return err
}
// write commits the correlated data to disk.
write commits the correlated data to disk.
// write commits the correlated data to disk .
func (p *processor) write(ctx context.Context, dirname string, groupedBundleData *correlation.GroupedBundleData) (err error) {
	ctx, endOperation := p.metrics.WriteOperation.With(ctx, &err, observation.Args{})
	defer endOperation(1, observation.Args{})
	writer, err := sqlitewriter.NewWriter(ctx, filepath.Join(dirname, "sqlite.db"))
	if err != nil {
		return err
	}
	defer func() {
		err = writer.Close(err)
	}()
	if err := writer.WriteMeta(ctx, groupedBundleData.Meta); err != nil {
		return errors.Wrap(err, "writer.WriteMeta")
	}
	if err := writer.WriteDocuments(ctx, groupedBundleData.Documents); err != nil {
		return errors.Wrap(err, "writer.WriteDocuments")
	}
	if err := writer.WriteResultChunks(ctx, groupedBundleData.ResultChunks); err != nil {
		return errors.Wrap(err, "writer.WriteResultChunks")
	}
	if err := writer.WriteDefinitions(ctx, groupedBundleData.Definitions); err != nil {
		return errors.Wrap(err, "writer.WriteDefinitions")
	}
	if err := writer.WriteReferences(ctx, groupedBundleData.References); err != nil {
		return errors.Wrap(err, "writer.WriteReferences")
	}
	return err
}
func ( p * processor ) write ( ctx context . Context , dirname string , groupedBundleData * correlation . GroupedBundleData ) ( err error ) { ctx , endOperation := p . metrics . WriteOperation . With ( ctx , & err , observation . Args { } ) defer endOperation ( 1 , observation . Args { } ) writer , err := sqlitewriter . NewWriter ( ctx , filepath . Join ( dirname , " " ) ) if err != nil { return err } defer func ( ) { err = writer . Close ( err ) } ( ) if err := writer . WriteMeta ( ctx , groupedBundleData . Meta ) ; err != nil { return errors . Wrap ( err , " " ) } if err := writer . WriteDocuments ( ctx , groupedBundleData . Documents ) ; err != nil { return errors . Wrap ( err , " " ) } if err := writer . WriteResultChunks ( ctx , groupedBundleData . ResultChunks ) ; err != nil { return errors . Wrap ( err , " " ) } if err := writer . WriteDefinitions ( ctx , groupedBundleData . Definitions ) ; err != nil { return errors . Wrap ( err , " " ) } if err := writer . WriteReferences ( ctx , groupedBundleData . References ) ; err != nil { return errors . Wrap ( err , " " ) } return err }
write commits the correlated data to disk.
write commits the correlated data to disk .