Table of Contents

Class ShardInfo

Namespace
Excalibur.Data.Sharding
Assembly
Excalibur.Data.Abstractions.dll

Describes a data shard's connection and routing metadata.

public sealed record ShardInfo : IEquatable<ShardInfo>
Inheritance
ShardInfo
Implements
Inherited Members

Constructors

ShardInfo(string, string, string?, string?, string?, string?)

Describes a data shard's connection and routing metadata.

public ShardInfo(string ShardId, string ConnectionString, string? SchemaName = null, string? DatabaseName = null, string? IndexPrefix = null, string? Region = null)

Parameters

ShardId string

The unique shard identifier.

ConnectionString string

The connection string for this shard's primary data store.

SchemaName string

Optional schema name for schema-per-tenant isolation (SQL Server/Postgres).

DatabaseName string

Optional database name for database-per-tenant isolation.

IndexPrefix string

Optional index prefix for document/search store isolation (Elasticsearch, CosmosDB).

Region string

Optional region hint for geo-distributed shards.

Properties

ConnectionString

The connection string for this shard's primary data store.

public string ConnectionString { get; init; }

Property Value

string

DatabaseName

Optional database name for database-per-tenant isolation.

public string? DatabaseName { get; init; }

Property Value

string

IndexPrefix

Optional index prefix for document/search store isolation (Elasticsearch, CosmosDB).

public string? IndexPrefix { get; init; }

Property Value

string

Region

Optional region hint for geo-distributed shards.

public string? Region { get; init; }

Property Value

string

SchemaName

Optional schema name for schema-per-tenant isolation (SQL Server/Postgres).

public string? SchemaName { get; init; }

Property Value

string

ShardId

The unique shard identifier.

public string ShardId { get; init; }

Property Value

string

Methods

RequireCoordinate(string?, string)

Returns an isolation coordinate this shard declares, or throws when it does not declare one.

public string RequireCoordinate(string? value, string coordinateName)

Parameters

value string

The coordinate read from this shard entry.

coordinateName string

The coordinate's name, for the message.

Returns

string

The declared value.

Remarks

A shard exists to keep one tenant's data apart from another's, so a coordinate it does not declare cannot be filled from a shared default: two shards that both omit the same coordinate resolve to the same physical location, and the tenants mapped to them are silently commingled with no error and no log. Where the intended value genuinely is the deployment default, the shard entry states it — an isolation boundary is not something to infer from a null.

Exceptions

InvalidOperationException

Thrown when the shard declares no value.