config

package
v0.0.0-...-4b82dee Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2015 License: Apache-2.0 Imports: 9 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
PrefixConfigMap
PrefixConfig
ConfigUnion
SystemConfig

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthConfig = fmt.Errorf("proto: negative length found during unmarshaling")
)

Functions

This section is empty.

Types

type ConfigUnion

type ConfigUnion struct {
	Zone *ZoneConfig `protobuf:"bytes,1,opt,name=zone" json:"zone,omitempty"`
}

func (*ConfigUnion) GetValue

func (this *ConfigUnion) GetValue() interface{}

func (*ConfigUnion) GetZone

func (m *ConfigUnion) GetZone() *ZoneConfig

func (*ConfigUnion) Marshal

func (m *ConfigUnion) Marshal() (data []byte, err error)

func (*ConfigUnion) MarshalTo

func (m *ConfigUnion) MarshalTo(data []byte) (int, error)

func (*ConfigUnion) ProtoMessage

func (*ConfigUnion) ProtoMessage()

func (*ConfigUnion) Reset

func (m *ConfigUnion) Reset()

func (*ConfigUnion) SetValue

func (this *ConfigUnion) SetValue(value interface{}) bool

func (*ConfigUnion) Size

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

func (*ConfigUnion) String

func (m *ConfigUnion) String() string

func (*ConfigUnion) Unmarshal

func (m *ConfigUnion) Unmarshal(data []byte) error

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 PrefixConfig

type PrefixConfig struct {
	Prefix    github_com_cockroachdb_cockroach_proto.Key `protobuf:"bytes,1,opt,name=prefix,casttype=github.com/cockroachdb/cockroach/proto.Key" json:"prefix,omitempty"`
	Canonical github_com_cockroachdb_cockroach_proto.Key `protobuf:"bytes,2,opt,name=canonical,casttype=github.com/cockroachdb/cockroach/proto.Key" json:"canonical,omitempty"`
	Config    ConfigUnion                                `protobuf:"bytes,3,opt,name=config" json:"config"`
}

PrefixConfig relates a prefix key to a config object. PrefixConfig objects are the constituents of PrefixConfigMap objects. In order to support binary searches of hierarchical PrefixConfig objects, end-of-prefix PrefixConfig objects are added to a PrefixConfigMap to demarcate the end of a prefix range. Such end-of-range sentinels need to refer back to their parent prefix. The Canonical key refers to this parent PrefixConfig by its prefix.

func MakePrefixConfig

func MakePrefixConfig(prefix, canonical proto.Key, configI gogoproto.Message) PrefixConfig

MakePrefixConfig creates a new PrefixConfig.

func (*PrefixConfig) GetCanonical

func (*PrefixConfig) GetConfig

func (m *PrefixConfig) GetConfig() ConfigUnion

func (*PrefixConfig) GetPrefix

func (*PrefixConfig) Marshal

func (m *PrefixConfig) Marshal() (data []byte, err error)

func (*PrefixConfig) MarshalTo

func (m *PrefixConfig) MarshalTo(data []byte) (int, error)

func (*PrefixConfig) ProtoMessage

func (*PrefixConfig) ProtoMessage()

func (*PrefixConfig) Reset

func (m *PrefixConfig) Reset()

func (*PrefixConfig) Size

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

func (*PrefixConfig) String

func (pc *PrefixConfig) String() string

String returns a human readable description.

func (*PrefixConfig) Unmarshal

func (m *PrefixConfig) Unmarshal(data []byte) error

type PrefixConfigMap

type PrefixConfigMap struct {
	Configs []PrefixConfig `protobuf:"bytes,1,rep,name=configs" json:"configs"`
}

PrefixConfigMap contains a slice of prefix configs, sorted by prefix. Along with various accessor methods, the config map also contains additional prefix configs in the slice to account for the ends of prefix ranges.

func NewPrefixConfigMap

func NewPrefixConfigMap(configs []PrefixConfig) (*PrefixConfigMap, error)

NewPrefixConfigMap creates a new prefix config map and sorts the entries by key prefix and then adds additional entries to mark the ends of each key prefix range. For example, if the map contains entries for:

"/":          config1
"/db1":       config2
"/db1/table": config3
"/db3":       config4

...then entries will be added for:

"/db1/tablf": config2
"/db2":       config1
"/db4":       config1

These additional entries allow for simple lookups by prefix and provide a way to split a range by prefixes which affect it. This last is necessary for zone configs; ranges must not span zone config boundaries.

Similarly, if the map contains successive prefix entries:

"/":           config1
"/db1":        config2
"/db1/table1": config3
"/db1/table2": config4
"/db2":        config5

...then entries will be added for (note that we don't add a redundant entry for /db2 or /db1/table2).:

"/db1/table3": config2
"/db3":        config1

func (*PrefixConfigMap) GetConfigs

func (m *PrefixConfigMap) GetConfigs() []PrefixConfig

func (*PrefixConfigMap) Len

func (p *PrefixConfigMap) Len() int

Implementation of sort.Interface.

func (*PrefixConfigMap) Less

func (p *PrefixConfigMap) Less(i, j int) bool

func (*PrefixConfigMap) Marshal

func (m *PrefixConfigMap) Marshal() (data []byte, err error)

func (*PrefixConfigMap) MarshalTo

func (m *PrefixConfigMap) MarshalTo(data []byte) (int, error)

func (PrefixConfigMap) MatchByPrefix

func (p PrefixConfigMap) MatchByPrefix(key proto.Key) PrefixConfig

MatchByPrefix returns the longest matching PrefixConfig. If the key specified does not match an existing prefix, a panic will result. Based on the comments in NewPrefixConfigMap, that example will have a final list of PrefixConfig entries which look like:

"/":          config1
"/db1":       config2
"/db1/table": config3
"/db1/tablf": config2
"/db2":       config1
"/db3":       config4
"/db4":       config1

To find the longest matching prefix, we take the lower bound of the specified key.

func (PrefixConfigMap) MatchesByPrefix

func (p PrefixConfigMap) MatchesByPrefix(key proto.Key) []PrefixConfig

MatchesByPrefix returns a list of PrefixConfig objects with prefixes satisfying the specified key. The results are returned in order of longest matching prefix to shortest.

func (*PrefixConfigMap) ProtoMessage

func (*PrefixConfigMap) ProtoMessage()

func (*PrefixConfigMap) Reset

func (m *PrefixConfigMap) Reset()

func (*PrefixConfigMap) Size

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

func (PrefixConfigMap) SplitRangeByPrefixes

func (p PrefixConfigMap) SplitRangeByPrefixes(start, end proto.Key) ([]*RangeResult, error)

SplitRangeByPrefixes returns a list of key ranges with corresponding configs. The split is done using matching prefix config entries. For example, consider the following set of configs and prefixes:

/:    config1
/db1: config2

A range containing keys from /0 - /db3 will map to the following split ranges and corresponding configs:

/0   - /db1: config1
/db1 - /db2: config2
/db2 - /db3: config1

After calling NewPrefixConfigMap, our prefixes will look like:

/:    config1
/db1: config2
/db2: config1

The algorithm is straightforward for splitting a range by existing prefixes. Lookup start key; that is first config. Lookup end key: that is last config. We then step through the intervening PrefixConfig records and create a RangeResult for each.

func (*PrefixConfigMap) String

func (m *PrefixConfigMap) String() string

func (*PrefixConfigMap) Swap

func (p *PrefixConfigMap) Swap(i, j int)

func (*PrefixConfigMap) Unmarshal

func (m *PrefixConfigMap) Unmarshal(data []byte) error

func (PrefixConfigMap) VisitPrefixes

func (p PrefixConfigMap) VisitPrefixes(start, end proto.Key,
	visitor func(start, end proto.Key, config ConfigUnion) (bool, error)) error

VisitPrefixes invokes the visitor function for each prefix overlapped by the specified key range [start, end). If visitor returns done=true or an error, the visitation is halted.

func (PrefixConfigMap) VisitPrefixesHierarchically

func (p PrefixConfigMap) VisitPrefixesHierarchically(key proto.Key,
	visitor func(start, end proto.Key, config ConfigUnion) (bool, error)) error

VisitPrefixesHierarchically invokes the visitor function for each prefix matching the key argument, from longest matching prefix to shortest. If visitor returns done=true or an error, the visitation is halted.

type RangeResult

type RangeResult struct {
	Start, End proto.Key
	// contains filtered or unexported fields
}

RangeResult is returned by SplitRangeByPrefixes.

type SystemConfig

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

func (*SystemConfig) GetValues

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

func (*SystemConfig) Marshal

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

func (*SystemConfig) MarshalTo

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

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_proto.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_proto.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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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