spec

package
v0.0.0-...-2eec6a9 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2017 License: LGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package spec defines cluster specifications

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	ID     string   `json:"ID"`
	Addr   string   `json:"Addr"`
	Slices []string `json:"slices"`
}

Entry describes a SAT entry.

func (Entry) ContainsKey

func (e Entry) ContainsKey(key string) bool

ContainsKey tests whether entry contains the key.

func (Entry) String

func (e Entry) String() string

String returns summary of entry

type OptEntry

type OptEntry struct {
	V *Entry
}

type OptSpec

type OptSpec struct {
	V *Spec
}

OptSpec optional spec

type SAT

type SAT struct {
	Entries []Entry `json:"entries"`
}

SAT slice allocation table

func (SAT) FindEntry

func (sat SAT) FindEntry(id string) *Entry

FindEntry find entry by ID

func (SAT) Locate

func (sat SAT) Locate(key string) []Entry

Locate find out all entries containing the key

type Spec

type Spec struct {
	// revision of spec. Usually it's auto incremental.
	Revision int `json:"revision"`
	// Slice allocation table for whole data collection
	SAT SAT `json:"sat"`
}

Spec contains all information of cluster

func (*Spec) Hash

func (s *Spec) Hash() crypto.Hash

Hash returns hash of spec marshaled into JSON

func (*Spec) Validate

func (s *Spec) Validate() error

Validate validates spec. Returns non-nil error if not valid.

Jump to

Keyboard shortcuts

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