github.com/zuoyebang/bitalostable@v1.0.1-0.20240229032404-e3b99a834294/rangekey/rangekey.go (about) 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/zuoyebang/bitalostable/internal/keyspan" 10 "github.com/zuoyebang/bitalostable/internal/rangekey" 11 "github.com/zuoyebang/bitalostable/sstable" 12 ) 13 14 // Key exports the keyspan.Key type. 15 type Key = keyspan.Key 16 17 // Span exports the keyspan.Span type. 18 type Span = keyspan.Span 19 20 // IsRangeKey returns if this InternalKey is a range key. Alias for 21 // rangekey.IsRangeKey. 22 func IsRangeKey(ik sstable.InternalKey) bool { 23 return rangekey.IsRangeKey(ik.Kind()) 24 } 25 26 // Decode decodes an InternalKey into a keyspan.Span, if it is a range key. If 27 // keysDst is provided, keys will be appended to keysDst to reduce allocations. 28 func Decode(ik sstable.InternalKey, val []byte, keysDst []keyspan.Key) (Span, error) { 29 return rangekey.Decode(ik, val, keysDst) 30 }