shard

package
v0.0.0-...-c729bb3 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2019 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateQuadraticExponent

func CalculateQuadraticExponent(exponent float64) float64

CalculateQuadraticExponent - returns exponential value of exponent to exponent exponent times

func SendBytesShard

func SendBytesShard(b []byte, address string, port int) error

SendBytesShard - attempt to send specified bytes to given shard address

func SendBytesShardResult

func SendBytesShardResult(b []byte, address string, port int) ([]byte, error)

SendBytesShardResult - attempt to send specified bytes to given shard address, returning result

Types

type Shard

type Shard struct {
	Nodes      *[]node.Node `json:"nodes"`       // Nodes - primary list of nodes
	ChildNodes *[]node.Node `json:"allChildren"` // ChildNodes - list of all child nodes (recursively includes nodes in child shards, not just direct children)

	ShardRootAddress   string `json:"root"`   // ShardRootAddress - root shard address of shard tree
	Root               bool   `json:"isRoot"` // Root - is root
	ParentShardAddress string `json:"parent"` // ParentShardAddress - address of parent shard

	ChildShards []*Shard `json:"child shards"` // ChildShards - shards created as children of shard

	Origin time.Time `json:"creation time"` // Origin - time shard created

	Address string `json:"address"` // Address - addressable internet protocol ID used for shard-level communications

	ID string `json:"id"` // ID - hash of Shard contents
}

Shard - container holding shard metadata

func NewShard

func NewShard(initializingNode *node.Node) (*Shard, error)

NewShard - initialize new shard

func NewShardWithNodes

func NewShardWithNodes(initializingNodes *[]node.Node) (*Shard, error)

NewShardWithNodes - initialize new shard with child nodes

func (*Shard) LogShard

func (shard *Shard) LogShard() error

LogShard - serialize and print contents of entire shard

func (*Shard) QueryForAddress

func (shard *Shard) QueryForAddress(address string) (uint, error)

QueryForAddress - attempts to search specified node database for specified address, returns index of node

func (*Shard) Shard

func (shard *Shard) Shard(exponent uint) error

Shard - exponentially shard specified shard into child shards

func (*Shard) String

func (shard *Shard) String() string

String - convert shard to string

Jump to

Keyboard shortcuts

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