Cut RethinkDB

Remove the vendored RethinkDb driver and its Linq provider, the Rethink
backing store, the already-stubbed RethinkConnection, the Rethink test
window, and the Rethink-only Remotion.Linq and Logging.Abstractions DLLs.
The database editor now works only on GameData/AetherDB.msgpack, with a
Save button replacing the dead Connect UI and broken JSON export.
RethinkTable becomes DatabaseCategory, which only groups editor entries.

Economy.Server still references Rethink; it was already unbuildable and
is handled separately.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-11 21:48:45 +02:00
commit f568a7d14f
683 changed files with 26 additions and 49854 deletions

View file

@ -107,13 +107,13 @@ public class TooltipAttribute : Attribute
}
[AttributeUsage(AttributeTargets.Class)]
public class RethinkTableAttribute : Attribute
public class DatabaseCategoryAttribute : Attribute
{
public string TableName;
public string Category;
public RethinkTableAttribute(string tableName)
public DatabaseCategoryAttribute(string category)
{
TableName = tableName;
Category = category;
}
}

View file

@ -13,8 +13,6 @@ using System.Text;
using System.Threading.Tasks;
using MessagePack;
using Newtonsoft.Json;
using RethinkDb.Driver;
using RethinkDb.Driver.Net;
using UniRx;
public class CultCache
@ -452,123 +450,3 @@ public class SingleFileJsonBackingStore : SingleFileBackingStore
return JsonConvert.DeserializeObject<DatabaseEntry[]>(Encoding.UTF8.GetString(data));
}
}
public class RethinkBackingStore : CacheBackingStore, RealtimeBackingStore
{
public const string DEFAULT_TABLE = "Default";
public static RethinkDB R = RethinkDB.R;
public string DatabaseName { get; }
public string ConnectionString { get; }
private string[] _syncTables;
private Connection _connection;
private Dictionary<DatabaseEntry, string> _entryHashes = new Dictionary<DatabaseEntry, string>();
public void ObserveChanges()
{
foreach (var table in _syncTables)
{
// Subscribe to changes from RethinkDB
Task.Run(async () =>
{
var result = await R
.Db(DatabaseName)
.Table(table)
.Changes()
.RunChangesAsync<DatabaseEntry>(_connection);
while (await result.MoveNextAsync())
{
var change = result.Current;
if(change.NewValue==null)
EntryDeleted.OnNext(change.OldValue);
else if(change.OldValue==null)
EntryAdded.OnNext(change.NewValue);
else EntryUpdated.OnNext(change.NewValue);
}
}).WrapAwait();
}
}
public RethinkBackingStore(string databaseName, string connectionString)
{
DatabaseName = databaseName;
ConnectionString = connectionString;
RegisterResolver.Register();
var connectionStringDomainLength = connectionString.IndexOf(':');
if (connectionStringDomainLength < 1)
throw new ArgumentException("Illegal Connection String: must include port!");
var portString = connectionString.Substring(connectionStringDomainLength + 1);
if (!int.TryParse(portString, out var port))
throw new ArgumentException($"Illegal connection string! \"{portString}\" is not a valid port number!");
_connection = R.Connection()
.Hostname(connectionString.Substring(0,connectionStringDomainLength))
.Port(port).Timeout(60).Connect();
var tables = R.Db(DatabaseName).TableList().RunAtom<string[]>(_connection);
_syncTables = typeof(DatabaseEntry).GetAllChildClasses()
.Select(t => t.GetCustomAttribute<RethinkTableAttribute>()?.TableName ?? DEFAULT_TABLE).Distinct().ToArray();
foreach (var st in _syncTables.Where(st => !tables.Contains(st)))
R.Db(DatabaseName).TableCreate(st).RunNoReply(_connection);
}
public override void PullAll()
{
foreach (var table in _syncTables)
{
// Get entries from RethinkDB
Task.Run(async () =>
{
var result = await R
.Db(DatabaseName)
.Table(table)
.RunCursorAsync<DatabaseEntry>(_connection);
while (await result.MoveNextAsync())
{
var entry = result.Current;
EntryAdded.OnNext(entry);
}
}).WrapAwait();
}
}
public override async void Push(DatabaseEntry entry)
{
var type = entry.GetType();
//(Entries.ContainsKey(entry.ID) ? EntryUpdated : EntryAdded).OnNext(entry);
var table = type.GetCustomAttribute<RethinkTableAttribute>()?.TableName ?? DEFAULT_TABLE;
var result = await R
.Db(DatabaseName)
.Table(table)
.Get(entry.ID)
.Replace(entry)
.RunAsync(_connection);
}
public override async void Delete(DatabaseEntry entry)
{
if(Entries.ContainsKey(entry.ID))
{
var type = entry.GetType();
var table = type.GetCustomAttribute<RethinkTableAttribute>()?.TableName ?? DEFAULT_TABLE;
var result = await R
.Db(DatabaseName)
.Table(table)
.Get(entry.ID)
.Delete()
.RunAsync(_connection);
}
}
public override void PushAll(bool soft = false)
{
foreach(var entry in Entries.Values)
Push(entry);
}
}

View file

@ -1,34 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Newtonsoft.Json;
using RethinkDb.Driver;
using RethinkDb.Driver.Ast;
using RethinkDb.Driver.Net;
public static class RethinkConnection
{
public static RethinkDB R = RethinkDB.R;
public static RethinkQueryStatus RethinkConnect(CultCache cache, string connectionString, string dbName, bool syncLocalChanges = true)
{
var status = new RethinkQueryStatus();
return status;
}
}
public class RethinkQueryStatus
{
public int RetrievedEntries;
public int TotalEntries;
}

View file

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a8fce60db4f3e614c8d19c3da4cede0e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -4,7 +4,6 @@ using MessagePack;
using MessagePack.ReactivePropertyExtension;
using MessagePack.Resolvers;
using Newtonsoft.Json;
using RethinkDb.Driver.Net;
public static class RegisterResolver
{
@ -29,11 +28,7 @@ public static class RegisterResolver
{
Converters = new List<JsonConverter>
{
new MathJsonConverter(),
Converter.DateTimeConverter,
Converter.BinaryConverter,
Converter.GroupingConverter,
Converter.PocoExprConverter
new MathJsonConverter()
}
};