github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/keys/spans.go (about)

     1  // Copyright 2015 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  package keys
    12  
    13  import "github.com/cockroachdb/cockroach/pkg/roachpb"
    14  
    15  //go:generate go run gen_cpp_keys.go
    16  
    17  var (
    18  	// Meta1Span holds all first level addressing records.
    19  	Meta1Span = roachpb.Span{Key: roachpb.KeyMin, EndKey: Meta2Prefix}
    20  
    21  	// Meta2MaxSpan begins at key Meta2KeyMax with the last entry in the second
    22  	// level addressing keyspace. The rest of the span is always empty. We cannot
    23  	// split at this starting key or between it and MetaMax.
    24  	// - The first condition is explained and enforced in libroach/mvcc.cc.
    25  	// - The second condition is necessary because a split between Meta2KeyMax
    26  	//   and MetaMax would conflict with the use of Meta1KeyMax to hold the
    27  	//   descriptor for the range that spans the meta2/userspace boundary (see
    28  	//   case 3a in rangeAddressing). If splits were allowed in this span then
    29  	//   the descriptor for the ranges ending in this span would be stored AFTER
    30  	//   Meta1KeyMax, which would allow meta1 to get out of order.
    31  	Meta2MaxSpan = roachpb.Span{Key: Meta2KeyMax, EndKey: MetaMax}
    32  
    33  	// NodeLivenessSpan holds the liveness records for nodes in the cluster.
    34  	NodeLivenessSpan = roachpb.Span{Key: NodeLivenessPrefix, EndKey: NodeLivenessKeyMax}
    35  
    36  	// SystemConfigSpan is the range of system objects which will be gossiped.
    37  	//
    38  	// TODO(nvanbenschoten): references to this span need to be prefixed by
    39  	// tenant ID. This is tracked in #48184.
    40  	SystemConfigSpan = roachpb.Span{Key: SystemConfigSplitKey, EndKey: SystemConfigTableDataMax}
    41  
    42  	// NoSplitSpans describes the ranges that should never be split.
    43  	// Meta1Span: needed to find other ranges.
    44  	// Meta2MaxSpan: between meta and system ranges.
    45  	// NodeLivenessSpan: liveness information on nodes in the cluster.
    46  	// SystemConfigSpan: system objects which will be gossiped.
    47  	NoSplitSpans = []roachpb.Span{Meta1Span, Meta2MaxSpan, NodeLivenessSpan, SystemConfigSpan}
    48  )
    49  
    50  // Silence unused warnings. These variables are actually used by gen_cpp_keys.go.
    51  var _ = NoSplitSpans