feat(backend): directory scanner — diff, error state, covers, cache sweep, redis lock

This commit is contained in:
2026-09-05 00:31:32 +08:00
parent 4e84a8aeb7
commit 193d7612b5
7 changed files with 410 additions and 7 deletions
+8 -3
View File
@@ -1,6 +1,7 @@
package api
import (
"context"
"io"
"log"
"net/http"
@@ -82,11 +83,15 @@ func (a *api) getLibrary(c *gin.Context) (store.Library, bool) {
}
func (a *api) scanLibrary(c *gin.Context) {
if _, ok := a.getLibrary(c); !ok {
lib, ok := a.getLibrary(c)
if !ok {
return
}
// Task 9 接线: go a.sc.ScanLibraryByID(...)
err(c, http.StatusNotImplemented, "not_ready", "scanner not wired yet")
if _, ok := a.libRoot(c, lib); !ok {
return
}
go a.sc.ScanLibraryByID(context.WithoutCancel(c), lib.ID)
c.JSON(http.StatusAccepted, gin.H{"accepted": true})
}
func (a *api) upload(c *gin.Context) {