mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-13 16:24:14 +01:00
let file shards register against main or so
This commit is contained in:
parent
532c123927
commit
3a9f93b157
12 changed files with 457 additions and 48 deletions
|
|
@ -6,13 +6,18 @@ using System.Text;
|
|||
|
||||
namespace MareSynchronosShared.Services;
|
||||
|
||||
public class MareConfigurationServiceServer<T> : IConfigurationService<T> where T : class, IMareConfiguration
|
||||
public sealed class MareConfigurationServiceServer<T> : IDisposable, IConfigurationService<T> where T : class, IMareConfiguration
|
||||
{
|
||||
private readonly IOptionsMonitor<T> _config;
|
||||
private bool _disposed;
|
||||
|
||||
public bool IsMain => true;
|
||||
public event EventHandler ConfigChangedEvent;
|
||||
private IDisposable _onChanged;
|
||||
|
||||
public MareConfigurationServiceServer(IOptionsMonitor<T> config)
|
||||
{
|
||||
_onChanged = _config.OnChange((c) => { ConfigChangedEvent?.Invoke(this, EventArgs.Empty); });
|
||||
_config = config;
|
||||
}
|
||||
|
||||
|
|
@ -48,4 +53,15 @@ public class MareConfigurationServiceServer<T> : IConfigurationService<T> where
|
|||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_onChanged.Dispose();
|
||||
_disposed = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue