feat(backend): immutable cache dir scheme + stale sweep
This commit is contained in:
@@ -262,6 +262,24 @@ func (s *Store) ListBooks(ctx context.Context, libID int64, q, prefix string, us
|
||||
return out, rows.Err()
|
||||
}
|
||||
|
||||
func (s *Store) BookHashes(ctx context.Context) (map[int64][2]int64, error) {
|
||||
rows, err := s.P.Query(ctx, "SELECT id, file_size, mod_ts FROM books")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
out := map[int64][2]int64{}
|
||||
for rows.Next() {
|
||||
var id int64
|
||||
var v [2]int64
|
||||
if err := rows.Scan(&id, &v[0], &v[1]); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out[id] = v
|
||||
}
|
||||
return out, rows.Err()
|
||||
}
|
||||
|
||||
// ---------- progress ----------
|
||||
|
||||
func (s *Store) UpsertProgress(ctx context.Context, userID, libID int64, bookPath string, locator []byte, percent float64) error {
|
||||
|
||||
Reference in New Issue
Block a user