@@ -2535,29 +2535,38 @@ func (o *Options) Validate() error {
25352535// MakeReaderOptions constructs sstable.ReaderOptions from the corresponding
25362536// options in the receiver.
25372537func (o * Options ) MakeReaderOptions () sstable.ReaderOptions {
2538- var readerOpts sstable.ReaderOptions
2539- if o != nil {
2540- readerOpts . Comparer = o . Comparer
2541- readerOpts . Filters = o . Filters
2542- readerOpts . KeySchemas = o . KeySchemas
2543- readerOpts . LoadBlockSema = o . LoadBlockSema
2544- readerOpts . LoggerAndTracer = o . LoggerAndTracer
2545- readerOpts . Merger = o . Merger
2546- }
2547- return readerOpts
2538+ return sstable.ReaderOptions {
2539+ Comparer : o . Comparer ,
2540+ Filters : o . Filters ,
2541+ KeySchemas : o . KeySchemas ,
2542+ Merger : o . Merger ,
2543+ ReaderOptions : block. ReaderOptions {
2544+ LoadBlockSema : o . LoadBlockSema ,
2545+ LoggerAndTracer : o . LoggerAndTracer ,
2546+ },
2547+ }
25482548}
25492549
25502550// MakeWriterOptions constructs sstable.WriterOptions for the specified level
25512551// from the corresponding options in the receiver.
25522552func (o * Options ) MakeWriterOptions (level int , format sstable.TableFormat ) sstable.WriterOptions {
2553- var writerOpts sstable.WriterOptions
2554- writerOpts .TableFormat = format
2555- if o != nil {
2556- writerOpts .Comparer = o .Comparer
2557- if o .Merger != nil {
2558- writerOpts .MergerName = o .Merger .Name
2553+ writerOpts := sstable.WriterOptions {
2554+ TableFormat : format ,
2555+ Comparer : o .Comparer ,
2556+ BlockPropertyCollectors : o .BlockPropertyCollectors ,
2557+ AllocatorSizeClasses : o .AllocatorSizeClasses ,
2558+ NumDeletionsThreshold : o .Experimental .NumDeletionsThreshold ,
2559+ DeletionSizeRatioThreshold : o .Experimental .DeletionSizeRatioThreshold ,
2560+ }
2561+ if o .Merger != nil {
2562+ writerOpts .MergerName = o .Merger .Name
2563+ }
2564+ if o .KeySchema != "" {
2565+ var ok bool
2566+ writerOpts .KeySchema , ok = o .KeySchemas [o .KeySchema ]
2567+ if ! ok {
2568+ panic (fmt .Sprintf ("invalid schema %q" , redact .Safe (o .KeySchema )))
25592569 }
2560- writerOpts .BlockPropertyCollectors = o .BlockPropertyCollectors
25612570 }
25622571 if format >= sstable .TableFormatPebblev3 {
25632572 writerOpts .ShortAttributeExtractor = o .Experimental .ShortAttributeExtractor
@@ -2573,16 +2582,6 @@ func (o *Options) MakeWriterOptions(level int, format sstable.TableFormat) sstab
25732582 writerOpts .FilterPolicy = levelOpts .FilterPolicy
25742583 writerOpts .FilterType = levelOpts .FilterType
25752584 writerOpts .IndexBlockSize = levelOpts .IndexBlockSize
2576- if o .KeySchema != "" {
2577- var ok bool
2578- writerOpts .KeySchema , ok = o .KeySchemas [o .KeySchema ]
2579- if ! ok {
2580- panic (fmt .Sprintf ("invalid schema %q" , redact .Safe (o .KeySchema )))
2581- }
2582- }
2583- writerOpts .AllocatorSizeClasses = o .AllocatorSizeClasses
2584- writerOpts .NumDeletionsThreshold = o .Experimental .NumDeletionsThreshold
2585- writerOpts .DeletionSizeRatioThreshold = o .Experimental .DeletionSizeRatioThreshold
25862585 return writerOpts
25872586}
25882587
0 commit comments