feat: add account-scoped data synchronization
This commit is contained in:
@@ -4,11 +4,12 @@ using WxAgent.Windows;
|
||||
|
||||
namespace WxAgent.Host;
|
||||
|
||||
public sealed class WindowsAgentBackend(AccountBindingStore bindings, ServiceOptions options) : IAgentBackend, IAgentEventSource
|
||||
public sealed class WindowsAgentBackend(AccountBindingStore bindings, ServiceOptions options) : IAgentBackend, IAgentEventSource, IRemoteDataCollector
|
||||
{
|
||||
private readonly bool validationOperationsEnabled = options.EnableValidationOperations;
|
||||
private readonly bool listenerEventsEnabled = options.EnableListenerEvents;
|
||||
private readonly SemaphoreSlim bindingGate = new(1, 1);
|
||||
private readonly DatabaseMessageSyncCollector databaseSyncCollector = new(null, options.DataSyncBatchLimit, options.DataSyncOverlapRows);
|
||||
|
||||
public IReadOnlyList<AgentCapability> Capabilities =>
|
||||
[
|
||||
@@ -439,6 +440,13 @@ public sealed class WindowsAgentBackend(AccountBindingStore bindings, ServiceOpt
|
||||
return new Page<GroupMemberInfo>(items, limit, offset, page.HasMore, page.NextOffset);
|
||||
}
|
||||
|
||||
public Task<RemoteDataCollection> CollectAsync(
|
||||
string accountId,
|
||||
IReadOnlyList<RemoteReportingScope> scopes,
|
||||
RemoteDataSyncCheckpoint checkpoint,
|
||||
CancellationToken cancellationToken) =>
|
||||
databaseSyncCollector.CollectAsync(accountId, scopes, checkpoint, cancellationToken);
|
||||
|
||||
public async Task<IReadOnlyList<DatabaseMessageInfo>> DatabaseMessagesAsync(string accountId, string chatId, int limit, long? localId, CancellationToken cancellationToken)
|
||||
{
|
||||
var account = await DatabaseKeyStore.LoadAsync(null, cancellationToken);
|
||||
|
||||
Reference in New Issue
Block a user