goSpace, a pSpace implementation in Go.
To get goSpace, do:
go get -u github.com/pspaces/gospace
To import goSpace into your project, add:
import (
"github.com/pspaces/gospace"
)
Documentation for goSpace can be accessed through the terminal with go doc
or viewed online with godoc
.
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:
Space
structure.Put
, Get
and so forth are blocking operations.P
such as PutP
, GetP
and so forth are non-blocking operations.Agg
such as PutAgg
, GetAgg
and so forth are non-blocking operations.f
which operate on a Tuple
structure and has the signature func(Tuple, Tuple) Tuple
.f
exists on all peers that will use that function.Put
and PutP
operations the parameters must be values. For the remaining operations the parameters must be values or binding variables for pattern matching.func(...) (Tuple, error)
.Due to aggregation operators, binding variables are not written to when an operation completes.
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)
The specification for the pSpace can be found here.
There are currently some limitations to the implementation:
These limitations are currently being resolved.
Examples and cases for goSpace can be found here.
Want to contribute? See CONTRIBUTING.md.
See AUTHORS.md.
MIT License. See LICENSE.md.