Documentation ¶
Overview ¶
Package shardspace provides mechanisms for mapping a collection of ShardSpecs into a minimally-described, semi hierarchical structure, and for mapping back again. This is principally useful for tooling over ShardSpecs, which must be written to (& read from) Etcd in fully-specified and explicit form. Tooling can map ShardSpecs into a Set, apply edits in that semi- hierarchical space, and then flatten resulting changes for application to the cluster.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set struct { // Common ShardSpec configuration of Shards in the Set. When flattened, // Shards having zero-valued fields in their spec derive the value from // this ShardSpec. Common pc.ShardSpec // Shards of the Set, uniquely ordered on ShardSpec.Id. Shards []Shard }
Set is a collection of Shards, which may share common configuration.
func FromListResponse ¶
func FromListResponse(resp *pc.ListResponse) Set
FromListResponse builds a Set from a ListResponse.
func (*Set) Hoist ¶
func (s *Set) Hoist()
Hoist specifications of the Set, lifting ShardSpec configuration which is common across all Shards of the Set into the Set's common ShardSpec. The field is then zeroed at each constituent Shard.
func (*Set) MarkUnpatchedForDeletion ¶
func (s *Set) MarkUnpatchedForDeletion()
MarkUnpatchedForDeletion sets Delete for each Shard of the Set which has not been Patched.
func (*Set) Patch ¶
Patch |shard| into the Set, inserting it if required and otherwise updating with fields of |shard| which are not zero-valued. Patch returns a reference to the patched *Shard, which may also be inspected and updated directly. However, note the returned *Shard is invalidated with the next call to Patch.
type Shard ¶
type Shard struct { // Comment is a no-op field which allows tooling to generate and pass-through // comments in written YAML output. Comment string `yaml:",omitempty"` // Delete marks that the Shard should be deleted. Delete *bool `yaml:",omitempty"` // ShardSpec of the Shard, which may be partial and incomplete. Zero-valued // fields of the ShardSpec derive their value from the common Set ShardSpec. Spec pc.ShardSpec `yaml:",omitempty,inline"` // Revision of the Shard within Etcd. Revision int64 `yaml:",omitempty"` // contains filtered or unexported fields }
Shard is a member Shard of a Set.