03-sharded-read-write

command
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 10 Imported by: 0

README

Sharding with read/write splitting

This example maps 128 virtual shards over two physical replica sets. Generated routed methods derive the shard key through tenantResolver; reads use replicas by default and writes always use the selected primary.

The sharded account store exposes two groups: Accounts() for commands and lookups, and Reports() for the tenant-scoped account count. It also reads and writes application_settings through a separate generated Store backed by one database. The root-store configurations keep account routing sharded and settings routing unsharded.

Required variables are SHARD0_PRIMARY_DSN, SHARD0_REPLICA_DSN, SHARD1_PRIMARY_DSN, SHARD1_REPLICA_DSN, and SETTINGS_DSN.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL