Getting or Taking a Single Tuple from the Space

Retrieving or taking a single tuple from a space is done using the space’s get or take methods.

These methods take a tuple as an argument, which must contain fields of the same name and type as the fields marked as key in the space’s space definition. If there is a tuple in the space containing a tuple whose key field values match exactly the values in the tuple passed as argument stored in the space, these methods return a copy of that tuple inside a Result object. (In the case of the take method, it also atomically removes that tuple from the space.)

Specifying a filter for the Get Operation

If you want the operation to succeed only if a particular filter is matched, then specify the filter in the corresponding option, such as GetOptions.setFilter(String). If the tuple does not match the filter condition, then an error is displayed.
Note: This is true for the following operations:
  • Take
  • Put
  • Lock
  • Get