|
| 1 | +import { Callout } from 'nextra/components' |
| 2 | + |
| 3 | +# Cloud Spanner |
| 4 | + |
| 5 | +## Usage Notes |
| 6 | + |
| 7 | +- Requires a Google Cloud Account with an active Cloud Spanner instance |
| 8 | +- Take advantage of Google's TrueTime. |
| 9 | + The Spanner driver assumes the database is linearizable and skips the transaction overlap strategy required by CockroachDB. |
| 10 | + |
| 11 | +## Developer Notes |
| 12 | + |
| 13 | +- Code can be found [here][spanner-code] |
| 14 | +- Documentation can be found [here][spanner-godoc] |
| 15 | +- Starts a background [GC worker][gc-process] to clean up old entries from the manually-generated changelog table |
| 16 | + |
| 17 | +[spanner-code]: https://github.com/authzed/spicedb/tree/main/internal/datastore/spanner |
| 18 | +[spanner-godoc]: https://pkg.go.dev/github.com/authzed/spicedb/internal/datastore/spanner |
| 19 | +[gc-process]: https://github.com/authzed/spicedb/blob/main/internal/datastore/common/gc.go |
| 20 | + |
| 21 | +## Configuration |
| 22 | + |
| 23 | +- The [Cloud Spanner docs][spanner-docs] outline how to set up an instance |
| 24 | +- Authentication via service accounts: The service account that runs migrations must have `Cloud Spanner Database Admin`; SpiceDB (non-migrations) must have `Cloud Spanner Database User`. |
| 25 | + |
| 26 | +[spanner-docs]: https://cloud.google.com/spanner |
| 27 | + |
| 28 | +### Required Parameters |
| 29 | + |
| 30 | +| Parameter | Description | Example | |
| 31 | +| -------------------- | ------------------------------------- | ---------------------------------------------------------------------------------------- | |
| 32 | +| `datastore-engine` | the datastore engine | `--datastore-engine=spanner` | |
| 33 | +| `datastore-conn-uri` | the cloud spanner database identifier | `--datastore-conn-uri="projects/project-id/instances/instance-id/databases/database-id"` | |
| 34 | + |
| 35 | +### Optional Parameters |
| 36 | + |
| 37 | +| Parameter | Description | Example | |
| 38 | +| ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ | |
| 39 | +| `datastore-spanner-credentials` | JSON service account token (omit to use [application default credentials](https://cloud.google.com/docs/authentication/production)) | `--datastore-spanner-credentials=./spanner.json` | |
| 40 | +| `datastore-gc-interval` | Amount of time to wait between garbage collection passes | `--datastore-gc-interval=3m` | |
| 41 | +| `datastore-gc-window` | Sets the window outside of which overwritten relationships are no longer accessible | `--datastore-gc-window=1s` | |
| 42 | +| `datastore-revision-fuzzing-duration` | Sets a fuzzing window on all zookies/zedtokens | `--datastore-revision-fuzzing-duration=50ms` | |
| 43 | +| `datastore-readonly` | Places the datastore into readonly mode | `--datastore-readonly=true` | |
| 44 | +| `datastore-follower-read-delay-duration` | Amount of time to subtract from non-sync revision timestamps to ensure stale reads | `--datastore-follower-read-delay-duration=4.8s` | |
0 commit comments