mirror of
https://github.com/kopia/kopia.git
synced 2026-01-25 06:48:48 -05:00
- `repo.Repository` is now read-only and only has methods that can be supported over kopia server
- `repo.RepositoryWriter` has read-write methods that can be supported over kopia server
- `repo.DirectRepository` is read-only and contains all methods of `repo.Repository` plus some low-level methods for data inspection
- `repo.DirectRepositoryWriter` contains write methods for `repo.DirectRepository`
- `repo.Reader` removed and merged with `repo.Repository`
- `repo.Writer` became `repo.RepositoryWriter`
- `*repo.DirectRepository` struct became `repo.DirectRepository`
interface
Getting `{Direct}RepositoryWriter` requires using `NewWriter()` or `NewDirectWriter()` on a read-only repository and multiple simultaneous writers are supported at the same time, each writing to their own indexes and pack blobs.
`repo.Open` returns `repo.Repository` (which is also `repo.RepositoryWriter`).
* content: removed implicit flush on content manager close
* repo: added tests for WriteSession() and implicit flush behavior
* invalidate manifest manager after write session
* cli: disable maintenance in 'kopia server start'
Server will close the repository before completing.
* repo: unconditionally close RepositoryWriter in {Direct,}WriteSession
* repo: added panic in case somebody tries to create RepositoryWriter after closing repository
- used atomic to manage SharedManager.closed
* removed stale example
* linter: fixed spurious failures
Co-authored-by: Julio López <julio+gh@kasten.io>
36 lines
933 B
Go
36 lines
933 B
Go
package cli
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/kopia/kopia/repo"
|
|
"github.com/kopia/kopia/repo/blob"
|
|
)
|
|
|
|
var (
|
|
blobListCommand = blobCommands.Command("list", "List BLOBs").Alias("ls")
|
|
blobListPrefix = blobListCommand.Flag("prefix", "Blob ID prefix").String()
|
|
blobListMinSize = blobListCommand.Flag("min-size", "Minimum size").Int64()
|
|
blobListMaxSize = blobListCommand.Flag("max-size", "Maximum size").Int64()
|
|
)
|
|
|
|
func runBlobList(ctx context.Context, rep repo.DirectRepository) error {
|
|
return rep.BlobReader().ListBlobs(ctx, blob.ID(*blobListPrefix), func(b blob.Metadata) error {
|
|
if *blobListMaxSize != 0 && b.Length > *blobListMaxSize {
|
|
return nil
|
|
}
|
|
|
|
if *blobListMinSize != 0 && b.Length < *blobListMinSize {
|
|
return nil
|
|
}
|
|
|
|
fmt.Printf("%-70v %10v %v\n", b.BlobID, b.Length, formatTimestamp(b.Timestamp))
|
|
return nil
|
|
})
|
|
}
|
|
|
|
func init() {
|
|
blobListCommand.Action(directRepositoryReadAction(runBlobList))
|
|
}
|