func (o *Options) diskSorter(l sortutil.Lesser, m disksort.Marshaler) (disksort.Interface, error) { return disksort.NewMergeSorter(disksort.MergeOptions{ Lesser: l, Marshaler: m, MaxInMemory: o.MaxShardSize, CompressShards: o.CompressShards, IOBufferSize: o.IOBufferSize, }) }
func sortEntries(rd stream.EntryReader) (stream.EntryReader, error) { sorter, err := disksort.NewMergeSorter(disksort.MergeOptions{ Lesser: entryLesser{}, Marshaler: entryMarshaler{}, }) if err != nil { return nil, fmt.Errorf("error creating entries sorter: %v", err) } if err := rd(func(e *spb.Entry) error { return sorter.Add(e) }); err != nil { return nil, fmt.Errorf("error sorting entries: %v", err) } return func(f func(*spb.Entry) error) error { return sorter.Read(func(i interface{}) error { return f(i.(*spb.Entry)) }) }, nil }
// KeyValueSorter returns a disksort for arbitrary *ipb.SortedKeyValues. func KeyValueSorter() (disksort.Interface, error) { return disksort.NewMergeSorter(disksort.MergeOptions{ Lesser: keyValueSortUtil{}, Marshaler: keyValueSortUtil{}, }) }