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

@ -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);
}
}