The RChain Tuple Space
rspace
is a Scala library that has been designed to provide a disk-backed tuple space to the Rholang interpreter. It is based on an earlier, in-memory implementation written in the Rosette Base Language (RBL) found here.
Traditionally, a key-value store provides two main functions for interacting with a given store: put, which persists a piece of data at a given key, and get, which retrieves the data stored at a particular key.
rspace
departs from this model and provides a novel approach to storing and retrieving data.
Here are some key differences:
Rather than associating a piece of data with a particular key, in rspace
, a piece of data is associated with a channel. Roughly speaking, in rspace
, a channel can be any Scala type that can be serialized to and deserialized from an Array[Byte]
.
In addition to storing data, rspace
can also store continuations, which represent actions to carry out once the data is retrieved. Roughly speaking, in rspace
, a continuation can be any Scala type that can be serialized to and deserialized from anArray[Byte]
.
A continuation is associated with a list of channels and a list of patterns. Like channels and continuations, patterns can be any Scala type that can be serialized to and deserialized from an Array[Byte]
. Users of rspace
provide their own custom match function for matching patterns against data.
The two main functions for interacting with a given store are:
consume, which searches the store for data matching a given list of patterns at a given list channels; and
produce, which, given a piece data at a given channel, searches the store for matching continuation, using existing data in the store to help satisfy the match.
To use rspace
in a Scala project, add the following coordinates your build:
coop.rchain %% rspace % "0.1.1"
Bug reports are welcome! Please report any issues you have with rspace
here.
This project is licensed under The Apache 2.0 License.