-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
master
to a stable state (#123)
## Description of Changes Revert `master` to the original state of this PR: #53. We should prevent merging into `master` from now on, since the repositories are now merged. ## API - [ ] This is an API breaking change to the SDK *If the API is breaking, please state below what will break* ## Requires SpacetimeDB PRs *List any PRs here that are required for this SDK change to work* ## Testing I loaded a bitcraft world and ran around. I used the versions listed here: clockworklabs/com.clockworklabs.spacetimedbsdk-archive#57 --------- Co-authored-by: Ingvar Stepanyan <[email protected]> Co-authored-by: Zeke Foppa <[email protected]>
- Loading branch information
There are no files selected for viewing
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/) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
gefjon
Contributor
|
||
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 `/`. |
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())); | ||
} | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
#nullable enable | ||
|
||
using System; | ||
using SpacetimeDB; | ||
|
||
namespace SpacetimeDB.ClientApi | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
#nullable enable | ||
|
||
using System; | ||
using SpacetimeDB; | ||
|
||
namespace SpacetimeDB.ClientApi | ||
{ | ||
|
@bfops This reversal doesn't look right.
master
doesn't have ClientApi.cs or Protobuf dependency anymore. On the other hand, we did have tools folder with scripts mentioned in this doc before reversal, but they were removed.