config

package
v0.0.0-...-c8a8ecc Latest Latest
Warning

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

Go to latest
Published: Nov 11, 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)
)
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 TestingDisableTableSplits

func TestingDisableTableSplits() func()

TestingDisableTableSplits is a testing-only function that disables splits of tables into separate ranges. It returns a function that re-enables this splitting.

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) 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) 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) *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 {
	// 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) 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