Kinetica   C#   API  Version 7.2.3.1
IShardKeyExtractor Interface Reference

Interface for extracting shard key values from a record. More...

+ Inheritance diagram for IShardKeyExtractor:

Public Member Functions

ShardKeyValues GetShardKeyValues ()
 Returns shard key column names and their typed values. More...
 

Detailed Description

Interface for extracting shard key values from a record.

Equivalent to Rust's ShardKeyExtractor trait.

Implementing this interface enables shard-aware routing in the BulkInserter, allowing records to be sent directly to the correct worker node based on their shard key values.

public class SensorReading : IShardKeyExtractor
{
public int Id { get; set; }
public string Region { get; set; }
public double Value { get; set; }
{
// Single shard key column
// Or for composite shard keys:
// return new ShardKeyValues(
// ("id", ShardKeyValue.Int(Id)),
// ("region", ShardKeyValue.String(Region))
// );
}
}

Definition at line 34 of file IShardKeyExtractor.cs.

Member Function Documentation

◆ GetShardKeyValues()

ShardKeyValues IShardKeyExtractor.GetShardKeyValues ( )

Returns shard key column names and their typed values.

Only columns that are part of the shard key need to be included. The values are used for computing the routing hash to determine which worker node should receive the record.

For best performance, implement this method to avoid allocations when possible (e.g., use ShardKeyValues.Single() for single-column keys).

Returns
A collection of (column name, value) pairs for the shard key.

Implemented in GenericRecord, Example.AllTypesExample.AllTypesRecord, Kinetica.Benchmarks.BulkInserterBenchmarks.BenchRecord, Kinetica.LoadGenerator.IngestRecord2, Example.SensorReading, Example.ShardKeyExample.ShardedRecord, Kinetica.Tests.IntegrationTests.BulkInserterTests.ShardedRecord, Kinetica.LoadGenerator.IngestRecord, Kinetica.Tests.IntegrationTests.BulkInserterTests.TestRecord, and Kinetica.Tests.IntegrationTests.BulkInserterDebugTest.TestRecord.


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