Lot 3 (1/4) : racine S3, backend du Store (catalogue + objets minio-go)
Arborescence dans s3_nodes, contenus sous des clés o/<id> figées au dépôt, corbeille dans s3_trash, configuration admin dans s3_config. Délégations S3 dans List/Stat/Open/Put/Mkdir/Move/Copy/Delete/Walk/corbeille, miniatures, partages, tags, recherche (noms et tags). Pas d'historique. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LNfwm4pfYR9C914C2EeiuB
This commit is contained in:
1 parent
235916157a
commit
7c1f49cb5c
13 files changed
+379
-29
No files matched your search
@@ -114,6 +114,9 @@ func (s *Store) trashEntry(id string) (string, trashInfo, error) {
|
||||
|
||||
// TrashItems liste la corbeille, les suppressions les plus récentes en premier.
|
||||
func (s *Store) TrashItems() ([]TrashItem, error) {
|
||||
if s.s3 != nil {
|
||||
return s.s3TrashItems()
|
||||
}
|
||||
des, err := os.ReadDir(filepath.Join(s.root, trashDir))
|
||||
if errors.Is(err, fs.ErrNotExist) {
|
||||
return []TrashItem{}, nil
|
||||
@@ -146,6 +149,9 @@ func (s *Store) TrashItems() ([]TrashItem, error) {
|
||||
|
||||
// TrashCount renvoie le nombre d'éléments dans la corbeille.
|
||||
func (s *Store) TrashCount() int {
|
||||
if s.s3 != nil {
|
||||
return s.s3TrashCount()
|
||||
}
|
||||
des, _ := os.ReadDir(filepath.Join(s.root, trashDir))
|
||||
n := 0
|
||||
for _, de := range des {
|
||||
@@ -159,6 +165,9 @@ func (s *Store) TrashCount() int {
|
||||
// RestoreTrash remet un élément à son emplacement d'origine (dossiers parents
|
||||
// recréés au besoin), sous un autre nom si la place est prise.
|
||||
func (s *Store) RestoreTrash(id string) (Entry, error) {
|
||||
if s.s3 != nil {
|
||||
return s.s3RestoreTrash(id)
|
||||
}
|
||||
name, info, err := s.trashEntry(id)
|
||||
if err != nil {
|
||||
return Entry{}, err
|
||||
@@ -193,6 +202,12 @@ func (s *Store) RestoreTrash(id string) (Entry, error) {
|
||||
|
||||
// DropTrash supprime définitivement un élément de la corbeille.
|
||||
func (s *Store) DropTrash(id string) error {
|
||||
if s.s3 != nil {
|
||||
if !trashID.MatchString(id) {
|
||||
return fmt.Errorf("%w : élément de corbeille %q", ErrInvalidPath, id)
|
||||
}
|
||||
return s.s3DropTrash(func(i string) bool { return i == id })
|
||||
}
|
||||
if _, _, err := s.trashEntry(id); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -214,6 +229,9 @@ func (s *Store) PurgeTrashOlder(maxAge time.Duration) error {
|
||||
}
|
||||
|
||||
func (s *Store) purgeTrash(drop func(id string) bool) error {
|
||||
if s.s3 != nil {
|
||||
return s.s3DropTrash(drop)
|
||||
}
|
||||
root := filepath.Join(s.root, trashDir)
|
||||
des, err := os.ReadDir(root)
|
||||
if errors.Is(err, fs.ErrNotExist) {
|
||||
|
||||
Reference in new issue
Block a user