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 AcctConfig PermConfig UserConfig ZoneConfig
Index ¶
- Variables
- type AcctConfig
- func (m *AcctConfig) GetClusterId() string
- func (m *AcctConfig) Marshal() (data []byte, err error)
- func (m *AcctConfig) MarshalTo(data []byte) (n int, err error)
- func (*AcctConfig) ProtoMessage()
- func (m *AcctConfig) Reset()
- func (m *AcctConfig) Size() (n int)
- func (m *AcctConfig) String() string
- func (m *AcctConfig) Unmarshal(data []byte) error
- type GCPolicy
- func (m *GCPolicy) GetTTLSeconds() int32
- func (m *GCPolicy) Marshal() (data []byte, err error)
- func (m *GCPolicy) MarshalTo(data []byte) (n int, err error)
- func (*GCPolicy) ProtoMessage()
- func (m *GCPolicy) Reset()
- func (m *GCPolicy) Size() (n int)
- func (m *GCPolicy) String() string
- func (m *GCPolicy) Unmarshal(data []byte) error
- type PermConfig
- func (p *PermConfig) CanRead(user string) bool
- func (p *PermConfig) CanWrite(user string) bool
- func (m *PermConfig) GetRead() []string
- func (m *PermConfig) GetWrite() []string
- func (m *PermConfig) Marshal() (data []byte, err error)
- func (m *PermConfig) MarshalTo(data []byte) (n int, err error)
- func (*PermConfig) ProtoMessage()
- func (m *PermConfig) Reset()
- func (m *PermConfig) Size() (n int)
- func (m *PermConfig) String() string
- func (m *PermConfig) Unmarshal(data []byte) error
- type PrefixConfig
- type PrefixConfigMap
- func (p PrefixConfigMap) Len() int
- func (p PrefixConfigMap) Less(i, j int) bool
- func (p PrefixConfigMap) MatchByPrefix(key proto.Key) *PrefixConfig
- func (p PrefixConfigMap) MatchesByPrefix(key proto.Key) []*PrefixConfig
- func (p PrefixConfigMap) SplitRangeByPrefixes(start, end proto.Key) ([]*RangeResult, error)
- func (p PrefixConfigMap) Swap(i, j int)
- func (p PrefixConfigMap) VisitPrefixes(start, end proto.Key, ...) error
- func (p PrefixConfigMap) VisitPrefixesHierarchically(key proto.Key, ...) error
- type RangeResult
- type UserConfig
- func (m *UserConfig) GetHashedPassword() []byte
- func (m *UserConfig) Marshal() (data []byte, err error)
- func (m *UserConfig) MarshalTo(data []byte) (n int, err error)
- func (*UserConfig) ProtoMessage()
- func (m *UserConfig) Reset()
- func (m *UserConfig) Size() (n int)
- func (m *UserConfig) String() string
- func (m *UserConfig) Unmarshal(data []byte) error
- type ZoneConfig
- func (m *ZoneConfig) GetGC() *GCPolicy
- func (m *ZoneConfig) GetRangeMaxBytes() int64
- func (m *ZoneConfig) GetRangeMinBytes() int64
- func (m *ZoneConfig) GetReplicaAttrs() []cockroach_proto.Attributes
- func (m *ZoneConfig) Marshal() (data []byte, err error)
- func (m *ZoneConfig) MarshalTo(data []byte) (n int, err error)
- func (*ZoneConfig) ProtoMessage()
- func (m *ZoneConfig) Reset()
- func (m *ZoneConfig) Size() (n int)
- func (m *ZoneConfig) String() string
- func (m *ZoneConfig) Unmarshal(data []byte) error
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidLengthConfig = fmt.Errorf("proto: negative length found during unmarshaling")
)
Functions ¶
This section is empty.
Types ¶
type AcctConfig ¶
type AcctConfig struct { ClusterId string `protobuf:"bytes,1,opt,name=cluster_id" json:"cluster_id" yaml:"cluster_id,omitempty"` XXX_unrecognized []byte `json:"-"` }
AcctConfig holds accounting configuration.
func (*AcctConfig) GetClusterId ¶
func (m *AcctConfig) GetClusterId() string
func (*AcctConfig) Marshal ¶
func (m *AcctConfig) Marshal() (data []byte, err error)
func (*AcctConfig) ProtoMessage ¶
func (*AcctConfig) ProtoMessage()
func (*AcctConfig) Reset ¶
func (m *AcctConfig) Reset()
func (*AcctConfig) Size ¶
func (m *AcctConfig) Size() (n int)
func (*AcctConfig) String ¶
func (m *AcctConfig) String() string
func (*AcctConfig) Unmarshal ¶
func (m *AcctConfig) 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"` XXX_unrecognized []byte `json:"-"` }
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 (*GCPolicy) ProtoMessage ¶
func (*GCPolicy) ProtoMessage()
type PermConfig ¶
type PermConfig struct { // ACL lists users with read permissions. Read []string `protobuf:"bytes,1,rep,name=read" json:"read,omitempty" yaml:"read,omitempty"` // ACL lists users with write permissions. Write []string `protobuf:"bytes,2,rep,name=write" json:"write,omitempty" yaml:"write,omitempty"` XXX_unrecognized []byte `json:"-"` }
PermConfig holds permission configuration, specifying read/write ACLs.
func (*PermConfig) CanRead ¶
func (p *PermConfig) CanRead(user string) bool
CanRead does a linear search for user to verify read permission.
func (*PermConfig) CanWrite ¶
func (p *PermConfig) CanWrite(user string) bool
CanWrite does a linear search for user to verify write permission.
func (*PermConfig) GetRead ¶
func (m *PermConfig) GetRead() []string
func (*PermConfig) GetWrite ¶
func (m *PermConfig) GetWrite() []string
func (*PermConfig) Marshal ¶
func (m *PermConfig) Marshal() (data []byte, err error)
func (*PermConfig) ProtoMessage ¶
func (*PermConfig) ProtoMessage()
func (*PermConfig) Reset ¶
func (m *PermConfig) Reset()
func (*PermConfig) Size ¶
func (m *PermConfig) Size() (n int)
func (*PermConfig) String ¶
func (m *PermConfig) String() string
func (*PermConfig) Unmarshal ¶
func (m *PermConfig) Unmarshal(data []byte) error
type PrefixConfig ¶
type PrefixConfig struct { Prefix proto.Key // the prefix the config affects Canonical proto.Key // the prefix for the canonical config, if applicable Config gogoproto.Message // the config object }
PrefixConfig relate a string prefix to a config object. Config objects include accounting, permissions, users, and zones. PrefixConfig objects are the constituents of PrefixConfigMap objects. In order to support binary searches of hierarchical prefixes (see the comments in NewPrefixConfigMap), PrefixConfig objects are additionally added to a PrefixConfigMap to demarcate the end of a prefix range. Such end-of-range sentinels need to refer back to the next "higher-up" prefix in the hierarchy (many times this is the default prefix which covers the entire range of keys). The Canonical key refers to this "higher-up" PrefixConfig by specifying its prefix so it can be binary searched from within a PrefixConfigMap.
func (*PrefixConfig) String ¶
func (pc *PrefixConfig) String() string
String returns a human readable description.
type PrefixConfigMap ¶
type PrefixConfigMap []*PrefixConfig
PrefixConfigMap is 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 accounting and zone configs; ranges must not span accounting or 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) Less ¶
func (p PrefixConfigMap) Less(i, j int) bool
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) 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) Swap ¶
func (p PrefixConfigMap) Swap(i, j int)
func (PrefixConfigMap) VisitPrefixes ¶
func (p PrefixConfigMap) VisitPrefixes(start, end proto.Key, visitor func(start, end proto.Key, config gogoproto.Message) (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 gogoproto.Message) (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 ¶
RangeResult is returned by SplitRangeByPrefixes.
type UserConfig ¶
type UserConfig struct { // Output of bcrypt: contains hash, salt, and cost. HashedPassword []byte `protobuf:"bytes,1,opt,name=hashed_password" json:"hashed_password,omitempty" yaml:"hashed_password,omitempty"` XXX_unrecognized []byte `json:"-"` }
UserConfig holds per-user configuration needed for authentication.
func (*UserConfig) GetHashedPassword ¶
func (m *UserConfig) GetHashedPassword() []byte
func (*UserConfig) Marshal ¶
func (m *UserConfig) Marshal() (data []byte, err error)
func (*UserConfig) ProtoMessage ¶
func (*UserConfig) ProtoMessage()
func (*UserConfig) Reset ¶
func (m *UserConfig) Reset()
func (*UserConfig) Size ¶
func (m *UserConfig) Size() (n int)
func (*UserConfig) String ¶
func (m *UserConfig) String() string
func (*UserConfig) Unmarshal ¶
func (m *UserConfig) 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"` XXX_unrecognized []byte `json:"-"` }
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) 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