config

package
v0.0.0-...-005594a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2017 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package config is a generated protocol buffer package.

It is generated from these files:

cockroach/pkg/config/config.proto

It has these top-level messages:

GCPolicy
Constraint
Constraints
ZoneConfig
SystemConfig

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthConfig = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowConfig   = fmt.Errorf("proto: integer overflow")
)
View Source
var Constraint_Type_name = map[int32]string{
	0: "POSITIVE",
	1: "REQUIRED",
	2: "PROHIBITED",
}
View Source
var Constraint_Type_value = map[string]int32{
	"POSITIVE":   0,
	"REQUIRED":   1,
	"PROHIBITED": 2,
}
View Source
var StaticSplits = []struct {
	SplitPoint roachpb.RKey
	SplitKey   roachpb.RKey
}{

	{
		SplitPoint: roachpb.RKey(keys.SystemPrefix),
		SplitKey:   roachpb.RKey(keys.SystemPrefix),
	},

	{
		SplitPoint: roachpb.RKey(keys.TimeseriesPrefix),
		SplitKey:   roachpb.RKey(keys.TimeseriesPrefix),
	},

	{
		SplitPoint: roachpb.RKey(keys.TimeseriesPrefix.PrefixEnd()),
		SplitKey:   roachpb.RKey(keys.TimeseriesPrefix.PrefixEnd()),
	},

	{
		SplitPoint: roachpb.RKey(keys.TableDataMin),
		SplitKey:   keys.SystemConfigSplitKey,
	},
}

StaticSplits is the list of pre-defined split points in the beginning of the keyspace that are there to support separate zone configs for different parts of the system / system config ranges. Exposed publicly so that its ordering can be tested.

View Source
var (

	// ZoneConfigHook is a function used to lookup a zone config given a table
	// or database ID.
	// This is also used by testing to simplify fake configs.
	ZoneConfigHook zoneConfigHook
)

Functions

func ObjectIDForKey

func ObjectIDForKey(key roachpb.RKey) (uint32, bool)

ObjectIDForKey returns the object ID (table or database) for 'key', or (_, false) if not within the structured key space.

func TestingSetDefaultZoneConfig

func TestingSetDefaultZoneConfig(cfg ZoneConfig) func()

TestingSetDefaultZoneConfig is a testing-only function that changes the default zone config and returns a function that reverts the change.

func TestingSetZoneConfig

func TestingSetZoneConfig(id uint32, zone ZoneConfig)

TestingSetZoneConfig sets the zone config entry for object 'id' in the testing map.

func TestingSetupZoneConfigHook

func TestingSetupZoneConfigHook(stopper *stop.Stopper)

TestingSetupZoneConfigHook initializes the zone config hook to 'testingZoneConfigHook' which uses 'testingZoneConfig'. Settings go back to their previous values when the stopper runs our closer.

Types

type Constraint

type Constraint struct {
	Type Constraint_Type `protobuf:"varint,1,opt,name=type,enum=cockroach.config.Constraint_Type" json:"type"`
	// Key is only set if this is a constraint on locality.
	Key string `protobuf:"bytes,2,opt,name=key" json:"key"`
	// Value to constrain to.
	Value string `protobuf:"bytes,3,opt,name=value" json:"value"`
}

Constraint constrains the stores a replica can be stored on.

func (*Constraint) Descriptor

func (*Constraint) Descriptor() ([]byte, []int)

func (*Constraint) FromString

func (c *Constraint) FromString(short string) error

FromString populates the constraint from the constraint shorthand notation.

func (*Constraint) Marshal

func (m *Constraint) Marshal() (dAtA []byte, err error)

func (*Constraint) MarshalTo

func (m *Constraint) MarshalTo(dAtA []byte) (int, error)

func (*Constraint) ProtoMessage

func (*Constraint) ProtoMessage()

func (*Constraint) Reset

func (m *Constraint) Reset()

func (*Constraint) Size

func (m *Constraint) Size() (n int)

func (Constraint) String

func (c Constraint) String() string

func (*Constraint) Unmarshal

func (m *Constraint) Unmarshal(dAtA []byte) error

type Constraint_Type

type Constraint_Type int32
const (
	// POSITIVE will attempt to ensure all stores the replicas are on has this
	// constraint.
	Constraint_POSITIVE Constraint_Type = 0
	// REQUIRED is like POSITIVE except replication will fail if not satisfied.
	Constraint_REQUIRED Constraint_Type = 1
	// PROHIBITED will prevent replicas from having this key, value.
	Constraint_PROHIBITED Constraint_Type = 2
)

func (Constraint_Type) Enum

func (x Constraint_Type) Enum() *Constraint_Type

func (Constraint_Type) EnumDescriptor

func (Constraint_Type) EnumDescriptor() ([]byte, []int)

func (Constraint_Type) String

func (x Constraint_Type) String() string

func (*Constraint_Type) UnmarshalJSON

func (x *Constraint_Type) UnmarshalJSON(data []byte) error

type Constraints

type Constraints struct {
	Constraints []Constraint `protobuf:"bytes,6,rep,name=constraints" json:"constraints"`
}

Constraints is a collection of constraints.

func (*Constraints) Descriptor

func (*Constraints) Descriptor() ([]byte, []int)

func (*Constraints) Marshal

func (m *Constraints) Marshal() (dAtA []byte, err error)

func (*Constraints) MarshalTo

func (m *Constraints) MarshalTo(dAtA []byte) (int, error)

func (Constraints) MarshalYAML

func (c Constraints) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (*Constraints) ProtoMessage

func (*Constraints) ProtoMessage()

func (*Constraints) Reset

func (m *Constraints) Reset()

func (*Constraints) Size

func (m *Constraints) Size() (n int)

func (*Constraints) String

func (m *Constraints) String() string

func (*Constraints) Unmarshal

func (m *Constraints) Unmarshal(dAtA []byte) error

func (*Constraints) UnmarshalYAML

func (c *Constraints) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type GCPolicy

type GCPolicy struct {
	// TTLSeconds specifies the maximum age of a value before it's
	// garbage collected. Only older versions of values are garbage
	// collected. Specifying <=0 mean older versions are never GC'd.
	TTLSeconds int32 `protobuf:"varint,1,opt,name=ttl_seconds,json=ttlSeconds" json:"ttl_seconds"`
}

GCPolicy defines garbage collection policies which apply to MVCC values within a zone.

TODO(spencer): flesh this out to include maximum number of values

as well as whether there's an intersection between max values
and TTL or a union.

func (*GCPolicy) Descriptor

func (*GCPolicy) Descriptor() ([]byte, []int)

func (*GCPolicy) Marshal

func (m *GCPolicy) Marshal() (dAtA []byte, err error)

func (*GCPolicy) MarshalTo

func (m *GCPolicy) MarshalTo(dAtA []byte) (int, error)

func (*GCPolicy) ProtoMessage

func (*GCPolicy) ProtoMessage()

func (*GCPolicy) Reset

func (m *GCPolicy) Reset()

func (*GCPolicy) Size

func (m *GCPolicy) Size() (n int)

func (*GCPolicy) String

func (m *GCPolicy) String() string

func (*GCPolicy) Unmarshal

func (m *GCPolicy) Unmarshal(dAtA []byte) error

type SystemConfig

type SystemConfig struct {
	Values []cockroach_roachpb1.KeyValue `protobuf:"bytes,1,rep,name=values" json:"values"`
}

func (SystemConfig) ComputeSplitKey

func (s SystemConfig) ComputeSplitKey(startKey, endKey roachpb.RKey) roachpb.RKey

ComputeSplitKey takes a start and end key and returns the first key at which to split the span [start, end). Returns nil if no splits are required.

Splits are required between user tables (i.e. /table/<id>), at the start of the system-config tables (i.e. /table/0), and at certain points within the system ranges that come before the system tables. The system-config range is somewhat special in that it can contain multiple SQL tables (/table/0-/table/<max-system-config-desc>) within a single range.

func (*SystemConfig) Descriptor

func (*SystemConfig) Descriptor() ([]byte, []int)

func (SystemConfig) Equal

func (s SystemConfig) Equal(other SystemConfig) bool

Equal checks for equality.

It assumes that s.Values and other.Values are sorted in key order.

func (SystemConfig) GetIndex

func (s SystemConfig) GetIndex(key roachpb.Key) (int, bool)

GetIndex searches the kv list for 'key' and returns its index if found.

func (SystemConfig) GetLargestObjectID

func (s SystemConfig) GetLargestObjectID(maxID uint32) (uint32, error)

GetLargestObjectID returns the largest object ID found in the config which is less than or equal to maxID. If maxID is 0, returns the largest ID in the config.

func (SystemConfig) GetValue

func (s SystemConfig) GetValue(key roachpb.Key) *roachpb.Value

GetValue searches the kv list for 'key' and returns its roachpb.Value if found.

func (SystemConfig) GetZoneConfigForKey

func (s SystemConfig) GetZoneConfigForKey(key roachpb.RKey) (ZoneConfig, error)

GetZoneConfigForKey looks up the zone config for the range containing 'key'. It is the caller's responsibility to ensure that the range does not need to be split.

func (*SystemConfig) Marshal

func (m *SystemConfig) Marshal() (dAtA []byte, err error)

func (*SystemConfig) MarshalTo

func (m *SystemConfig) MarshalTo(dAtA []byte) (int, error)

func (SystemConfig) NeedsSplit

func (s SystemConfig) NeedsSplit(startKey, endKey roachpb.RKey) bool

NeedsSplit returns whether the range [startKey, endKey) needs a split due to zone configs.

func (*SystemConfig) ProtoMessage

func (*SystemConfig) ProtoMessage()

func (*SystemConfig) Reset

func (m *SystemConfig) Reset()

func (*SystemConfig) Size

func (m *SystemConfig) Size() (n int)

func (*SystemConfig) String

func (m *SystemConfig) String() string

func (*SystemConfig) Unmarshal

func (m *SystemConfig) Unmarshal(dAtA []byte) error

type ZoneConfig

type ZoneConfig struct {
	// TODO(d4l3k): Remove replica_attrs after a sufficient amount of time has passed.
	ReplicaAttrs  []cockroach_roachpb.Attributes `protobuf:"bytes,1,rep,name=replica_attrs,json=replicaAttrs" json:"replica_attrs" yaml:",omitempty"`
	RangeMinBytes int64                          `protobuf:"varint,2,opt,name=range_min_bytes,json=rangeMinBytes" json:"range_min_bytes" yaml:"range_min_bytes"`
	RangeMaxBytes int64                          `protobuf:"varint,3,opt,name=range_max_bytes,json=rangeMaxBytes" json:"range_max_bytes" yaml:"range_max_bytes"`
	// If GC policy is not set, uses the next highest, non-null policy
	// in the zone config hierarchy, up to the default policy if necessary.
	GC GCPolicy `protobuf:"bytes,4,opt,name=gc" json:"gc"`
	// NumReplicas specifies the desired number of replicas
	NumReplicas int32 `protobuf:"varint,5,opt,name=num_replicas,json=numReplicas" json:"num_replicas" yaml:"num_replicas"`
	// Constraints constrains which stores the replicas can be stored on. The
	// order in which the constraints are stored is arbitrary and may change.
	// https://github.com/cockroachdb/cockroach/blob/master/docs/RFCS/expressive_zone_config.md#constraint-system
	Constraints Constraints `protobuf:"bytes,6,opt,name=constraints" json:"constraints" yaml:"constraints,flow"`
}

ZoneConfig holds configuration that is needed for a range of KV pairs. This and the conversion methods must stay in sync with ZoneConfigHuman.

func DefaultZoneConfig

func DefaultZoneConfig() ZoneConfig

DefaultZoneConfig is the default zone configuration used when no custom config has been specified.

func MigrateZoneConfig

func MigrateZoneConfig(value *roachpb.Value) (ZoneConfig, error)

MigrateZoneConfig migrates the legacy ZoneConfig format into the new one.

func (*ZoneConfig) Descriptor

func (*ZoneConfig) Descriptor() ([]byte, []int)

func (*ZoneConfig) Marshal

func (m *ZoneConfig) Marshal() (dAtA []byte, err error)

func (*ZoneConfig) MarshalTo

func (m *ZoneConfig) MarshalTo(dAtA []byte) (int, error)

func (*ZoneConfig) ProtoMessage

func (*ZoneConfig) ProtoMessage()

func (*ZoneConfig) Reset

func (m *ZoneConfig) Reset()

func (*ZoneConfig) Size

func (m *ZoneConfig) Size() (n int)

func (*ZoneConfig) String

func (m *ZoneConfig) String() string

func (*ZoneConfig) Unmarshal

func (m *ZoneConfig) Unmarshal(dAtA []byte) error

func (ZoneConfig) Validate

func (z ZoneConfig) Validate() error

Validate verifies some ZoneConfig fields. This should be used to validate user input when setting a new zone config.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL