shardspace

package
v2.0.206+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2019 License: MIT Imports: 2 Imported by: 0

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 consumer.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 *consumer.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

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

func (s *Set) PushDown()

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

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

Jump to

Keyboard shortcuts

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