-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into bfops/prevent-master-merge
- Loading branch information
Showing
20 changed files
with
151 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
# Notes for maintainers | ||
|
||
## `SpacetimeDB.ClientApi` | ||
## `ClientApi.cs` | ||
|
||
To regenerate this namespace, run the `tools/gen-client-api.sh` or the | ||
`tools/gen-client-api.bat` script. | ||
The file `ClientApi.cs` is generated by [ProtoBuf](https://protobuf.dev/) | ||
from [the SpacetimeDB client-api-messages proto definition](https://github.com/clockworklabs/SpacetimeDB/blob/master/crates/client-api-messages/protobuf/client_api.proto). | ||
This is not automated. | ||
Whenever the `client_api.proto` changes, you'll have to manually re-run `protoc` to re-generate the definitions. | ||
|
||
```sh | ||
cd ~/clockworklabs/SpacetimeDB/crates/client-api-messages/protobuf | ||
protoc --csharp_out=/absolute/path/to/spacetimedb-csharp-sdk/src \ | ||
./client_api.proto | ||
``` | ||
|
||
Note that `protoc` cannot understand paths that start with `~`; | ||
you must write the absolute path starting from `/`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
using SpacetimeDB.BSATN; | ||
|
||
using System; | ||
using System.IO; | ||
|
||
namespace SpacetimeDB | ||
{ | ||
|
||
public struct I128 : IEquatable<I128> | ||
{ | ||
public long hi; | ||
public ulong lo; | ||
|
||
public I128(long hi, ulong lo) | ||
{ | ||
this.hi = hi; | ||
this.lo = lo; | ||
} | ||
|
||
public readonly bool Equals(I128 x) => hi == x.hi && lo == x.lo; | ||
|
||
public override readonly bool Equals(object? o) => o is I128 x && Equals(x); | ||
|
||
public static bool operator ==(I128 a, I128 b) => a.Equals(b); | ||
public static bool operator !=(I128 a, I128 b) => !a.Equals(b); | ||
|
||
public override readonly int GetHashCode() => hi.GetHashCode() ^ lo.GetHashCode(); | ||
|
||
public override readonly string ToString() => $"I128({hi},{lo})"; | ||
|
||
public readonly struct BSATN : IReadWrite<I128> | ||
{ | ||
public I128 Read(BinaryReader reader) => new(reader.ReadInt64(), reader.ReadUInt64()); | ||
|
||
public void Write(BinaryWriter writer, I128 value) | ||
{ | ||
writer.Write(value.hi); | ||
writer.Write(value.lo); | ||
} | ||
|
||
public AlgebraicType GetAlgebraicType(ITypeRegistrar registrar) => | ||
new AlgebraicType.Builtin(new BuiltinType.I128(new Unit())); | ||
} | ||
} | ||
|
||
public struct U128 : IEquatable<U128> | ||
{ | ||
public ulong hi; | ||
public ulong lo; | ||
|
||
public U128(ulong hi, ulong lo) | ||
{ | ||
this.lo = lo; | ||
this.hi = hi; | ||
} | ||
|
||
public readonly bool Equals(U128 x) => hi == x.hi && lo == x.lo; | ||
|
||
public override readonly bool Equals(object? o) => o is U128 x && Equals(x); | ||
|
||
public static bool operator ==(U128 a, U128 b) => a.Equals(b); | ||
public static bool operator !=(U128 a, U128 b) => !a.Equals(b); | ||
|
||
public override readonly int GetHashCode() => hi.GetHashCode() ^ lo.GetHashCode(); | ||
|
||
public override readonly string ToString() => $"U128({hi},{lo})"; | ||
|
||
public readonly struct BSATN : IReadWrite<U128> | ||
{ | ||
public U128 Read(BinaryReader reader) => new(reader.ReadUInt64(), reader.ReadUInt64()); | ||
|
||
public void Write(BinaryWriter writer, U128 value) | ||
{ | ||
writer.Write(value.hi); | ||
writer.Write(value.lo); | ||
} | ||
|
||
public AlgebraicType GetAlgebraicType(ITypeRegistrar registrar) => | ||
new AlgebraicType.Builtin(new BuiltinType.U128(new Unit())); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
#nullable enable | ||
|
||
using System; | ||
using SpacetimeDB; | ||
|
||
namespace SpacetimeDB.ClientApi | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
#nullable enable | ||
|
||
using System; | ||
using SpacetimeDB; | ||
|
||
namespace SpacetimeDB.ClientApi | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.