GraphReFlyTS

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

ParameterTypeDescription
tenantOf(fragment: MemoryFragment<T>) => stringtenant of value used by the helper.
optsShardByTenantOptionsOptions that configure the helper.

Returns

A ShardByTenantConfig<T> value.

Example

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

Source

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