ScaleOut C++ Native Client API
5.1
|
The LockTicket class serves as a RAII-style wrapper around the internal lock ticket identifier returned by ScaleOut's low-level APIs. More...
#include <lock_ticket.h>
Public Member Functions | |
LockTicket (void) | |
Default constructor. Constructs an empty and uninitialized lock ticket that is not ready for use until assigned. | |
LockTicket (SOSS_OBJKEY const &key, const int32_t ticket) | |
Constructs a LockTicket for a given object. More... | |
LockTicket (const LockTicket &other) | |
Copy constructor. More... | |
void | release (void) |
Marks that the lock ticket has been unlocked by the server. | |
bool | locked (void) const |
Gets the current state of the lock ticket. More... | |
bool | is_null_ticket (void) const |
Determines whether the lock ticket is valid. More... | |
LockTicket & | operator= (const LockTicket &rhs) |
Assignment operator. | |
operator int32_t () const | |
Conversion operator to treat LockTicket implicitly as a native lock ticket. More... | |
The LockTicket class serves as a RAII-style wrapper around the internal lock ticket identifier returned by ScaleOut's low-level APIs.
Its implementation counts references to a given lock ticket and automatically unlocks the associated object if its last reference falls out of scope without the lock having been explicitly released by the client app.
sosscli::LockTicket::LockTicket | ( | SOSS_OBJKEY const & | key, |
const int32_t | ticket | ||
) |
Constructs a LockTicket for a given object.
key | SOSS object key associated with the lock ticket. |
ticket | SOSS lock ticket identifier as returned by the server. |
sosscli::LockTicket::LockTicket | ( | const LockTicket & | other) |
Copy constructor.
other | The LockTicket that this instance is being copied from. |
bool sosscli::LockTicket::is_null_ticket | ( | void | ) | const |
Determines whether the lock ticket is valid.
bool sosscli::LockTicket::locked | ( | void | ) | const |
Gets the current state of the lock ticket.
|
inline |
Conversion operator to treat LockTicket implicitly as a native lock ticket.
Note: Locally storing a LockTicket as an integer will result in an unmanaged copy of the lock ticket, which may result in the locally stored lock ticket becoming unexpectedly invalid if all managed references fall out of scope, or release() is called!