cockroach: github.com/cockroachdb/cockroach/pkg/storage/rditer Index | Files

package rditer

import "github.com/cockroachdb/cockroach/pkg/storage/rditer"

Index

Package Files

replica_data_iter.go stats.go

func ComputeStatsForRange Uses

func ComputeStatsForRange(
    d *roachpb.RangeDescriptor, e engine.Reader, nowNanos int64,
) (enginepb.MVCCStats, error)

ComputeStatsForRange computes the stats for a given range by iterating over all key ranges for the given range that should be accounted for in its stats.

type KeyRange Uses

type KeyRange struct {
    Start, End engine.MVCCKey
}

KeyRange is a helper struct for the ReplicaDataIterator.

func MakeAllKeyRanges Uses

func MakeAllKeyRanges(d *roachpb.RangeDescriptor) []KeyRange

MakeAllKeyRanges returns all key ranges for the given Range.

func MakeRangeIDLocalKeyRange Uses

func MakeRangeIDLocalKeyRange(rangeID roachpb.RangeID, replicatedOnly bool) KeyRange

MakeRangeIDLocalKeyRange returns the range-id local key range. If replicatedOnly is true, then it returns only the replicated keys, otherwise, it only returns both the replicated and unreplicated keys.

func MakeRangeLocalKeyRange Uses

func MakeRangeLocalKeyRange(d *roachpb.RangeDescriptor) KeyRange

MakeRangeLocalKeyRange returns the range local key range. Range-local keys are replicated keys that do not belong to the range they would naturally sort into. For example, /Local/Range/Table/1 would sort into [/Min, /System), but it actually belongs to [/Table/1, /Table/2).

func MakeReplicatedKeyRanges Uses

func MakeReplicatedKeyRanges(d *roachpb.RangeDescriptor) []KeyRange

MakeReplicatedKeyRanges returns all key ranges that are fully Raft replicated for the given Range.

NOTE: The logic for receiving snapshot relies on this function returning the ranges in the following sorted order:

1. Replicated range-id local key range 2. Range-local key range 3. User key range

func MakeUserKeyRange Uses

func MakeUserKeyRange(d *roachpb.RangeDescriptor) KeyRange

MakeUserKeyRange returns the user key range.

type ReplicaDataIterator Uses

type ReplicaDataIterator struct {
    // contains filtered or unexported fields
}

ReplicaDataIterator provides a complete iteration over all key / value rows in a range, including all system-local metadata and user data. The ranges keyRange slice specifies the key ranges which comprise all of the range's data.

A ReplicaDataIterator provides a subset of the engine.Iterator interface.

TODO(tschottdorf): the API is awkward. By default, ReplicaDataIterator uses a byte allocator which needs to be reset manually using `ResetAllocator`. This is problematic as it requires of every user careful tracking of when to call that method; some just never call it and pull the whole replica into memory. Use of an allocator should be opt-in.

func NewReplicaDataIterator Uses

func NewReplicaDataIterator(
    d *roachpb.RangeDescriptor, e engine.Reader, replicatedOnly bool,
) *ReplicaDataIterator

NewReplicaDataIterator creates a ReplicaDataIterator for the given replica.

func (*ReplicaDataIterator) Close Uses

func (ri *ReplicaDataIterator) Close()

Close the underlying iterator.

func (*ReplicaDataIterator) Key Uses

func (ri *ReplicaDataIterator) Key() engine.MVCCKey

Key returns the current key.

func (*ReplicaDataIterator) Next Uses

func (ri *ReplicaDataIterator) Next()

Next advances to the next key in the iteration.

func (*ReplicaDataIterator) ResetAllocator Uses

func (ri *ReplicaDataIterator) ResetAllocator()

ResetAllocator resets the ReplicaDataIterator's internal byte allocator.

func (*ReplicaDataIterator) Valid Uses

func (ri *ReplicaDataIterator) Valid() (bool, error)

Valid returns true if the iterator currently points to a valid value.

func (*ReplicaDataIterator) Value Uses

func (ri *ReplicaDataIterator) Value() []byte

Value returns the current value.

Package rditer imports 5 packages (graph) and is imported by 3 packages. Updated 2019-08-24. Refresh now. Tools for package owners.