github.com/zuoyebang/bitalostable@v1.0.1-0.20240229032404-e3b99a834294/merger.go (about)

     1  // Copyright 2018 The LevelDB-Go and Pebble and Bitalostored Authors. All rights reserved. Use
     2  // of this source code is governed by a BSD-style license that can be found in
     3  // the LICENSE file.
     4  
     5  package bitalostable
     6  
     7  import (
     8  	"io"
     9  
    10  	"github.com/zuoyebang/bitalostable/internal/base"
    11  )
    12  
    13  // Merge exports the base.Merge type.
    14  type Merge = base.Merge
    15  
    16  // Merger exports the base.Merger type.
    17  type Merger = base.Merger
    18  
    19  // ValueMerger exports the base.ValueMerger type.
    20  type ValueMerger = base.ValueMerger
    21  
    22  // DeletableValueMerger exports the base.DeletableValueMerger type.
    23  type DeletableValueMerger = base.DeletableValueMerger
    24  
    25  // DefaultMerger exports the base.DefaultMerger variable.
    26  var DefaultMerger = base.DefaultMerger
    27  
    28  func finishValueMerger(
    29  	valueMerger ValueMerger, includesBase bool,
    30  ) (value []byte, needDelete bool, closer io.Closer, err error) {
    31  	if valueMerger2, ok := valueMerger.(DeletableValueMerger); ok {
    32  		value, needDelete, closer, err = valueMerger2.DeletableFinish(includesBase)
    33  	} else {
    34  		value, closer, err = valueMerger.Finish(includesBase)
    35  	}
    36  	return
    37  }