Release URBM 2026.06.15.r008
This commit is contained in:
@@ -202,6 +202,40 @@ func (s *Service) Snapshots(ctx context.Context, repoID string) ([]model.Snapsho
|
||||
return s.restic.Snapshots(ctx, mounted.Repository)
|
||||
}
|
||||
|
||||
func (s *Service) RepositoryStats(ctx context.Context) []model.RepositoryStats {
|
||||
config := s.Config()
|
||||
result := make([]model.RepositoryStats, 0, len(config.Repositories))
|
||||
for _, repo := range config.Repositories {
|
||||
item := model.RepositoryStats{RepositoryID: repo.ID, RepositoryName: repo.Name}
|
||||
mounted, err := s.mounts.Prepare(ctx, repo)
|
||||
if err == nil {
|
||||
var stored, files restic.Stats
|
||||
stored, err = s.restic.Stats(ctx, mounted.Repository, "raw-data")
|
||||
if err == nil {
|
||||
files, err = s.restic.Stats(ctx, mounted.Repository, "restore-size")
|
||||
}
|
||||
if err == nil {
|
||||
var snapshots []model.Snapshot
|
||||
snapshots, err = s.restic.Snapshots(ctx, mounted.Repository)
|
||||
item.StoredBytes = stored.TotalSize
|
||||
item.FileCount = files.TotalFileCount
|
||||
item.SnapshotCount = len(snapshots)
|
||||
}
|
||||
if cleanupErr := s.mounts.Cleanup(context.Background(), mounted); err == nil && cleanupErr != nil {
|
||||
err = cleanupErr
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
item.Error = err.Error()
|
||||
}
|
||||
result = append(result, item)
|
||||
if ctx.Err() != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func (s *Service) SnapshotFiles(ctx context.Context, repoID, snapshot, path string) ([]map[string]any, error) {
|
||||
repo, ok := s.repository(repoID)
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user