Kinetica   C#   API  Version 7.2.3.0
kinetica.Utils.RecordKey Class Reference

A key based on a given record that serves as either a primary key or a shard key. More...

Public Member Functions

 RecordKey (int size)
 Allocate the buffer for the record key with the given size. More...
 
bool isValid ()
 Returns whether the key is valid or not. More...
 
int hashCode ()
 Returns key's hash code. More...
 
void addInt (int? value)
 Add an integer to the buffer. More...
 
void addInt8 (int? value)
 Add an 8-bit integer to the buffer. More...
 
void addInt16 (int? value)
 Add a short (two bytes) to the buffer. More...
 
void addLong (long? value)
 Add a long to the buffer. More...
 
void addFloat (float? value)
 Add a float to the buffer. More...
 
void addDouble (double? value)
 Add a double to the buffer. More...
 
void addString (string value)
 Add a string to the buffer. More...
 
void addCharN (string value, int N)
 Appends a charN value to the buffer. More...
 
void addDate (string value)
 Adds a string to the buffer that has the 'date' property. More...
 
void addDateTime (string value)
 Adds a string to the buffer that has the 'datetime' property. More...
 
void addDecimal (string value)
 Adds a string to the buffer that has the 'decimal' property. More...
 
void addIPv4 (string value)
 Adds a string to the buffer that has the 'ipv4' property. More...
 
void addTime (string value)
 Adds a string to the buffer that has the 'time' property. More...
 
void addTimeStamp (long? value)
 Adds a long to the buffer that has the 'timestamp' property. More...
 
void computHashes ()
 Compute the hash of the key in the buffer. More...
 
int route (IList< int > routingTable)
 Given a routing table consisting of worker rank indices, choose a worker rank based on the hash of the record key. More...
 

Detailed Description

A key based on a given record that serves as either a primary key or a shard key.

The RecordKeyBuilder<T> class creates these record keys.

Definition at line 13 of file RecordKey.cs.

Constructor & Destructor Documentation

◆ RecordKey()

kinetica.Utils.RecordKey.RecordKey ( int  size)
inline

Allocate the buffer for the record key with the given size.

Parameters
sizeThe size of the buffer. Must be greater than or equal to 1.

Definition at line 77 of file RecordKey.cs.

Member Function Documentation

◆ addCharN()

void kinetica.Utils.RecordKey.addCharN ( string  value,
int  N 
)
inline

Appends a charN value to the buffer.

If value is longer than N in length, it gets truncated. If it is shorter, then the remaining characters get padded with byte 0.

Parameters
valueThe value to be added to the byte buffer.
NThe number of characters to be added to the byte buffer. If N is greater than what would fit in the buffer, then an exception is thrown.

Definition at line 373 of file RecordKey.cs.

◆ addDate()

void kinetica.Utils.RecordKey.addDate ( string  value)
inline

Adds a string to the buffer that has the 'date' property.

Internally, the date is stored as an integer.

Parameters
valueThe date string to be added. Must have the YYYY-MM-DD format.

Definition at line 422 of file RecordKey.cs.

◆ addDateTime()

void kinetica.Utils.RecordKey.addDateTime ( string  value)
inline

Adds a string to the buffer that has the 'datetime' property.

Internally, the date is stored as a long.

Parameters
valueThe datetime string to be added. Must have the YYYY-MM-DD HH:MM:SS.mmm format.

Definition at line 491 of file RecordKey.cs.

◆ addDecimal()

void kinetica.Utils.RecordKey.addDecimal ( string  value)
inline

Adds a string to the buffer that has the 'decimal' property.

Internally, the date is stored as a long.

Parameters
valueThe date string to be added. Must have upto 19 digits of precision and four digits of scale format.

Definition at line 602 of file RecordKey.cs.

◆ addDouble()

void kinetica.Utils.RecordKey.addDouble ( double?  value)
inline

Add a double to the buffer.

Parameters
valueThe double value to be added. Can be null.

Definition at line 309 of file RecordKey.cs.

◆ addFloat()

void kinetica.Utils.RecordKey.addFloat ( float?  value)
inline

Add a float to the buffer.

Parameters
valueThe float value to be added. Can be null.

Definition at line 279 of file RecordKey.cs.

◆ addInt()

void kinetica.Utils.RecordKey.addInt ( int?  value)
inline

Add an integer to the buffer.

Parameters
valueThe integer value to be added. Can be null.

Definition at line 167 of file RecordKey.cs.

◆ addInt16()

void kinetica.Utils.RecordKey.addInt16 ( int?  value)
inline

Add a short (two bytes) to the buffer.

Parameters
valueThe short value to be added. Can be null.

Definition at line 218 of file RecordKey.cs.

◆ addInt8()

void kinetica.Utils.RecordKey.addInt8 ( int?  value)
inline

Add an 8-bit integer to the buffer.

Parameters
valueThe integer value to be added. Can be null.

Definition at line 196 of file RecordKey.cs.

◆ addIPv4()

void kinetica.Utils.RecordKey.addIPv4 ( string  value)
inline

Adds a string to the buffer that has the 'ipv4' property.

Internally, the IP is stored as an integer.

Parameters
valueThe IPv4 string to be added. Must have the XXX.XXX.XXX.XXX format.

Definition at line 706 of file RecordKey.cs.

◆ addLong()

void kinetica.Utils.RecordKey.addLong ( long?  value)
inline

Add a long to the buffer.

Parameters
valueThe long value to be added. Can be null.

Definition at line 246 of file RecordKey.cs.

◆ addString()

void kinetica.Utils.RecordKey.addString ( string  value)
inline

Add a string to the buffer.

Hash the string value and add it as a long internally.

Parameters
valueThe string value to be added. Can be null.

Definition at line 344 of file RecordKey.cs.

◆ addTime()

void kinetica.Utils.RecordKey.addTime ( string  value)
inline

Adds a string to the buffer that has the 'time' property.

Internally, the time is stored as an integer.

Parameters
valueThe time string to be added. Must have the HH:MM:SS[.mmm] format. Milliseconds can have one to three digits. HH can be one or two digits.

Definition at line 769 of file RecordKey.cs.

◆ addTimeStamp()

void kinetica.Utils.RecordKey.addTimeStamp ( long?  value)
inline

Adds a long to the buffer that has the 'timestamp' property.

Parameters
valueThe timestamp to be added (in milliseconds).

Definition at line 844 of file RecordKey.cs.

◆ computHashes()

void kinetica.Utils.RecordKey.computHashes ( )
inline

Compute the hash of the key in the buffer.

Use the Murmurhash3 algorithm to compute the hash. If not all of the values have been added to the key (i.e. if the buffer is not full), then throw an exception.

Definition at line 877 of file RecordKey.cs.

◆ hashCode()

int kinetica.Utils.RecordKey.hashCode ( )
inline

Returns key's hash code.

Returns
The hash code for the key.

Definition at line 101 of file RecordKey.cs.

◆ isValid()

bool kinetica.Utils.RecordKey.isValid ( )
inline

Returns whether the key is valid or not.

Returns
A bool indicating whether the key is valid at the moment.

Definition at line 92 of file RecordKey.cs.

◆ route()

int kinetica.Utils.RecordKey.route ( IList< int >  routingTable)
inline

Given a routing table consisting of worker rank indices, choose a worker rank based on the hash of the record key.

Parameters
routingTableA list of integers which represent worker ranks.
Returns
The appropriate entry fromroutingTable .

Definition at line 900 of file RecordKey.cs.


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