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

package spanset

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

Index

Package Files

batch.go spanset.go

func GetDBEngine Uses

func GetDBEngine(e engine.Reader, span roachpb.Span) engine.Reader

GetDBEngine recursively searches for the underlying rocksDB engine.

func NewBatch Uses

func NewBatch(b engine.Batch, spans *SpanSet) engine.Batch

NewBatch returns an engine.Batch that asserts access of the underlying Batch against the given SpanSet.

func NewReadWriter Uses

func NewReadWriter(rw engine.ReadWriter, spans *SpanSet) engine.ReadWriter

NewReadWriter returns an engine.ReadWriter that asserts access of the underlying ReadWriter against the given SpanSet.

type Iterator Uses

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

Iterator wraps an engine.Iterator and ensures that it can only be used to access spans in a SpanSet.

func NewIterator Uses

func NewIterator(iter engine.Iterator, spans *SpanSet) *Iterator

NewIterator constructs an iterator that verifies access of the underlying iterator against the given spans.

func (*Iterator) Close Uses

func (s *Iterator) Close()

Close is part of the engine.Iterator interface.

func (*Iterator) ComputeStats Uses

func (s *Iterator) ComputeStats(
    start, end engine.MVCCKey, nowNanos int64,
) (enginepb.MVCCStats, error)

ComputeStats is part of the engine.Iterator interface.

func (*Iterator) FindSplitKey Uses

func (s *Iterator) FindSplitKey(
    start, end, minSplitKey engine.MVCCKey, targetSize int64,
) (engine.MVCCKey, error)

FindSplitKey is part of the engine.Iterator interface.

func (*Iterator) Iterator Uses

func (s *Iterator) Iterator() engine.Iterator

Iterator returns the underlying engine.Iterator.

func (*Iterator) Key Uses

func (s *Iterator) Key() engine.MVCCKey

Key is part of the engine.Iterator interface.

func (*Iterator) MVCCGet Uses

func (s *Iterator) MVCCGet(
    key roachpb.Key, timestamp hlc.Timestamp, opts engine.MVCCGetOptions,
) (*roachpb.Value, *roachpb.Intent, error)

MVCCGet is part of the engine.Iterator interface.

func (*Iterator) MVCCScan Uses

func (s *Iterator) MVCCScan(
    start, end roachpb.Key, max int64, timestamp hlc.Timestamp, opts engine.MVCCScanOptions,
) (kvData []byte, numKVs int64, resumeSpan *roachpb.Span, intents []roachpb.Intent, err error)

MVCCScan is part of the engine.Iterator interface.

func (*Iterator) Next Uses

func (s *Iterator) Next()

Next is part of the engine.Iterator interface.

func (*Iterator) NextKey Uses

func (s *Iterator) NextKey()

NextKey is part of the engine.Iterator interface.

func (*Iterator) Prev Uses

func (s *Iterator) Prev()

Prev is part of the engine.Iterator interface.

func (*Iterator) PrevKey Uses

func (s *Iterator) PrevKey()

PrevKey is part of the engine.Iterator interface.

func (*Iterator) Seek Uses

func (s *Iterator) Seek(key engine.MVCCKey)

Seek is part of the engine.Iterator interface.

func (*Iterator) SeekReverse Uses

func (s *Iterator) SeekReverse(key engine.MVCCKey)

SeekReverse is part of the engine.Iterator interface.

func (*Iterator) SetUpperBound Uses

func (s *Iterator) SetUpperBound(key roachpb.Key)

SetUpperBound is part of the engine.Iterator interface.

func (*Iterator) Stats Uses

func (s *Iterator) Stats() engine.IteratorStats

Stats is part of the engine.Iterator interface.

func (*Iterator) UnsafeKey Uses

func (s *Iterator) UnsafeKey() engine.MVCCKey

UnsafeKey is part of the engine.Iterator interface.

func (*Iterator) UnsafeValue Uses

func (s *Iterator) UnsafeValue() []byte

UnsafeValue is part of the engine.Iterator interface.

func (*Iterator) Valid Uses

func (s *Iterator) Valid() (bool, error)

Valid is part of the engine.Iterator interface.

func (*Iterator) Value Uses

func (s *Iterator) Value() []byte

Value is part of the engine.Iterator interface.

func (*Iterator) ValueProto Uses

func (s *Iterator) ValueProto(msg protoutil.Message) error

ValueProto is part of the engine.Iterator interface.

type ReadWriter Uses

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

ReadWriter is used outside of the spanset package internally, in ccl.

func (ReadWriter) ApplyBatchRepr Uses

func (s ReadWriter) ApplyBatchRepr(repr []byte, sync bool) error

func (ReadWriter) Clear Uses

func (s ReadWriter) Clear(key engine.MVCCKey) error

func (ReadWriter) ClearIterRange Uses

func (s ReadWriter) ClearIterRange(iter engine.Iterator, start, end engine.MVCCKey) error

func (ReadWriter) ClearRange Uses

func (s ReadWriter) ClearRange(start, end engine.MVCCKey) error

func (ReadWriter) Close Uses

func (s ReadWriter) Close()

func (ReadWriter) Closed Uses

func (s ReadWriter) Closed() bool

func (ReadWriter) Get Uses

func (s ReadWriter) Get(key engine.MVCCKey) ([]byte, error)

func (ReadWriter) GetProto Uses

func (s ReadWriter) GetProto(
    key engine.MVCCKey, msg protoutil.Message,
) (bool, int64, int64, error)

func (ReadWriter) Iterate Uses

func (s ReadWriter) Iterate(
    start, end engine.MVCCKey, f func(engine.MVCCKeyValue) (bool, error),
) error

func (ReadWriter) LogData Uses

func (s ReadWriter) LogData(data []byte) error

func (ReadWriter) LogLogicalOp Uses

func (s ReadWriter) LogLogicalOp(
    op engine.MVCCLogicalOpType, details engine.MVCCLogicalOpDetails,
)

func (ReadWriter) Merge Uses

func (s ReadWriter) Merge(key engine.MVCCKey, value []byte) error

func (ReadWriter) NewIterator Uses

func (s ReadWriter) NewIterator(opts engine.IterOptions) engine.Iterator

func (ReadWriter) Put Uses

func (s ReadWriter) Put(key engine.MVCCKey, value []byte) error

func (ReadWriter) SingleClear Uses

func (s ReadWriter) SingleClear(key engine.MVCCKey) error

type SpanAccess Uses

type SpanAccess int

SpanAccess records the intended mode of access in SpanSet.

const (
    SpanReadOnly SpanAccess = iota
    SpanReadWrite
    NumSpanAccess
)

Constants for SpanAccess. Higher-valued accesses imply lower-level ones.

func (SpanAccess) String Uses

func (a SpanAccess) String() string

String returns a string representation of the SpanAccess.

type SpanScope Uses

type SpanScope int

SpanScope divides access types into local and global keys.

const (
    SpanGlobal SpanScope = iota
    SpanLocal
    NumSpanScope
)

Constants for span scopes.

func (SpanScope) String Uses

func (a SpanScope) String() string

String returns a string representation of the SpanScope.

type SpanSet Uses

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

SpanSet tracks the set of key spans touched by a command. The set is divided into subsets for access type (read-only or read/write) and key scope (local or global; used to facilitate use by the separate local and global latches).

func (*SpanSet) Add Uses

func (ss *SpanSet) Add(access SpanAccess, span roachpb.Span)

Add a span to the set.

func (*SpanSet) AssertAllowed Uses

func (ss *SpanSet) AssertAllowed(access SpanAccess, span roachpb.Span)

AssertAllowed calls checkAllowed and fatals if the access is not allowed.

func (*SpanSet) BoundarySpan Uses

func (ss *SpanSet) BoundarySpan(scope SpanScope) roachpb.Span

BoundarySpan returns a span containing all the spans with the given params.

func (*SpanSet) CheckAllowed Uses

func (ss *SpanSet) CheckAllowed(access SpanAccess, span roachpb.Span) error

CheckAllowed returns an error if the access is not allowed.

TODO(irfansharif): This does not currently work for spans that straddle across multiple added spans. Specifically a spanset with spans [a-c) and [b-d) added under read only and read write access modes respectively would fail at checking if read only access over the span [a-d) was requested. This is also a problem if the added spans were read only and the spanset wasn't already SortAndDedup-ed.

func (*SpanSet) GetSpans Uses

func (ss *SpanSet) GetSpans(access SpanAccess, scope SpanScope) []roachpb.Span

GetSpans returns a slice of spans with the given parameters.

func (*SpanSet) Len Uses

func (ss *SpanSet) Len() int

Len returns the total number of spans tracked across all accesses and scopes.

func (*SpanSet) Reserve Uses

func (ss *SpanSet) Reserve(access SpanAccess, scope SpanScope, n int)

Reserve space for N additional keys.

func (*SpanSet) SortAndDedup Uses

func (ss *SpanSet) SortAndDedup()

SortAndDedup sorts the spans in the SpanSet and removes any duplicates.

func (*SpanSet) String Uses

func (ss *SpanSet) String() string

String prints a string representation of the span set.

func (*SpanSet) Validate Uses

func (ss *SpanSet) Validate() error

Validate returns an error if any spans that have been added to the set are invalid.

Package spanset imports 11 packages (graph) and is imported by 5 packages. Updated 2019-08-31. Refresh now. Tools for package owners.