adds the ability for shards to sync with the main server regarding their caches, when pulling files from main server the shard can stream it to the client directly while downloading and add info for server to report to client regarding file locations across shards
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using LightlessSync.API.Routes;
|
||||
using LightlessSyncShared.Utils.Configuration;
|
||||
using LightlessSyncStaticFilesServer.Services;
|
||||
using LightlessSyncShared.Models;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@@ -63,4 +64,19 @@ public class MainController : ControllerBase
|
||||
return BadRequest();
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(LightlessFiles.Main_ShardFiles)]
|
||||
public IActionResult ShardFilesUpdate([FromBody] ShardFileInventoryUpdateDto update)
|
||||
{
|
||||
try
|
||||
{
|
||||
var applied = _shardRegistrationService.ApplyFileInventoryUpdate(LightlessUser, update);
|
||||
return Ok(new ShardFileInventoryUpdateAckDto { AppliedSequence = applied });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Shard file inventory update failed: {shard}", LightlessUser);
|
||||
return BadRequest();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user