Release URBM 2026.06.15.r008
This commit is contained in:
@@ -91,6 +91,12 @@ type Progress struct {
|
||||
|
||||
type ProgressCallback func(Progress)
|
||||
|
||||
type Stats struct {
|
||||
TotalSize int64 `json:"total_size"`
|
||||
TotalFileCount int64 `json:"total_file_count"`
|
||||
TotalBlobCount int64 `json:"total_blob_count"`
|
||||
}
|
||||
|
||||
func (r *Runner) Init(ctx context.Context, repo model.Repository) error {
|
||||
return r.run(ctx, repo, []string{"init"}, nil, nil)
|
||||
}
|
||||
@@ -191,6 +197,22 @@ func (r *Runner) Snapshots(ctx context.Context, repo model.Repository) ([]model.
|
||||
return snapshots, nil
|
||||
}
|
||||
|
||||
func (r *Runner) Stats(ctx context.Context, repo model.Repository, mode string) (Stats, error) {
|
||||
args := []string{"stats", "--json"}
|
||||
if mode != "" {
|
||||
args = append(args, "--mode", mode)
|
||||
}
|
||||
var output []byte
|
||||
if err := r.run(ctx, repo, args, nil, &output); err != nil {
|
||||
return Stats{}, err
|
||||
}
|
||||
var stats Stats
|
||||
if err := json.Unmarshal(output, &stats); err != nil {
|
||||
return Stats{}, fmt.Errorf("decode repository stats: %w", err)
|
||||
}
|
||||
return stats, nil
|
||||
}
|
||||
|
||||
func (r *Runner) List(ctx context.Context, repo model.Repository, snapshot, path string) ([]map[string]any, error) {
|
||||
args := []string{"ls", snapshot, "--json"}
|
||||
if path != "" {
|
||||
|
||||
Reference in New Issue
Block a user