clockworklabs / clockworklabs/SpacetimeDB
Trait for auto-inc sentinel values
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 25.2k
- Forks
- 1.1k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 46
Description
Currently we use 0 all over the place in the codebase, implicitly because it is the sentinel value that means "replace me when I am inserted in to a table with a sequence defined on my column". We should make a trait for this. I would propose something like:
trait AutoIncrementable {
/// A constant that will be replaced with a unique value upon insertion into a column with the `auto_inc` attribute.
const SENTINEL: Self;
}
or something like that in spacetimedb_lib. This can be used in the client SDK, module SDK, and in the core database for e.g. SystemIDs.
Note that "auto-inc" and "sequence" are used as synonyms throughout the codebase. We should probably also settle on one of these for consistency of documentation...
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by surveying the sentinel-value uses across spacetimedb_lib, the client SDK, the module SDK, and the core database, including SystemIDs. Review how auto-inc and sequence are currently documented before evaluating the proposed AutoIncrementable trait. Done means the shared sentinel representation is consistently adopted across the named areas and the terminology is settled in documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- database
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100