Skip to content
PACKAGES

shardByTenant()

Build a passive { shardBy, shardCount } pair for tenant-isolated sharding.

import { shardByTenant } from "@graphrefly/ts/patterns";
function shardByTenant(
tenantOf: (fragment: MemoryFragment<T>) => string,
opts: ShardByTenantOptions = {},
): ShardByTenantConfig<T>
ParameterTypeDescription
tenantOf(fragment: MemoryFragment<T>) => stringtenant of value used by the helper.
optsShardByTenantOptionsOptions that configure the helper.

A ShardByTenantConfig<T> value.

import { shardByTenant } from "@graphrefly/ts/patterns";

packages/ts/src/patterns/semantic-memory.ts