API Reference
shardByTenant()
Build a passive { shardBy, shardCount } pair for tenant-isolated sharding.
Import
import { shardByTenant } from "@graphrefly/ts/patterns";
Signature
function shardByTenant(
tenantOf: (fragment: MemoryFragment<T>) => string,
opts: ShardByTenantOptions = {},
): ShardByTenantConfig<T>
Parameters
| Parameter | Type | Description |
|---|---|---|
tenantOf | (fragment: MemoryFragment<T>) => string | tenant of value used by the helper. |
opts | ShardByTenantOptions | Options that configure the helper. |
Returns
A ShardByTenantConfig<T> value.
Example
import { shardByTenant } from "@graphrefly/ts/patterns";
Source
packages/ts/src/patterns/semantic-memory.ts