Skip to main content
pub struct RecordKey  /* private fields */ 

Implementations

Source

pub fn new(size: usize) -> Self

Source

pub fn bytes(&self) -> &[u8]

The encoded key bytes.

Source

pub fn routing_hash(&self) -> u64

The hash that selects the shard, valid once RecordKey::compute_hashes has run.

Source

pub fn is_valid(&self) -> bool

Whether every value encoded into this key was usable.

Source

pub fn route(&self, routing_table: &[i32]) -> usize

Source

pub fn compute_hashes(&mut self)

Source

pub fn push_i32(&mut self, v: i32)

Source

pub fn push_i64(&mut self, v: i64)

Source

pub fn push_f32(&mut self, v: f32)

Source

pub fn push_f64(&mut self, v: f64)

Source

pub fn push_null(&mut self, width: usize)

Appends a null value of a type whose encoding is width bytes wide: that many zero bytes.

Source

pub fn push_bool(&mut self, v: bool)

Appends a boolean value (1 byte: 1 for true, 0 for false).

Source

pub fn push_i8(&mut self, v: i8)

Appends an 8-bit signed integer (1 byte).

Source

pub fn push_i16(&mut self, v: i16)

Appends a 16-bit signed integer (2 bytes, little-endian).

Source

pub fn push_char(&mut self, val: &str, length: usize)

Source

pub fn push_string(&mut self, val: &str)

Source

pub fn push_date(&mut self, val: &str)

Source

pub fn push_timestamp(&mut self, millis: i64)

Appends a timestamp value (milliseconds since Unix epoch) as 8 bytes packed datetime.

Encoding (64 bits):

  • Bits 53-63: year-1900 (11 bits)
  • Bits 49-52: month (4 bits)
  • Bits 44-48: day (5 bits)
  • Bits 39-43: hour (5 bits)
  • Bits 33-38: minute (6 bits)
  • Bits 27-32: second (6 bits)
  • Bits 17-26: millisecond (10 bits)
  • Bits 8-16: day of year (9 bits)
  • Bits 5-7: day of week (3 bits)
Source

pub fn push_datetime(&mut self, val: &str)

Appends a datetime value from string format “YYYY-MM-DD HH:MM:SS.mmm”

Source

pub fn push_time(&mut self, val: &str)

Appends a time value from string format “HH:MM:SS.mmm”

Encoding (32 bits):

  • Bits 26-31: hour (6 bits)
  • Bits 20-25: minute (6 bits)
  • Bits 14-19: second (6 bits)
  • Bits 4-13: millisecond (10 bits)
Source

pub fn push_uuid(&mut self, val: &str)

Appends a UUID value from string format “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”

Encoding (16 bytes) - special little-endian packing:

  • Bytes 0-3: Last 8 hex digits of last group (reversed)
  • Bytes 4-5: First 4 hex digits of last group (reversed)
  • Bytes 6-7: Fourth group (reversed)
  • Bytes 8-9: Third group (reversed)
  • Bytes 10-11: Second group (reversed)
  • Bytes 12-15: First group (reversed)
Source

pub fn push_ulong(&mut self, val: &str) -> Result<(), KineticaError>

Appends an unsigned long given as text: the value’s low 64 bits, little-endian like every other number in the key.

The text must be one to twenty digits, or this writes nothing and fails. That check is of the form, not the range, so a twenty-digit value above u64::MAX passes and keeps only its low 64 bits.

Only ASCII digits are accepted, as for a look-up filter (see RecordKeyBuilder::build_expression). The server refuses other digits too (“invalid ulong”), so such a record fails either way; here it fails before it is sent.

Source

pub fn push_ipv4(&mut self, val: &str)

Source

pub fn push_decimal(&mut self, val: &str, precision: usize, scale: usize)

Appends a decimal value given as text: the text is parsed as an exact decimal and rounded HALF_UP to scale, and text that is not a number, or is wider than precision at that scale, encodes as zero. A precision of up to 18 takes 8 bytes and a wider one 12, both two’s complement.

Trait Implementations

Source

fn fmt(&self, f: &mut Formatter<’_>) -> Result

Formats the value using the given formatter. Read more