config

package
Version: v0.0.0-...-d55f3a2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2015 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package config is a generated protocol buffer package.

It is generated from these files:

cockroach/config/config.proto

It has these top-level messages:

GCPolicy
ZoneConfig
SystemConfig

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultZoneConfig is the default zone configuration
	// used when no custom config has been specified.
	DefaultZoneConfig = &ZoneConfig{
		ReplicaAttrs: []roachpb.Attributes{
			{},
			{},
			{},
		},
		RangeMinBytes: 1048576,
		RangeMaxBytes: 67108864,
		GC: &GCPolicy{
			TTLSeconds: 24 * 60 * 60,
		},
	}

	// 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 func(*SystemConfig, uint32) (*ZoneConfig, error)

	// TestingLargestIDHook is a function used to bypass GetLargestObjectID
	// in tests.
	TestingLargestIDHook func() uint32

	// TestingDisableTableSplits is a testing-only variable that disables
	// splits of tables into separate ranges.
	TestingDisableTableSplits bool
)
View Source
var (
	ErrInvalidLengthConfig = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowConfig   = fmt.Errorf("proto: integer overflow")
)

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 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 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:"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) GetTTLSeconds

func (m *GCPolicy) GetTTLSeconds() int32

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) ComputeSplitKeys

func (s *SystemConfig) ComputeSplitKeys(startKey, endKey roachpb.RKey) []roachpb.RKey

ComputeSplitKeys takes a start and end key and returns an array of keys at which to split the span [start, end). The only required splits are at each user table prefix.

func (*SystemConfig) Get

func (s *SystemConfig) Get(key roachpb.Key) (roachpb.KeyValue, bool)

Get searches the kv list for 'key' and returns the key/value if found.

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() (uint32, error)

GetLargestObjectID returns the largest object ID found in the config. This could be either a table or a database.

func (*SystemConfig) GetValue

func (s *SystemConfig) GetValue(key roachpb.Key) ([]byte, bool)

GetValue searches the kv list for 'key' and returns its raw byte value if found. ok is true only if the key is found.

func (*SystemConfig) GetValues

func (m *SystemConfig) GetValues() []cockroach_roachpb1.KeyValue

func (*SystemConfig) GetZoneConfigForID

func (s *SystemConfig) GetZoneConfigForID(id uint32) (*ZoneConfig, error)

GetZoneConfigForID looks up the zone config for the object (table or database) with 'id'.

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 {
	// ReplicaAttrs is a slice of Attributes, each describing required attributes
	// for each replica in the zone. The order in which the attributes are stored
	// in ReplicaAttrs is arbitrary and may change.
	ReplicaAttrs  []cockroach_roachpb.Attributes `protobuf:"bytes,1,rep,name=replica_attrs" json:"replica_attrs" yaml:"replicas,omitempty"`
	RangeMinBytes int64                          `protobuf:"varint,2,opt,name=range_min_bytes" json:"range_min_bytes" yaml:"range_min_bytes,omitempty"`
	RangeMaxBytes int64                          `protobuf:"varint,3,opt,name=range_max_bytes" json:"range_max_bytes" yaml:"range_max_bytes,omitempty"`
	// 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,omitempty" yaml:"gc,omitempty"`
}

ZoneConfig holds configuration that is needed for a range of KV pairs.

func (*ZoneConfig) GetGC

func (m *ZoneConfig) GetGC() *GCPolicy

func (*ZoneConfig) GetRangeMaxBytes

func (m *ZoneConfig) GetRangeMaxBytes() int64

func (*ZoneConfig) GetRangeMinBytes

func (m *ZoneConfig) GetRangeMinBytes() int64

func (*ZoneConfig) GetReplicaAttrs

func (m *ZoneConfig) GetReplicaAttrs() []cockroach_roachpb.Attributes

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
t or T : Toggle theme light dark auto
y or Y : Canonical URL