mount: append repository ID to FS name of FUSE mount

This commit is contained in:
Srigovind Nayak 2025-02-08 16:06:03 +05:30
parent da47967316
commit eb0e8d316d
No known key found for this signature in database
GPG Key ID: 09006810B7263D69
2 changed files with 18 additions and 1 deletions

View File

@ -5,6 +5,7 @@ package main
import (
"context"
"fmt"
"os"
"strings"
"time"
@ -141,9 +142,16 @@ func runMount(ctx context.Context, opts MountOptions, gopts GlobalOptions, args
return err
}
repositoryID, err := repo.ID()
if err != nil {
return err
}
fuseMountName := fmt.Sprintf("restic:%s", repositoryID)
mountOptions := []systemFuse.MountOption{
systemFuse.ReadOnly(),
systemFuse.FSName("restic"),
systemFuse.FSName(fuseMountName),
systemFuse.MaxReadahead(128 * 1024),
}

View File

@ -143,6 +143,15 @@ func (r *Repository) Config() restic.Config {
return r.cfg
}
// ID returns the repository ID.
func (r *Repository) ID() (restic.ID, error) {
id, err := restic.ParseID(r.cfg.ID)
if err != nil {
return restic.ID{}, err
}
return id, nil
}
// packSize return the target size of a pack file when uploading
func (r *Repository) packSize() uint {
return r.opts.PackSize