|
Kinetica C# API
Version 7.2.3.1
|
A binary key used for shard routing. More...
Public Member Functions | |
| RecordKey (int bufferSize) | |
| Creates a new RecordKey with the specified buffer size. More... | |
| long | HashCode () |
| Gets the hash code for stripe distribution. More... | |
| int | Route (IList< int > routingTable) |
| Routes this key to a worker index using the routing table. More... | |
| void | Invalidate () |
| Invalidates this key (e.g., when a null value is encountered). More... | |
| void | ComputeHash () |
| Computes the routing hash from the buffer contents. More... | |
| void | AddInt8 (sbyte value) |
| Adds an 8-bit integer to the key. More... | |
| void | AddInt16 (short value) |
| Adds a 16-bit integer to the key (little-endian). More... | |
| void | AddInt (int value) |
| Adds a 32-bit integer to the key (little-endian). More... | |
| void | AddLong (long value) |
| Adds a 64-bit integer to the key (little-endian). More... | |
| void | AddFloat (float value) |
| Adds a 32-bit float to the key. More... | |
| void | AddDouble (double value) |
| Adds a 64-bit double to the key. More... | |
| void | AddString (string value) |
| Adds a string to the key (via MurmurHash3). More... | |
| void | AddCharN (string value, int length) |
| Adds a fixed-length char to the key. More... | |
| void | AddDate (string value) |
| Adds a date string (YYYY-MM-DD) to the key. More... | |
| void | AddDateTime (string value) |
| Adds a datetime string (YYYY-MM-DD HH:MM:SS.mmm) to the key. More... | |
| void | AddTime (string value) |
| Adds a time string (HH:MM:SS.mmm) to the key. More... | |
| void | AddIpv4 (string value) |
| Adds an IPv4 address string (dotted-quad) to the key. More... | |
| void | AddDecimal (string value, int precision, int scale) |
| Adds a decimal string to the key. More... | |
| void | AddUuid (string value) |
| Adds a UUID string to the key. More... | |
| 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, int precision, int scale) |
| Adds a decimal value to the buffer with specified precision and scale. 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 | computeHashes () |
| 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... | |
Public Attributes | |
| bool | IsValid => _isValid && _position > 0 |
| Returns true if this key is valid (no null values were added). More... | |
| long | RoutingHash => _routingHash |
| Gets the routing hash (must call ComputeHash first). More... | |
A binary key used for shard routing.
A key based on a given record that serves as either a primary key
Equivalent to Rust's RecordKey.
This class holds a binary-encoded key buffer and computes a routing hash using MurmurHash3 for consistent shard distribution.
or a shard key. The RecordKeyBuilder<T> class creates these record keys.
Definition at line 16 of file RecordKey.cs.
|
inline |
Creates a new RecordKey with the specified buffer size.
Definition at line 26 of file RecordKey.cs.
|
inline |
Allocate the buffer for the record key with the given size.
| size | The size of the buffer. Must be greater than or equal to 1. |
Definition at line 74 of file RecordKey.cs.
|
inline |
Adds a fixed-length char to the key.
Definition at line 159 of file RecordKey.cs.
|
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.
| value | The value to be added to the byte buffer. |
| N | The 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 370 of file RecordKey.cs.
|
inline |
Adds a date string (YYYY-MM-DD) to the key.
Definition at line 184 of file RecordKey.cs.
|
inline |
Adds a string to the buffer that has the 'date' property.
Internally, the date is stored as an integer.
| value | The date string to be added. Must have the YYYY-MM-DD format. |
Definition at line 419 of file RecordKey.cs.
|
inline |
Adds a datetime string (YYYY-MM-DD HH:MM:SS.mmm) to the key.
Definition at line 206 of file RecordKey.cs.
|
inline |
Adds a string to the buffer that has the 'datetime' property.
Internally, the date is stored as a long.
| value | The datetime string to be added. Must have the YYYY-MM-DD HH:MM:SS.mmm format. |
Definition at line 488 of file RecordKey.cs.
|
inline |
Adds a decimal string to the key.
Definition at line 277 of file RecordKey.cs.
|
inline |
Adds a decimal value to the buffer with specified precision and scale.
For precision <= 18, the value is stored as an 8-byte scaled long. For precision > 18, the value is stored as a 12-byte scaled BigInteger (little-endian).
| value | The decimal string to be added. |
| precision | The total number of digits in the decimal. |
| scale | The number of digits after the decimal point. |
Definition at line 601 of file RecordKey.cs.
|
inline |
Adds a 64-bit double to the key.
Definition at line 139 of file RecordKey.cs.
|
inline |
Add a double to the buffer.
| value | The double value to be added. Can be null. |
Definition at line 306 of file RecordKey.cs.
|
inline |
Adds a 32-bit float to the key.
Definition at line 131 of file RecordKey.cs.
|
inline |
Add a float to the buffer.
| value | The float value to be added. Can be null. |
Definition at line 276 of file RecordKey.cs.
|
inline |
Adds a 32-bit integer to the key (little-endian).
Definition at line 105 of file RecordKey.cs.
|
inline |
Add an integer to the buffer.
| value | The integer value to be added. Can be null. |
Definition at line 164 of file RecordKey.cs.
|
inline |
Adds a 16-bit integer to the key (little-endian).
Definition at line 96 of file RecordKey.cs.
|
inline |
Add a short (two bytes) to the buffer.
| value | The short value to be added. Can be null. |
Definition at line 215 of file RecordKey.cs.
|
inline |
Adds an 8-bit integer to the key.
Definition at line 88 of file RecordKey.cs.
|
inline |
Add an 8-bit integer to the buffer.
| value | The integer value to be added. Can be null. |
Definition at line 193 of file RecordKey.cs.
|
inline |
Adds an IPv4 address string (dotted-quad) to the key.
Definition at line 258 of file RecordKey.cs.
|
inline |
Adds a string to the buffer that has the 'ipv4' property.
Internally, the IP is stored as an integer.
| value | The IPv4 string to be added. Must have the XXX.XXX.XXX.XXX format. |
Definition at line 686 of file RecordKey.cs.
|
inline |
Adds a 64-bit integer to the key (little-endian).
Definition at line 116 of file RecordKey.cs.
|
inline |
Add a long to the buffer.
| value | The long value to be added. Can be null. |
Definition at line 243 of file RecordKey.cs.
|
inline |
Adds a string to the key (via MurmurHash3).
Definition at line 146 of file RecordKey.cs.
|
inline |
Add a string to the buffer.
Hash the string value and add it as a long internally.
| value | The string value to be added. Can be null. |
Definition at line 341 of file RecordKey.cs.
|
inline |
Adds a time string (HH:MM:SS.mmm) to the key.
Definition at line 237 of file RecordKey.cs.
|
inline |
Adds a string to the buffer that has the 'time' property.
Internally, the time is stored as an integer.
| value | The 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 749 of file RecordKey.cs.
|
inline |
Adds a long to the buffer that has the 'timestamp' property.
| value | The timestamp to be added (in milliseconds). |
Definition at line 824 of file RecordKey.cs.
|
inline |
Adds a UUID string to the key.
Definition at line 291 of file RecordKey.cs.
|
inline |
Computes the routing hash from the buffer contents.
Definition at line 76 of file RecordKey.cs.
|
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 857 of file RecordKey.cs.
| long RecordKey.HashCode | ( | ) |
Gets the hash code for stripe distribution.
|
inline |
Returns key's hash code.
Definition at line 98 of file RecordKey.cs.
|
inline |
Invalidates this key (e.g., when a null value is encountered).
Definition at line 68 of file RecordKey.cs.
|
inline |
Returns whether the key is valid or not.
Definition at line 89 of file RecordKey.cs.
|
inline |
Routes this key to a worker index using the routing table.
Definition at line 52 of file RecordKey.cs.
|
inline |
Given a routing table consisting of worker rank indices, choose a worker rank based on the hash of the record key.
| routingTable | A list of integers which represent worker ranks. |
Definition at line 880 of file RecordKey.cs.
| bool RecordKey.IsValid => _isValid && _position > 0 |
Returns true if this key is valid (no null values were added).
Definition at line 37 of file RecordKey.cs.
| long RecordKey.RoutingHash => _routingHash |
Gets the routing hash (must call ComputeHash first).
Definition at line 42 of file RecordKey.cs.