ceremonyclient/pebble/rangekey/rangekey.go
Cassandra Heart 2e2a1e4789
v1.2.0 (#31)
2024-01-03 01:31:42 -06:00

34 lines
1.1 KiB
Go

// Copyright 2022 The LevelDB-Go and Pebble Authors. All rights reserved. Use
// of this source code is governed by a BSD-style license that can be found in
// the LICENSE file.
// Package rangekey provides functionality for working with range keys.
package rangekey
import (
"github.com/cockroachdb/pebble/internal/keyspan"
"github.com/cockroachdb/pebble/internal/rangekey"
"github.com/cockroachdb/pebble/sstable"
)
// Fragmenter exports the keyspan.Fragmenter type.
type Fragmenter = keyspan.Fragmenter
// Key exports the keyspan.Key type.
type Key = keyspan.Key
// Span exports the keyspan.Span type.
type Span = keyspan.Span
// IsRangeKey returns if this InternalKey is a range key. Alias for
// rangekey.IsRangeKey.
func IsRangeKey(ik sstable.InternalKey) bool {
return rangekey.IsRangeKey(ik.Kind())
}
// Decode decodes an InternalKey into a keyspan.Span, if it is a range key. If
// keysDst is provided, keys will be appended to keysDst to reduce allocations.
func Decode(ik sstable.InternalKey, val []byte, keysDst []keyspan.Key) (Span, error) {
return rangekey.Decode(ik, val, keysDst)
}