mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-14 07:47:13 +00:00
For a file under maps/ master watches the file a world would read now: the override when one is there, else the client's. An override that appears, changes or goes away makes the instances that read another version stale, also for files from the packs. The dashboard can hold a zone's automatic reloads (WORLD_RELOAD_HOLD, a new message after the existing ones) until a reload of the zone is asked for. The status sent to the dashboard counts what reloads did per zone. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
52 lines
1.8 KiB
C++
52 lines
1.8 KiB
C++
#ifndef WORLDRELOADER_H
|
|
#define WORLDRELOADER_H
|
|
|
|
#include <functional>
|
|
#include <string>
|
|
|
|
#include "RakNetTypes.h"
|
|
|
|
class Instance;
|
|
struct MigrationStatus;
|
|
struct WorldFilesReport;
|
|
struct WorldFilesStatus;
|
|
struct WorldReloadRequest;
|
|
|
|
/**
|
|
* Master's side of world hot reload (docs/WorldHotReload.md). Worlds report the zone files they loaded (WORLD_FILES);
|
|
* master watches them (size and mtime every world_watch_seconds, then a hash on a worker thread; for a file under
|
|
* maps/ that is the file in the override folder, zone_override_dir, when one is there) and, when one changes
|
|
* or a GM or the dashboard asks (WORLD_RELOAD), replaces the affected instances with new ones on the files on disk,
|
|
* moving their players with the instance migration (MigrationCoordinator). Main thread only.
|
|
*/
|
|
namespace WorldReloader {
|
|
// Where the dashboard's status goes (WORLD_FILES_STATUS)
|
|
void SetPublisher(std::function<void(const WorldFilesStatus&)> publisher);
|
|
|
|
// A world reported its files
|
|
void HandleReport(const SystemAddress& from, const WorldFilesReport& report);
|
|
|
|
// A GM's /reloadworld or the dashboard; who is for the log
|
|
void HandleRequest(const WorldReloadRequest& request, const std::string& who);
|
|
|
|
// The dashboard holds (or stops holding) a zone's automatic reloads; a request for the zone ends a hold
|
|
void SetHold(uint32_t zoneId, bool hold);
|
|
|
|
// Every migration's progress (MigrationCoordinator's observer)
|
|
void OnMigrationStatus(const MigrationStatus& status);
|
|
|
|
// A world server went away
|
|
void OnInstanceGone(const Instance& instance);
|
|
|
|
// The dashboard connected: send it the status again
|
|
void Republish();
|
|
|
|
// Every master frame: polls the files, finishes hashes and reloads what changed
|
|
void Update();
|
|
|
|
// Waits for a running hash (at shutdown)
|
|
void Shutdown();
|
|
};
|
|
|
|
#endif // WORLDRELOADER_H
|