RFC : channel(), tspace() and kvspace() #5791
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR relies on multiple dispatch on the container of the remote object referenced to by a RemoteRef to implement channels, tspaces and kvspaces.
In that sense it is an alternative approach to introducing channels and the like in Julia as compared to #5757
This PR introduces 3 new methods
channel()
which returns a RemoteRef to a channeltspace()
which returns a RemoteRef to a tspace, i.e., a tuple spacekvspace()
which returns a RemoteRef to a kvspace, i.e., a dicttspace
andkvspace
are inspired by http://en.wikipedia.org/wiki/Linda_(coordination_language)A
channel
can have a type and length associated with it.put
blocks only when full,take
only when empty. It is a queue.A
tspace
can store tuples, where the first element is a key.take(rr, key)
will block till an element matching key becomes available in the tspace.The key can be a
Regex
object, in which case, it blocks till a match is found.The space itself is a queue so that any match is ordered as a FIFO.
fetch
,isready
,take
all accept akey
parameter and the entire tuple is returned.A
kvspace
is like a dict, only exact matches are allowed intake
and any duplicates input
results in an overwrite.put
is of the formput(rr, key, value)
.fetch
,isready
,take
all accept akey
parameter and the associated value is returned.