config

package
v0.0.0-...-a3ba52b Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2016 License: Apache-2.0 Imports: 14 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 (
	ErrInvalidLengthConfig = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowConfig   = fmt.Errorf("proto: integer overflow")
)
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 func(SystemConfig, uint32) (*ZoneConfig, error)
)

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

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

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

func (s SystemConfig) Hash() []byte

Hash returns a SHA1 hash of the SystemConfig contents.

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=replicaAttrs" json:"replica_attrs" yaml:"replicas,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"`
}

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

func DefaultZoneConfig

func DefaultZoneConfig() ZoneConfig

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

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