feat(backend): directory scanner — diff, error state, covers, cache sweep, redis lock
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user