Line data Source code
1 : // Copyright 2022 The LevelDB-Go and Pebble 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 rangekey provides functionality for working with range keys. 6 : package rangekey 7 : 8 : import ( 9 : "github.com/cockroachdb/pebble/internal/keyspan" 10 : "github.com/cockroachdb/pebble/internal/rangekey" 11 : "github.com/cockroachdb/pebble/sstable" 12 : ) 13 : 14 : // Fragmenter exports the keyspan.Fragmenter type. 15 : type Fragmenter = keyspan.Fragmenter 16 : 17 : // Key exports the keyspan.Key type. 18 : type Key = keyspan.Key 19 : 20 : // Span exports the keyspan.Span type. 21 : type Span = keyspan.Span 22 : 23 : // IsRangeKey returns if this InternalKey is a range key. Alias for 24 : // rangekey.IsRangeKey. 25 0 : func IsRangeKey(ik sstable.InternalKey) bool { 26 0 : return rangekey.IsRangeKey(ik.Kind()) 27 0 : } 28 : 29 : // Decode decodes an InternalKey into a keyspan.Span, if it is a range key. If 30 : // keysDst is provided, keys will be appended to keysDst to reduce allocations. 31 1 : func Decode(ik sstable.InternalKey, val []byte, keysDst []keyspan.Key) (Span, error) { 32 1 : return rangekey.Decode(ik, val, keysDst) 33 1 : }