ScaleOut C++ Native Client API  5.1
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Pages
sosscli::SossKey Class Reference

The SossKey class serves as an identifier for a cached object in a NamedCache collection. More...

#include <soss_key.h>

Public Member Functions

 SossKey ()
 Constructor. Constructs a null object key.
 
 SossKey (const SossKey &other)
 Copy constructor. More...
 
 SossKey (const SOSS_OBJKEY &obj_key)
 Constructs a SossKey based on a SOSS_OBJKEY struct from the soss_svccli.h C API. More...
 
 SossKey (const std::string &key, const uint32_t app_id)
 Constructs a SossKey based on a string. More...
 
 SossKey (const std::wstring &key, const uint32_t app_id)
 Constructs a SossKey based on a wide string. More...
 
 SossKey (const std::vector< uint8_t > &bytes, const uint32_t app_id)
 Constructs a SossKey based on a vector of bytes (max 32 bytes in length). More...
 
 SossKey (const std::string &key)
 Constructs a SossKey based on a string. More...
 
 SossKey (const std::wstring &key)
 Constructs a SossKey based on a wide string. More...
 
 SossKey (const std::vector< uint8_t > &bytes)
 Constructs a SossKey based on a vector of bytes (max 32 bytes in length). More...
 
 SossKey (const char *key)
 Constructs a SossKey based on a string. More...
 
 SossKey (const wchar_t *key)
 Constructs a SossKey based on a wide string. More...
 
 SossKey (int32_t key)
 Constructs a SossKey based on a signed 32-bit integer. More...
 
 SossKey (const int32_t key, const uint32_t app_id)
 Constructs a SossKey based on a signed 32-bit integer. More...
 
 SossKey (uint32_t key)
 Constructs a SossKey based on an unsigned 32-bit integer. More...
 
 SossKey (const uint32_t key, const uint32_t app_id)
 Constructs a SossKey based on an unsigned 32-bit integer. More...
 
 SossKey (int64_t key)
 Constructs a SossKey based on a signed 64-bit integer. More...
 
 SossKey (const int64_t key, const uint32_t app_id)
 Constructs a SossKey based on a signed 64-bit integer. More...
 
 SossKey (uint64_t key)
 Constructs a SossKey based on an unsigned 64-bit integer. More...
 
 SossKey (const uint64_t key, const uint32_t app_id)
 Constructs a SossKey based on an unsigned 64-bit integer. More...
 
virtual ~SossKey ()
 Destructor.
 
SossKeyoperator= (const SossKey &rhs)
 Assignment operator.
 
SOSS_OBJKEY obj_key () const
 Gets a copy of the SOSS_OBJKEY struct associated with this SossKey instance. More...
 
uint32_t app_id () const
 Gets the StateServer application ID associated with this SossKey. More...
 
void set_app_id (uint32_t app_id)
 Sets the StateServer application ID associated with this SossKey. More...
 
bool has_app_id () const
 Gets whether this SOSS key has been associated yet with a specific named cache. More...
 
bool has_string_data () const
 Gets whether this SOSS key has string key data that is immediately available (that is, the method will only return true if retrieval of original string key data from the SOSS service is not required). More...
 
const std::wstring & retrieve_original_string_key () const
 Gets the locally stored SOSS string key data that is immediately available (that is, the method will only return a string if retrieval of original string key data from the SOSS service is not required). More...
 
void set_local_string_key_data (const std::vector< wchar_t > &string_key_data)
 Sets the string key data for the locally stored SOSS string key. More...
 

Static Public Attributes

static const size_t MAX_KEY_LENGTH = sizeof(((SOSS_OBJKEY*)0)->obj_id) + sizeof(((SOSS_OBJKEY*)0)->ext_obj_id)
 Maximum number of bytes allowed in a SossKey (currently 32).
 

Friends

bool operator== (const SossKey &key1, const SossKey &key2)
 Equality operator that compares two SossKey objects.
 
bool operator!= (const SossKey &key1, const SossKey &key2)
 Inequality operator that compares two SossKey objects.
 
std::size_t hash_value (SossKey const &key)
 Gets a numeric value that is used to insert and identify a SossKey in containers based on the STL.
 

Detailed Description

The SossKey class serves as an identifier for a cached object in a NamedCache collection.

Constructor & Destructor Documentation

sosscli::SossKey::SossKey ( const SossKey other)

Copy constructor.

Parameters
otherThe SossKey that this instance is being copied from.
sosscli::SossKey::SossKey ( const SOSS_OBJKEY &  obj_key)

Constructs a SossKey based on a SOSS_OBJKEY struct from the soss_svccli.h C API.

Parameters
obj_keyThe SOSS_OBJKEY to wrap.
sosscli::SossKey::SossKey ( const std::string &  key,
const uint32_t  app_id 
)

Constructs a SossKey based on a string.

The provided string will be converted to a wide string (std::wstring) and will then be converted to a 32-byte StateServer key using the SHA-256 hash algorithm.

Parameters
keyA string to be converted to a SossKey.
app_idApplication id of a named cache.
sosscli::SossKey::SossKey ( const std::wstring &  key,
const uint32_t  app_id 
)

Constructs a SossKey based on a wide string.

The provided string will be converted to a 32-byte StateServer key using the SHA-256 hash algortihm.

Parameters
keyA string to be converted to a SossKey.
app_idApplication id of a named cache.
sosscli::SossKey::SossKey ( const std::vector< uint8_t > &  bytes,
const uint32_t  app_id 
)

Constructs a SossKey based on a vector of bytes (max 32 bytes in length).

Parameters
bytesA vector of unsigned chars, max 32 bytes long.
app_idApplication id of a named cache.
sosscli::SossKey::SossKey ( const std::string &  key)

Constructs a SossKey based on a string.

The provided string will be converted to a wide string (std::wstring) and will then be converted to a 32-byte StateServer key using the SHA-256 hash algorithm.

Parameters
keyA string to be converted to a SossKey.
sosscli::SossKey::SossKey ( const std::wstring &  key)

Constructs a SossKey based on a wide string.

The provided string will be converted to a 32-byte StateServer key using the SHA-256 hash algortihm.

Parameters
keyA string to be converted to a SossKey.
sosscli::SossKey::SossKey ( const std::vector< uint8_t > &  bytes)

Constructs a SossKey based on a vector of bytes (max 32 bytes in length).

Parameters
bytesA vector of unsigned chars, max 32 bytes long.
sosscli::SossKey::SossKey ( const char *  key)

Constructs a SossKey based on a string.

The provided string will be converted to a wide string (std::wstring) and will then be converted to a 32-byte StateServer key using the SHA-256 hash algorithm.

Parameters
keyA string to be converted to a SossKey.
sosscli::SossKey::SossKey ( const wchar_t *  key)

Constructs a SossKey based on a wide string.

The provided string will be converted to a 32-byte StateServer key using the SHA-256 hash algortihm.

Parameters
keyA string to be converted to a SossKey.
sosscli::SossKey::SossKey ( int32_t  key)

Constructs a SossKey based on a signed 32-bit integer.

Parameters
keyA signed 32-bit integer to be converted to a SossKey.
sosscli::SossKey::SossKey ( const int32_t  key,
const uint32_t  app_id 
)

Constructs a SossKey based on a signed 32-bit integer.

Parameters
keyAn usigned 32-bit integer to be converted to a SossKey.
app_idApplication id of a named cache.
sosscli::SossKey::SossKey ( uint32_t  key)

Constructs a SossKey based on an unsigned 32-bit integer.

Parameters
keyA signed 32-bit integer to be converted to a SossKey.
sosscli::SossKey::SossKey ( const uint32_t  key,
const uint32_t  app_id 
)

Constructs a SossKey based on an unsigned 32-bit integer.

Parameters
keyAn usigned 32-bit integer to be converted to a SossKey.
app_idApplication id of a named cache.
sosscli::SossKey::SossKey ( int64_t  key)

Constructs a SossKey based on a signed 64-bit integer.

Parameters
keyA signed 32-bit integer to be converted to a SossKey.
sosscli::SossKey::SossKey ( const int64_t  key,
const uint32_t  app_id 
)

Constructs a SossKey based on a signed 64-bit integer.

Parameters
keyAn usigned 32-bit integer to be converted to a SossKey.
app_idApplication id of a named cache.
sosscli::SossKey::SossKey ( uint64_t  key)

Constructs a SossKey based on an unsigned 64-bit integer.

Parameters
keyA signed 32-bit integer to be converted to a SossKey.
sosscli::SossKey::SossKey ( const uint64_t  key,
const uint32_t  app_id 
)

Constructs a SossKey based on an unsigned 64-bit integer.

Parameters
keyAn usigned 32-bit integer to be converted to a SossKey.
app_idApplication id of a named cache.

Member Function Documentation

uint32_t sosscli::SossKey::app_id ( ) const
inline

Gets the StateServer application ID associated with this SossKey.

Returns
Integer identifier of a named cache.
bool sosscli::SossKey::has_app_id ( ) const
inline

Gets whether this SOSS key has been associated yet with a specific named cache.

Returns
Boolean indicating whether lazy app_id initialization of the SossKey has occurred yet.
bool sosscli::SossKey::has_string_data ( ) const
inline

Gets whether this SOSS key has string key data that is immediately available (that is, the method will only return true if retrieval of original string key data from the SOSS service is not required).

Returns
Boolean indicating whether string key data is available.
SOSS_OBJKEY sosscli::SossKey::obj_key ( ) const
inline

Gets a copy of the SOSS_OBJKEY struct associated with this SossKey instance.

Returns
A copy of a SOSS_OBJKEY structure.
const std::wstring& sosscli::SossKey::retrieve_original_string_key ( ) const
inline

Gets the locally stored SOSS string key data that is immediately available (that is, the method will only return a string if retrieval of original string key data from the SOSS service is not required).

For guaranteed string key retrieval, use NamedCache.get_key_string()

Returns
Wide string containing the locally available original string key data, or empty string if not locally available.
void sosscli::SossKey::set_app_id ( uint32_t  app_id)

Sets the StateServer application ID associated with this SossKey.

Returns
Integer identifier of a named cache.
void sosscli::SossKey::set_local_string_key_data ( const std::vector< wchar_t > &  string_key_data)
inline

Sets the string key data for the locally stored SOSS string key.

Only intended for use by the NamedCache.get_key_string() method, not for use by applications.

Parameters
string_key_dataVector of wide characters containing the string data.

The documentation for this class was generated from the following file: