Move IndexType and Consume helper to internals

This commit is contained in:
Ingvar Stepanyan
2024-06-24 19:17:10 +01:00
parent fadf4dd451
commit bac9df4edc
2 changed files with 17 additions and 17 deletions
@@ -3,11 +3,18 @@ namespace SpacetimeDB.Internal.Module;
using SpacetimeDB.BSATN;
[SpacetimeDB.Type]
public partial struct IndexDef(string name, Runtime.IndexType type, bool isUnique, uint[] columnIds)
public enum IndexType : byte
{
BTree,
Hash,
}
[SpacetimeDB.Type]
public partial struct IndexDef(string name, IndexType type, bool isUnique, uint[] columnIds)
{
string IndexName = name;
bool IsUnique = isUnique;
Runtime.IndexType Type = type;
IndexType Type = type;
uint[] ColumnIds = columnIds;
}
@@ -177,6 +184,14 @@ public static class FFI
TypeRegistrar.Module.Tables.Add(T.MakeTableDesc(TypeRegistrar));
}
private static byte[] Consume(this SpacetimeDB.Internal.FFI.Buffer buffer)
{
var len = SpacetimeDB.Internal.FFI._buffer_len(buffer);
var result = new byte[len];
SpacetimeDB.Internal.FFI._buffer_consume(buffer, result, len);
return result;
}
public static SpacetimeDB.Internal.FFI.Buffer __describe_module__()
{
// replace `module` with a temporary internal module that will register ModuleDef, AlgebraicType and other internal types
-15
View File
@@ -30,21 +30,6 @@ public class ScheduleToken
public static class Runtime
{
[SpacetimeDB.Type]
public enum IndexType : byte
{
BTree,
Hash,
}
internal static byte[] Consume(this FFI.Buffer buffer)
{
var len = FFI._buffer_len(buffer);
var result = new byte[len];
FFI._buffer_consume(buffer, result, len);
return result;
}
public enum LogLevel : byte
{
Error,