clockworklabs / clockworklabs/SpacetimeDB
Create `RangedIndex` interface used in C# codegen similar to Rust
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 25.2k
- Forks
- 1.1k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 46
Description
Currently, the module-side generated data structures for indexes don't implement a single interface, despite all having the same interface. The generated code for these looks like
public sealed class nameIndex() : SpacetimeDB.Internal.IndexBase<global::SpacetimeDB.Modules.ModuleTestCs.TestE>("test_e_name_idx_btree") {
public IEnumerable<global::SpacetimeDB.Modules.ModuleTestCs.TestE> Filter(string name) =>
DoFilter(new SpacetimeDB.Internal.BTreeIndexBounds<string, SpacetimeDB.BSATN.String>(name));
public ulong Delete(string name) =>
DoDelete(new SpacetimeDB.Internal.BTreeIndexBounds<string, SpacetimeDB.BSATN.String>(name));
public IEnumerable<global::SpacetimeDB.Modules.ModuleTestCs.TestE> Filter(Bound<string> name) =>
DoFilter(new SpacetimeDB.Internal.BTreeIndexBounds<string, SpacetimeDB.BSATN.String>(name));
public ulong Delete(Bound<string> name) =>
DoDelete(new SpacetimeDB.Internal.BTreeIndexBounds<string, SpacetimeDB.BSATN.String>(name));
}
Either IndexBase should grow more methods, an interface should be added, or this sort of index should be converted to a single data structure.
This is a wart that could be fixed backwards-compatibly since it is only visible inside modules.
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 locating the C# code-generation entry point for module-side index structures and compare it with the similar Rust interface referenced in the issue. Determine whether RangedIndex or another backwards-compatible approach best unifies the generated indexes. Done means the generated C# indexes share the intended interface without breaking existing module code; no file or test is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100