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"
)The goSpace API follows the Space API 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)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 localhost, one can do:
spc := NewSpace("space")To connect to a remote space with name space, one can do:
spc := NewRemoteSpace("tcp://example.com/space")All operations act on a Space structures and x_1, x_2, ..., x_n are terms in a tuple.
Operations such as Put, Get, and so forth are blocking operations.
Operations postfixed by a P such as PutP, GetP, and so forth are non-blocking operations.
For Put and PutP operations, the terms are values and for the remaining operations terms are either values or binding variables.
Pattern matching can be achieved by passing a binding variable, that is, passing a pointer to a variabe by adding an & infront of the variable.
Binding variables can only be passed to Get* and Query* operations.
The specification for the pSpace Space API can be found here.
There are currently some limitations to the implementation:
- Only TCP over IPv4 is supported.
- Gates and space repositories are not supported yet.
- Multiplexing of multiple spaces over a single gate is not supported yet.
Examples and cases for goSpace can be found here.
Want to contribute? See CONTRIBUTING.md.
See AUTHORS.md.
MIT License. See LICENSE.md.