Basic Operations on Tuples

You can perform basic operations on tuples such as, Put, Get, Take, Lock, and Update.

Put
 Stores a tuple into a space.
Get
 Retrieves the complete entry associated with provided key field(s).
Take
 Performs an atomic “get and remove” action on the entry for provided key field(s).

A take is a “consume” operation; therefore if two takes are initiated at the same time on the same entry, only one succeeds.

Lock
 Performs an atomic “get and lock” action on the entry for provided key fields(). Can also lock a specific entry directly.
Update
 Performs an atomic “compare and set” operation on the entry for provided key field(s). When used on a locked entry, also automatically unlocks it.
UpdateField(s)
Updates the values for the specified fields without having to pass all the fields to the space.

Get, Put, Take, Lock, and Update are single entry operations. Two additional combination atomic operations are provided:

For information on performing puts, gets, and takes, see The Read and Write in a Space.
  • PutAndLock - Puts a tuple into a space and automatically locks it.
  • UpdateAndLock - Performs an atomic compare and set operation on a tuple and automatically locks it.
Related reference