core: Index | Files

package shardspace

import ""

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.


Package Files


type Set Uses

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 Uses

func FromListResponse(resp *pc.ListResponse) Set

FromListResponse builds a Set from a ListResponse.

func (*Set) Hoist Uses

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 Uses

func (s *Set) MarkUnpatchedForDeletion()

MarkUnpatchedForDeletion sets Delete for each Shard of the Set which has not been Patched.

func (*Set) Patch Uses

func (s *Set) Patch(shard Shard) *Shard

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.

func (*Set) PushDown Uses

func (s *Set) PushDown()

PushDown specification of the Set, pushing common ShardSpec configuration into constituent ShardSpecs having corresponding zero-valued fields.

type Shard Uses

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.

Package shardspace imports 2 packages (graph) and is imported by 1 packages. Updated 2020-01-13. Refresh now. Tools for package owners.