gospace

package module
v0.0.0-...-d2861cf Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2018 License: MIT Imports: 3 Imported by: 0

README

goSpace

Synopsis

goSpace, a pSpace implementation in Go.

Importing goSpace

To get goSpace, do:

go get -u github.com/pspaces/gospace

To import goSpace into your project, add:

import (
      "github.com/pspaces/gospace"
)

Documentation

Documentation for goSpace can be accessed through the terminal with go doc or viewed online with godoc.

Library

Usage

A space can be created by using NewSpace for creating a local space or NewRemoteSpace for connecting to a remote space.

To create a space on the local host, one can do:

spc := gospace.NewSpace("space")

To connect to a remote space with name space, one can do:

spc := gospace.NewRemoteSpace("tcp://example.com/space")

In order to use goSpace efficiently, there are certain rules one needs to be aware of:

  1. An operation acts on a Space structure.
  2. Tuples contain values. Templates contain values and types.
  3. Ordinary operations such as Put, Get and so forth are blocking operations.
  4. Ordinary operations postfixed by a P such as PutP, GetP and so forth are non-blocking operations.
  5. Aggregation operations postfixed by a Agg such as PutAgg, GetAgg and so forth are non-blocking operations.
  6. Aggregation operations require inclusion of a user defined function f which operate on a Tuple structure and has the signature func(Tuple, Tuple) Tuple.
  7. Aggregation operations require that the user defined function f exists on all peers that will use that function.
  8. For Put and PutP operations the parameters must be values. For the remaining operations the parameters must be values or binding variables for pattern matching.
  9. Return signature of an operations is always func(...) (Tuple, error).

Due to aggregation operators, binding variables are not written to when an operation completes.

Operators

goSpace strives to follow the pSpace specification. It contains the following operations:

Put(x_1, x_2, ..., x_n)
PutP(x_1, x_2, ..., x_n)
Get(x_1, x_2, ..., x_n)
GetP(x_1, x_2, ..., x_n)
GetAll(x_1, x_2, ..., x_n)
Query(x_1, x_2, ..., x_n)
QueryP(x_1, x_2, ..., x_n)
QueryAll(x_1, x_2, ..., x_n)

Do note that GetAll and QueryAll are non-blocking operators.

goSpace has experimental operators for aggregating tuples in a space. It contains the following operations:

PutAgg(f, x_1, x_2, ..., x_n)
GetAgg(f, x_1, x_2, ..., x_n)
QueryAgg(f, x_1, x_2, ..., x_n)

Specification

The specification for the pSpace can be found here.

Limitations

There are currently some limitations to the implementation:

  • Strict 4 GiB size limit on the tuple space.
  • Only TCP over IPv4 is supported.
  • Gates and space repositories are not supported.
  • Multiplexing of multiple spaces over a single gate is not supported.
  • Performance is bouded by the amount of connections established due to networking code.

These limitations are currently being resolved.

Examples

Examples and cases for goSpace can be found here.

Contributing

Want to contribute? See CONTRIBUTING.md.

Authors

See AUTHORS.md.

License

MIT License. See LICENSE.md.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action = policy.Action

Action encapsulates an operation with its parameters.

func NewAction

func NewAction(function interface{}, params ...interface{}) *Action

NewAction creates a structure that represents an action.

type AggregationPolicy

type AggregationPolicy = policy.Aggregation

AggregationPolicy defines an aggregation policy.

func NewAggregationPolicy

func NewAggregationPolicy(l Label, r AggregationRule) AggregationPolicy

NewAggregationPolicy creates a structure that represents an aggregation policy.

type AggregationRule

type AggregationRule = policy.AggregationRule

AggregationRule defines an aggregation rule.

func NewAggregationRule

func NewAggregationRule(a Action, trs Transformations) AggregationRule

NewAggregationRule creates a structure that represents an aggregation rule.

type ComposablePolicy

type ComposablePolicy = policy.Composable

ComposablePolicy defines a composable policy.

func NewComposablePolicy

func NewComposablePolicy(ars ...AggregationPolicy) *ComposablePolicy

NewComposablePolicy creates a structure that represents a composable policy.

type Intertemplate

type Intertemplate = container.Intertemplate

Intertemplate is an interface for interacting with a template.

type Intertuple

type Intertuple = container.Intertuple

Intertuple is an interface for interacting with a tuple.

type Label

type Label = container.Label

Label describes a label given some entity.

func NewLabel

func NewLabel(id string) Label

NewLabel creates a structure that represents a label.

type LabelledTuple

type LabelledTuple = container.LabelledTuple

LabelledTuple represents a labelled tuple.

func NewLabelledTuple

func NewLabelledTuple(fields ...interface{}) LabelledTuple

NewLabelledTuple creates a structure that represents a labelled tuple.

type Labels

type Labels = container.Labels

Labels defines a set of labels.

func NewLabels

func NewLabels(ll ...Label) Labels

NewLabels creates a structure that represents a collection of labels.

type Space

type Space = space.Space

Space defines a multi-set for tuples.

func NewRemoteSpace

func NewRemoteSpace(name string) Space

NewRemoteSpace creates a structure that represents a remote space.

func NewSpace

func NewSpace(name string, policy ...*ComposablePolicy) Space

NewSpace creates a structure that represents a space.

type SpaceFrame

type SpaceFrame interface {
	space.Interspace
	space.Interstar
}

SpaceFrame contains all interfaces that can operate on a space.

type Template

type Template = container.Template

Template defines a template used for pattern matching.

func CreateTemplate

func CreateTemplate(fields ...interface{}) Template

CreateTemplate creates a structure that represents a template.

type TemplateFrame

type TemplateFrame interface {
	Intertemplate
}

TemplateFrame contains all interfaces that can operate on a template.

type Transformation

type Transformation = policy.Transformation

Transformation defines a transformation.

func NewTransformation

func NewTransformation(function interface{}, params ...interface{}) Transformation

NewTransformation creates a structure for representing a transformation that can be applied to an action.

type Transformations

type Transformations = policy.Transformations

Transformations defines a transformations applied to an action.

func NewTransformations

func NewTransformations(trs ...*Transformation) *Transformations

NewTransformations creates a structure for representing collection of transformation that can be applied to an action.

type Tuple

type Tuple = container.Tuple

Tuple defines a tuple structure.

func CreateTuple

func CreateTuple(fields ...interface{}) Tuple

CreateTuple creates a structure that represents a tuple.

type TupleFrame

type TupleFrame interface {
	Intertuple
}

TupleFrame contains all interfaces that can operate on a tuple.

Directories

Path Synopsis
uri

Jump to

Keyboard shortcuts

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