Skip to content

Commit cafb179

Browse files
committed
rangedel: expose Fragmenter and Decode
Add a new `rangedel` package and define some aliases that can be used from outside Pebble, similar to the `rangekey` package.
1 parent 8bf6345 commit cafb179

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

rangedel/rangedel.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2025 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 rangedel provides functionality for working with range deletions.
6+
package rangedel
7+
8+
import (
9+
"github.com/cockroachdb/pebble/internal/keyspan"
10+
"github.com/cockroachdb/pebble/internal/rangedel"
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+
// Decode decodes an InternalKey representing a range deletion into a Span. If
24+
// keysDst is provided, keys will be appended to keysDst to reduce allocations.
25+
func Decode(ik sstable.InternalKey, val []byte, keysDst []Key) Span {
26+
return rangedel.Decode(ik, val, keysDst)
27+
}

rangekey/rangekey.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ func IsRangeKey(ik sstable.InternalKey) bool {
2626
return rangekey.IsRangeKey(ik.Kind())
2727
}
2828

29-
// Decode decodes an InternalKey into a keyspan.Span, if it is a range key. If
29+
// Decode decodes an InternalKey into a Span, if it is a range key. If
3030
// keysDst is provided, keys will be appended to keysDst to reduce allocations.
31-
func Decode(ik sstable.InternalKey, val []byte, keysDst []keyspan.Key) (Span, error) {
31+
func Decode(ik sstable.InternalKey, val []byte, keysDst []Key) (Span, error) {
3232
return rangekey.Decode(ik, val, keysDst)
3333
}

0 commit comments

Comments
 (0)