mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-18 23:03:13 +09:00
Load datastores with SubscribableDatastore.fromProvider
clusterio#1129 replaced DatastoreProvider.bootstrap with async factories and Instance now takes its FactorioServer in the constructor, so the instance tests pass their server stub there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e84bd97b99
commit
afc1d35668
11 files changed
+69
-87
No files matched your search
@@ -11,19 +11,15 @@ function migrateReports(rawJson: unknown[]) {
|
||||
export default async function (context: ControllerPluginContext) {
|
||||
const { controller, logger, plugin } = context;
|
||||
const databaseDirectory = controller.config.get("controller.database_directory");
|
||||
const reports = new lib.SubscribableDatastore(
|
||||
...await new lib.JsonIdDatastoreProvider(
|
||||
path.join(databaseDirectory, "exp_reports", "reports.json"),
|
||||
messages.ReportRecord.fromJSON.bind(messages.ReportRecord),
|
||||
migrateReports,
|
||||
).bootstrap()
|
||||
);
|
||||
const watchList = new lib.SubscribableDatastore(
|
||||
...await new lib.JsonIdDatastoreProvider(
|
||||
path.join(databaseDirectory, "exp_reports", "watch_list.json"),
|
||||
messages.WatchListRecord.fromJSON.bind(messages.WatchListRecord),
|
||||
).bootstrap()
|
||||
);
|
||||
const reports = await lib.SubscribableDatastore.fromProvider(new lib.JsonIdDatastoreProvider(
|
||||
path.join(databaseDirectory, "exp_reports", "reports.json"),
|
||||
messages.ReportRecord.fromJSON.bind(messages.ReportRecord),
|
||||
migrateReports,
|
||||
));
|
||||
const watchList = await lib.SubscribableDatastore.fromProvider(new lib.JsonIdDatastoreProvider(
|
||||
path.join(databaseDirectory, "exp_reports", "watch_list.json"),
|
||||
messages.WatchListRecord.fromJSON.bind(messages.WatchListRecord),
|
||||
));
|
||||
|
||||
/** Every report, or only those against one player. */
|
||||
function listReports(playerName?: string) {
|
||||
|
||||
Reference in new issue
Block a user