repo
stringlengths
6
47
file_url
stringlengths
77
269
file_path
stringlengths
5
186
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-07 08:35:43
2026-01-07 08:55:24
truncated
bool
2 classes
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/upgrade_repo.go
internal/repository/upgrade_repo.go
package repository import ( "context" "fmt" "os" "path/filepath" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/restic" ) type upgradeRepoV2Error struct { UploadNewConfigError error ReuploadOldConfigError error BackupFilePath string } func (err *upgradeRepoV2Error) Error(...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/warmup_test.go
internal/repository/warmup_test.go
package repository import ( "context" "testing" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/mock" "github.com/restic/restic/internal/restic" ) func TestWarmupRepository(t *testing.T) { warmupCalls := [][]backend.Handle{} warmupWaitCalls := [][]backend.Handle{} simul...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/lock_test.go
internal/repository/lock_test.go
package repository import ( "context" "fmt" "os" "runtime" "strings" "sync" "testing" "time" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/mem" "github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/restic" rtest "github.com/restic/restic/int...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/packer_uploader.go
internal/repository/packer_uploader.go
package repository import ( "context" "github.com/restic/restic/internal/restic" "golang.org/x/sync/errgroup" ) // savePacker implements saving a pack in the repository. type savePacker interface { savePacker(ctx context.Context, t restic.BlobType, p *packer) error } type uploadTask struct { packer *packer tp...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/prune_internal_test.go
internal/repository/prune_internal_test.go
package repository import ( "context" "math" "math/rand" "testing" "time" "github.com/restic/restic/internal/restic" rtest "github.com/restic/restic/internal/test" "github.com/restic/restic/internal/ui/progress" ) // TestPruneMaxUnusedDuplicate checks that MaxUnused correctly accounts for duplicates. // // C...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/warmup.go
internal/repository/warmup.go
package repository import ( "context" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/restic" ) type WarmupJob struct { repo *Repository handlesWarmingUp []backend.Handle } // HandleCount returns the number of handles that are currently warming up. func (job *WarmupJo...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/testing.go
internal/repository/testing.go
package repository import ( "context" "fmt" "os" "sync" "testing" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/local" "github.com/restic/restic/internal/backend/mem" "github.com/restic/restic/internal/backend/retry" "github.com/restic/restic/internal/crypto" "githu...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/repository.go
internal/repository/repository.go
package repository import ( "bytes" "context" "fmt" "io" "math" "runtime" "sort" "sync" "github.com/klauspost/compress/zstd" "github.com/restic/chunker" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/cache" "github.com/restic/restic/internal/backend/dryrun" "githu...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
true
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/repository_test.go
internal/repository/repository_test.go
package repository_test import ( "bytes" "context" "crypto/sha256" "fmt" "io" "math/rand" "path/filepath" "strings" "sync" "sync/atomic" "testing" "time" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/cache" "github.com/restic/restic/internal/backend/local" "git...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/doc.go
internal/repository/doc.go
// Package repository implements a restic repository on top of a backend. In // the following the abstractions used for this package are listed. More // information can be found in the restic design document. // // # File // // A file is a named handle for some data saved in the backend. For the local // backend, this ...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/prune_test.go
internal/repository/prune_test.go
package repository_test import ( "context" "fmt" "math" "math/rand" "testing" "time" "github.com/restic/restic/internal/repository" "github.com/restic/restic/internal/repository/pack" "github.com/restic/restic/internal/restic" rtest "github.com/restic/restic/internal/test" "github.com/restic/restic/interna...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/repair_pack.go
internal/repository/repair_pack.go
package repository import ( "context" "errors" "io" "github.com/restic/restic/internal/restic" "github.com/restic/restic/internal/ui/progress" ) func RepairPacks(ctx context.Context, repo *Repository, ids restic.IDSet, printer progress.Printer) error { printer.P("salvaging intact data from specified pack files...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/key.go
internal/repository/key.go
package repository import ( "context" "encoding/json" "fmt" "os" "os/user" "time" "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/restic" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/crypto" "github.com/restic/restic/internal/debug" ) var ( ...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/prune.go
internal/repository/prune.go
package repository import ( "context" "fmt" "math" "sort" "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/repository/index" "github.com/restic/restic/internal/repository/pack" "github.com/restic/restic/internal/restic" "github.com/restic/restic/internal/ui/progress" ) var ErrIn...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/raw.go
internal/repository/raw.go
package repository import ( "bytes" "context" "fmt" "io" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/restic" ) // LoadRaw reads all data stored in the backend for the file with id and filetype t. // If the backend returns data that does not match the id, then the buffer is re...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/repair_pack_test.go
internal/repository/repair_pack_test.go
package repository_test import ( "context" "math/rand" "testing" "time" "github.com/restic/restic/internal/backend" backendtest "github.com/restic/restic/internal/backend/test" "github.com/restic/restic/internal/repository" "github.com/restic/restic/internal/restic" rtest "github.com/restic/restic/internal/t...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/repack.go
internal/repository/repack.go
package repository import ( "context" "sync" "github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/feature" "github.com/restic/restic/internal/restic" "github.com/restic/restic/internal/ui/progress" "golang.org/x/sync/errgroup" ) type repackB...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/index/associated_data.go
internal/repository/index/associated_data.go
package index import ( "iter" "slices" "sort" "github.com/restic/restic/internal/restic" ) type associatedSetSub[T any] struct { value []T isSet []bool } // AssociatedSet is a memory efficient implementation of a BlobSet that can // store a small data item for each BlobHandle. It relies on a special property ...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/index/index_parallel_test.go
internal/repository/index/index_parallel_test.go
package index_test import ( "context" "path/filepath" "testing" "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/repository" "github.com/restic/restic/internal/repository/index" "github.com/restic/restic/internal/restic" rtest "github.com/restic/restic/internal/test" ) var repoFi...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/index/index.go
internal/repository/index/index.go
package index import ( "bytes" "context" "encoding/json" "io" "iter" "math" "sync" "time" "github.com/restic/restic/internal/crypto" "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/repository/pack" "github.com/restic/restic/internal/restic" "github.com/restic/restic/interna...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/index/indexmap_test.go
internal/repository/index/indexmap_test.go
package index import ( "math/rand" "testing" "time" "github.com/restic/restic/internal/restic" rtest "github.com/restic/restic/internal/test" ) func TestIndexMapBasic(t *testing.T) { t.Parallel() var ( id restic.ID m indexMap r = rand.New(rand.NewSource(98765)) ) for i := 1; i <= 400; i++ { r.Re...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/index/index_test.go
internal/repository/index/index_test.go
package index_test import ( "bytes" "context" "fmt" "math/rand" "sync" "testing" "github.com/restic/restic/internal/repository/index" "github.com/restic/restic/internal/restic" rtest "github.com/restic/restic/internal/test" ) func TestIndexSerialize(t *testing.T) { tests := []restic.PackedBlob{} idx := i...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/index/index_internal_test.go
internal/repository/index/index_internal_test.go
package index import ( "testing" "github.com/restic/restic/internal/repository/pack" "github.com/restic/restic/internal/restic" rtest "github.com/restic/restic/internal/test" ) func TestIndexOversized(t *testing.T) { idx := NewIndex() // Add blobs up to indexMaxBlobs + pack.MaxHeaderEntries - 1 packID := idx...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/index/indexmap.go
internal/repository/index/indexmap.go
package index import ( "hash/maphash" "iter" "github.com/restic/restic/internal/restic" ) // An indexMap is a chained hash table that maps blob IDs to indexEntries. // It allows storing multiple entries with the same key. // // IndexMap uses some optimizations that are not compatible with supporting // deletions....
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/index/index_parallel.go
internal/repository/index/index_parallel.go
package index import ( "context" "runtime" "sync" "github.com/restic/restic/internal/restic" ) // ForAllIndexes loads all index files in parallel and calls the given callback. // It is guaranteed that the function is not run concurrently. If the callback // returns an error, this function is cancelled and also r...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/index/testing.go
internal/repository/index/testing.go
package index import ( "testing" "github.com/restic/restic/internal/restic" "github.com/restic/restic/internal/test" ) func TestMergeIndex(t testing.TB, mi *MasterIndex) ([]*Index, int, restic.IDSet) { finalIndexes := mi.finalizeNotFinalIndexes() ids := restic.NewIDSet() for _, idx := range finalIndexes { id...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/index/master_index.go
internal/repository/index/master_index.go
package index import ( "context" "fmt" "iter" "runtime" "sync" "github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/restic" "github.com/restic/restic/internal/ui/progress" "golang.org/x/sync/errgroup" ) // MasterIndex is a collection of indexes and IDs of chunks that are in the proce...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/index/master_index_test.go
internal/repository/index/master_index_test.go
package index_test import ( "context" "fmt" "math/rand" "runtime" "testing" "time" "github.com/restic/restic/internal/checker" "github.com/restic/restic/internal/crypto" "github.com/restic/restic/internal/data" "github.com/restic/restic/internal/repository" "github.com/restic/restic/internal/repository/ind...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/index/associated_data_test.go
internal/repository/index/associated_data_test.go
package index import ( "context" "slices" "testing" "github.com/restic/restic/internal/crypto" "github.com/restic/restic/internal/restic" "github.com/restic/restic/internal/test" ) type noopSaver struct{} func (n *noopSaver) Connections() uint { return 2 } func (n *noopSaver) SaveUnpacked(_ context.Context, ...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/pack/pack_test.go
internal/repository/pack/pack_test.go
package pack_test import ( "bytes" "context" "crypto/rand" "crypto/sha256" "encoding/json" "io" "testing" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/mem" "github.com/restic/restic/internal/crypto" "github.com/restic/restic/internal/repository/pack" "github.com/r...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/pack/pack_internal_test.go
internal/repository/pack/pack_internal_test.go
package pack import ( "bytes" "encoding/binary" "io" "strings" "testing" "github.com/restic/restic/internal/crypto" "github.com/restic/restic/internal/restic" rtest "github.com/restic/restic/internal/test" ) func TestParseHeaderEntry(t *testing.T) { h := headerEntry{ Type: 0, // Blob Length: 100, } ...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/pack/pack.go
internal/repository/pack/pack.go
package pack import ( "bytes" "context" "encoding/binary" "fmt" "io" "sync" "github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/restic" "github.com/restic/restic/internal/crypto" ) // Packer is used to create a new Pack. type Packer struc...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/pack/doc.go
internal/repository/pack/doc.go
// Package pack provides functions for combining and parsing pack files. package pack
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/hashing/writer_test.go
internal/repository/hashing/writer_test.go
package hashing import ( "bytes" "crypto/rand" "crypto/sha256" "io" "testing" ) func TestWriter(t *testing.T) { tests := []int{5, 23, 2<<18 + 23, 1 << 20} for _, size := range tests { data := make([]byte, size) _, err := io.ReadFull(rand.Reader, data) if err != nil { t.Fatalf("ReadFull: %v", err) }...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/hashing/writer.go
internal/repository/hashing/writer.go
package hashing import ( "hash" "io" ) // Writer transparently hashes all data while writing it to the underlying writer. type Writer struct { w io.Writer h hash.Hash } // NewWriter wraps the writer w and feeds all data written to the hash h. func NewWriter(w io.Writer, h hash.Hash) *Writer { return &Writer{ ...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/hashing/reader.go
internal/repository/hashing/reader.go
package hashing import ( "hash" "io" ) // A Reader hashes all data read from the underlying reader. type Reader struct { r io.Reader h hash.Hash } // NewReader returns a new Reader that uses the hash h. func NewReader(r io.Reader, h hash.Hash) *Reader { return &Reader{r: r, h: h} } func (h *Reader) Read(p []by...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/repository/hashing/reader_test.go
internal/repository/hashing/reader_test.go
package hashing import ( "bytes" "crypto/rand" "crypto/sha256" "io" "testing" ) func TestReader(t *testing.T) { tests := []int{5, 23, 2<<18 + 23, 1 << 20} for _, size := range tests { data := make([]byte, size) _, err := io.ReadFull(rand.Reader, data) if err != nil { t.Fatalf("ReadFull: %v", err) }...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/watchdog_roundtriper_test.go
internal/backend/watchdog_roundtriper_test.go
package backend import ( "bytes" "context" "fmt" "io" "net/http" "net/http/httptest" "testing" "time" rtest "github.com/restic/restic/internal/test" ) func TestRead(t *testing.T) { data := []byte("abcdef") var ctr int kick := func() { ctr++ } var closed bool onClose := func() { closed = true } i...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/http_transport.go
internal/backend/http_transport.go
package backend import ( "crypto/tls" "crypto/x509" "encoding/pem" "net" "net/http" "os" "strings" "time" "github.com/peterbourgon/unixtransport" "github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/feature" "golang.org/x/net/http2" ) //...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/readerat.go
internal/backend/readerat.go
package backend import ( "context" "io" "github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/errors" ) type backendReaderAt struct { ctx context.Context be Backend h Handle } func (brd backendReaderAt) ReadAt(p []byte, offset int64) (n int, err error) { return ReadAt(brd.ctx, brd....
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/file.go
internal/backend/file.go
package backend import ( "fmt" "github.com/restic/restic/internal/errors" ) // FileType is the type of a file in the backend. type FileType uint8 // These are the different data types a backend can store. const ( PackFile FileType = 1 + iota KeyFile LockFile SnapshotFile IndexFile ConfigFile ) func (t File...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/rewind_reader_test.go
internal/backend/rewind_reader_test.go
package backend import ( "bytes" "crypto/md5" "hash" "io" "math/rand" "os" "path/filepath" "testing" "time" "github.com/restic/restic/internal/test" ) func TestByteReader(t *testing.T) { buf := []byte("foobar") for _, hasher := range []hash.Hash{nil, md5.New()} { fn := func() RewindReader { return N...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/file_test.go
internal/backend/file_test.go
package backend import ( "testing" rtest "github.com/restic/restic/internal/test" ) func TestHandleString(t *testing.T) { rtest.Equals(t, "<data/foobar>", Handle{Type: PackFile, Name: "foobar"}.String()) rtest.Equals(t, "<lock/1>", Handle{Type: LockFile, Name: "1"}.String()) } func TestHandleValid(t *testing.T)...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/shell_split.go
internal/backend/shell_split.go
package backend import ( "unicode" "github.com/restic/restic/internal/errors" ) // shellSplitter splits a command string into separated arguments. It supports // single and double quoted strings. type shellSplitter struct { quote rune lastChar rune } func (s *shellSplitter) isSplitChar(c rune) bool { // onl...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/httpuseragent_roundtripper_test.go
internal/backend/httpuseragent_roundtripper_test.go
package backend import ( "net/http" "net/http/httptest" "testing" ) func TestCustomUserAgentTransport(t *testing.T) { // Create a mock HTTP handler that checks the User-Agent header handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { userAgent := r.Header.Get("User-Agent") if userAgent...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/watchdog_roundtriper.go
internal/backend/watchdog_roundtriper.go
package backend import ( "context" "errors" "fmt" "io" "net/http" "sync/atomic" "time" ) var errRequestTimeout = fmt.Errorf("request timeout") // watchdogRoundtripper cancels an http request if an upload or download did not make progress // within timeout. The time between fully sending the request and receiv...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/rewind_reader.go
internal/backend/rewind_reader.go
package backend import ( "bytes" "hash" "io" "github.com/restic/restic/internal/errors" ) // RewindReader allows resetting the Reader to the beginning of the data. type RewindReader interface { io.Reader // Rewind rewinds the reader so the same data can be read again from the // start. Rewind() error // L...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/shell_split_test.go
internal/backend/shell_split_test.go
package backend import ( "reflect" "testing" ) func TestShellSplitter(t *testing.T) { var tests = []struct { data string args []string }{ { `foo`, []string{"foo"}, }, { `'foo'`, []string{"foo"}, }, { `foo bar baz`, []string{"foo", "bar", "baz"}, }, { `foo 'bar' baz`, []st...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/backend.go
internal/backend/backend.go
package backend import ( "context" "fmt" "hash" "io" ) var ErrNoRepository = fmt.Errorf("repository does not exist") // Backend is used to store and access data. // // Backend operations that return an error will be retried when a Backend is // wrapped in a RetryBackend. To prevent that from happening, the opera...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/backend_test.go
internal/backend/backend_test.go
package backend_test import ( "testing" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/test" ) type testBackend struct { backend.Backend } func (t *testBackend) Unwrap() backend.Backend { return nil } type otherTestBackend struct { backend.Backend } func (t *otherTestBackend)...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/doc.go
internal/backend/doc.go
// Package backend provides local and remote storage for restic repositories. // All backends need to implement the Backend interface. There is a MemBackend, // which stores all data in a map internally and can be used for testing. package backend
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/httpuseragent_roundtripper.go
internal/backend/httpuseragent_roundtripper.go
package backend import "net/http" // httpUserAgentRoundTripper is a custom http.RoundTripper that modifies the User-Agent header // of outgoing HTTP requests. type httpUserAgentRoundTripper struct { userAgent string rt http.RoundTripper } func newCustomUserAgentRoundTripper(rt http.RoundTripper, userAgent s...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/util/limited_reader.go
internal/backend/util/limited_reader.go
package util import "io" // LimitedReadCloser wraps io.LimitedReader and exposes the Close() method. type LimitedReadCloser struct { io.Closer io.LimitedReader } // LimitReadCloser returns a new reader wraps r in an io.LimitedReader, but also // exposes the Close() method. func LimitReadCloser(r io.ReadCloser, n i...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/util/defaults.go
internal/backend/util/defaults.go
package util import ( "context" "io" "github.com/restic/restic/internal/backend" ) // DefaultLoad implements Backend.Load using lower-level openReader func func DefaultLoad(ctx context.Context, h backend.Handle, length int, offset int64, openReader func(ctx context.Context, h backend.Handle, length int, offset i...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/util/defaults_test.go
internal/backend/util/defaults_test.go
package util_test import ( "context" "io" "testing" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/util" "github.com/restic/restic/internal/errors" rtest "github.com/restic/restic/internal/test" ) type mockReader struct { closed bool } func (rd *mockReader) Read(_ []...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/util/paths.go
internal/backend/util/paths.go
package util import "os" type Modes struct { Dir os.FileMode File os.FileMode } // DefaultModes defines the default permissions to apply to new repository // files and directories stored on file-based backends. var DefaultModes = Modes{Dir: 0700, File: 0600} // DeriveModesFromFileInfo will, given the mode of a r...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/logger/log.go
internal/backend/logger/log.go
package logger import ( "context" "io" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/debug" ) type Backend struct { backend.Backend } // statically ensure that Backend implements backend.Backend. var _ backend.Backend = &Backend{} func New(be backend.Backend) *Backend { retur...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/sftp/sftp_test.go
internal/backend/sftp/sftp_test.go
package sftp_test import ( "fmt" "os" "path/filepath" "strings" "testing" "github.com/restic/restic/internal/backend/sftp" "github.com/restic/restic/internal/backend/test" "github.com/restic/restic/internal/errors" rtest "github.com/restic/restic/internal/test" ) func findSFTPServerBinary() string { for _,...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/sftp/sftp.go
internal/backend/sftp/sftp.go
package sftp import ( "bufio" "context" "crypto/rand" "encoding/hex" "fmt" "hash" "io" "os" "os/exec" "path" "time" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/layout" "github.com/restic/restic/internal/backend/limiter" "github.com/restic/restic/internal/backe...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/sftp/config.go
internal/backend/sftp/config.go
package sftp import ( "net/url" "path" "strings" "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/options" ) // Config collects all information required to connect to an sftp server. type Config struct { User, Host, Port, Path string Command string `option:"command" help:"specify...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/sftp/config_test.go
internal/backend/sftp/config_test.go
package sftp import ( "testing" "github.com/restic/restic/internal/backend/test" ) var configTests = []test.ConfigTestData[Config]{ // first form, user specified sftp://user@host/dir { S: "sftp://user@host/dir/subdir", Cfg: Config{User: "user", Host: "host", Path: "dir/subdir", Connections: 5}, }, { S:...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/sftp/sshcmd_test.go
internal/backend/sftp/sshcmd_test.go
package sftp import ( "reflect" "testing" ) var sshcmdTests = []struct { cfg Config cmd string args []string err string }{ { Config{User: "user", Host: "host", Path: "dir/subdir"}, "ssh", []string{"host", "-l", "user", "-s", "sftp"}, "", }, { Config{Host: "host", Path: "dir/subdir"}, "ssh", ...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/sftp/layout_test.go
internal/backend/sftp/layout_test.go
package sftp_test import ( "context" "fmt" "path/filepath" "testing" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/sftp" rtest "github.com/restic/restic/internal/test" ) func TestLayout(t *testing.T) { if sftpServer == "" { t.Skip("sftp server binary not available")...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/sftp/doc.go
internal/backend/sftp/doc.go
// Package sftp implements repository storage in a directory on a remote server // via the sftp protocol. package sftp
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/cache/file.go
internal/backend/cache/file.go
package cache import ( "fmt" "io" "os" "path/filepath" "runtime" "github.com/pkg/errors" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/util" "github.com/restic/restic/internal/crypto" "github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/resti...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/cache/dir_test.go
internal/backend/cache/dir_test.go
package cache import ( "os" "testing" rtest "github.com/restic/restic/internal/test" ) // DefaultDir should honor RESTIC_CACHE_DIR on all platforms. func TestCacheDirEnv(t *testing.T) { cachedir := os.Getenv("RESTIC_CACHE_DIR") if cachedir == "" { cachedir = "/doesnt/exist" err := os.Setenv("RESTIC_CACHE_D...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/cache/cache.go
internal/backend/cache/cache.go
package cache import ( "fmt" "os" "path/filepath" "regexp" "strconv" "sync" "time" "github.com/pkg/errors" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/restic" ) // Cache manages a local cache. type Cache struct { path string ...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/cache/cache_test.go
internal/backend/cache/cache_test.go
package cache import ( "os" "path/filepath" "testing" "github.com/restic/restic/internal/restic" rtest "github.com/restic/restic/internal/test" ) func TestNew(t *testing.T) { parent := rtest.TempDir(t) basedir := filepath.Join(parent, "cache") id := restic.NewRandomID().String() tagFile := filepath.Join(bas...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/cache/file_test.go
internal/backend/cache/file_test.go
package cache import ( "bytes" "fmt" "io" "math/rand" "os" "runtime" "testing" "time" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/restic" rtest "github.com/restic/restic/internal/test" "golang.org/x/sync/errgroup" ) func gene...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/cache/backend.go
internal/backend/cache/backend.go
package cache import ( "context" "io" "sync" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/restic" ) // Backend wraps a restic.Backend and adds a cache. type Backend struct { backend.Backend *Cache // inProgress contains the handle ...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/cache/testing.go
internal/backend/cache/testing.go
package cache import ( "testing" "github.com/restic/restic/internal/restic" "github.com/restic/restic/internal/test" ) // TestNewCache returns a cache in a temporary directory which is removed when // cleanup is called. func TestNewCache(t testing.TB) *Cache { dir := test.TempDir(t) t.Logf("created new cache at...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/cache/backend_test.go
internal/backend/cache/backend_test.go
package cache import ( "bytes" "context" "io" "math/rand" "strings" "sync" "testing" "time" "github.com/pkg/errors" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/mem" backendtest "github.com/restic/restic/internal/backend/test" "github.com/restic/restic/internal/r...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/cache/dir.go
internal/backend/cache/dir.go
package cache import ( "fmt" "os" "path/filepath" ) // EnvDir return $RESTIC_CACHE_DIR env func EnvDir() string { return os.Getenv("RESTIC_CACHE_DIR") } // DefaultDir returns $RESTIC_CACHE_DIR, or the default cache directory // for the current OS if that variable is not set. func DefaultDir() (cachedir string, e...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/sema/semaphore.go
internal/backend/sema/semaphore.go
// Package sema implements semaphores. package sema import ( "github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/errors" ) // A semaphore limits access to a restricted resource. type semaphore struct { ch chan struct{} } // newSemaphore returns a new semaphore with capacity n. func newSem...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/sema/backend.go
internal/backend/sema/backend.go
package sema import ( "context" "io" "sync" "github.com/cenkalti/backoff/v4" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/errors" ) // make sure that connectionLimitedBackend implements backend.Backend var _ backend.Backend = &connectionLimitedBackend{} // connectionLimitedBa...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/sema/backend_test.go
internal/backend/sema/backend_test.go
package sema_test import ( "context" "io" "sync" "sync/atomic" "testing" "time" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/mock" "github.com/restic/restic/internal/backend/sema" "github.com/restic/restic/internal/test" "golang.org/x/sync/errgroup" ) func TestPar...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/mock/backend.go
internal/backend/mock/backend.go
package mock import ( "context" "hash" "io" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/errors" ) // Backend implements a mock backend. type Backend struct { CloseFn func() error IsNotExistFn func(err error) bool IsPermanentErrorFn func(err error) bool Sav...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/azure/azure_test.go
internal/backend/azure/azure_test.go
package azure_test import ( "bytes" "context" "fmt" "io" "os" "testing" "time" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/azure" "github.com/restic/restic/internal/backend/test" "github.com/restic/restic/internal/options" "github.com/restic/restic/internal/resti...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/azure/config.go
internal/backend/azure/config.go
package azure import ( "os" "path" "strconv" "strings" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/options" ) // Config contains all configuration necessary to connect to an azure compatible // server. type Config struct { AccountN...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/azure/azure.go
internal/backend/azure/azure.go
package azure import ( "bytes" "context" "crypto/md5" "encoding/base64" "fmt" "hash" "io" "net/http" "path" "strings" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/layout" "github.com/restic/restic/internal/backend/location" "github.com/restic/restic/internal/bac...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/azure/config_test.go
internal/backend/azure/config_test.go
package azure import ( "testing" "github.com/restic/restic/internal/backend/test" ) var configTests = []test.ConfigTestData[Config]{ {S: "azure:container-name:/", Cfg: Config{ Container: "container-name", Prefix: "", Connections: 5, }}, {S: "azure:container-name:/prefix/directory", Cfg: Config{ C...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/rclone/stdio_conn.go
internal/backend/rclone/stdio_conn.go
package rclone import ( "net" "os" "os/exec" "sync" "time" "github.com/restic/restic/internal/debug" ) // StdioConn implements a net.Conn via stdin/stdout. type StdioConn struct { receive *os.File send *os.File cmd *exec.Cmd closeRecv sync.Once closeSend sync.Once } func (s *StdioConn) Read(...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/rclone/config.go
internal/backend/rclone/config.go
package rclone import ( "strings" "time" "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/options" ) // Config contains all configuration necessary to start rclone. type Config struct { Program string `option:"program" help:"path to rclone (default: rclone)"` Args string...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/rclone/config_test.go
internal/backend/rclone/config_test.go
package rclone import ( "testing" "github.com/restic/restic/internal/backend/test" ) var configTests = []test.ConfigTestData[Config]{ { S: "rclone:local:foo:/bar", Cfg: Config{ Remote: "local:foo:/bar", Program: defaultConfig.Program, Args: defaultConfig.Args, Connections: defaultC...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/rclone/internal_test.go
internal/backend/rclone/internal_test.go
package rclone import ( "context" "os/exec" "testing" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/errors" rtest "github.com/restic/restic/internal/test" ) // restic should detect rclone exiting. func TestRcloneExit(t *testing.T) { dir := rtest.TempDir(t) cfg := NewConfig() ...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/rclone/backend.go
internal/backend/rclone/backend.go
package rclone import ( "bufio" "context" "crypto/tls" "fmt" "io" "math/rand" "net" "net/http" "net/url" "os" "os/exec" "strings" "sync" "syscall" "time" "github.com/cenkalti/backoff/v4" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/limiter" "github.com/rest...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/rclone/backend_test.go
internal/backend/rclone/backend_test.go
package rclone_test import ( "os/exec" "testing" "github.com/restic/restic/internal/backend/rclone" "github.com/restic/restic/internal/backend/test" rtest "github.com/restic/restic/internal/test" ) func newTestSuite(t testing.TB) *test.Suite[rclone.Config] { dir := rtest.TempDir(t) return &test.Suite[rclone....
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/test/tests.go
internal/backend/test/tests.go
package test import ( "bytes" "context" "crypto/sha256" "fmt" "io" "math/rand" "os" "reflect" "sort" "sync" "testing" "time" "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/restic" "golang.org/x/sync/errgroup" "github.com/restic/restic/internal/test" "github.com/restic...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/test/config.go
internal/backend/test/config.go
package test import ( "fmt" "reflect" "testing" ) type ConfigTestData[C comparable] struct { S string Cfg C } func ParseConfigTester[C comparable](t *testing.T, parser func(s string) (*C, error), tests []ConfigTestData[C]) { for i, test := range tests { t.Run(fmt.Sprint(i), func(t *testing.T) { cfg, err...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/test/suite.go
internal/backend/test/suite.go
package test import ( "context" "fmt" "reflect" "strings" "testing" "time" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/location" "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/test" ) // Suite implements a test suite for restic backe...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/test/doc.go
internal/backend/test/doc.go
// Package test contains a test suite with benchmarks for restic backends. // // # Overview // // For the test suite to work a few functions need to be implemented to create // new config, create a backend, open it and run cleanup tasks afterwards. The // Suite struct has fields for each function. // // So for a new ba...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/test/benchmarks.go
internal/backend/test/benchmarks.go
package test import ( "bytes" "context" "io" "testing" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/restic" "github.com/restic/restic/internal/test" ) func saveRandomFile(t testing.TB, be backend.Backend, length int) ([]byte, backend.Handle) { data := test.Random(23, length)...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/retry/backend_retry.go
internal/backend/retry/backend_retry.go
package retry import ( "context" "errors" "fmt" "io" "sync" "time" "github.com/cenkalti/backoff/v4" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/feature" ) // Backend retries operations on the backend in case of an error with a // ...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/retry/backend_retry_test.go
internal/backend/retry/backend_retry_test.go
package retry import ( "bytes" "context" "io" "strings" "testing" "time" "github.com/cenkalti/backoff/v4" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/mock" "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/restic" "github.com/restic/re...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/retry/testing.go
internal/backend/retry/testing.go
package retry import "testing" // TestFastRetries reduces the initial retry delay to 1 millisecond func TestFastRetries(_ testing.TB) { fastRetries = true }
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/s3/s3_test.go
internal/backend/s3/s3_test.go
package s3_test import ( "context" "crypto/rand" "encoding/hex" "fmt" "io" "net" "net/http" "os" "os/exec" "path/filepath" "testing" "time" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/location" "github.com/restic/restic/internal/backend/s3" "github.com/restic...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/s3/s3.go
internal/backend/s3/s3.go
package s3 import ( "context" "fmt" "hash" "io" "net/http" "os" "path" "slices" "strings" "time" "github.com/cenkalti/backoff/v4" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend/layout" "github.com/restic/restic/internal/backend/location" "github.com/restic/restic...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/s3/config.go
internal/backend/s3/config.go
package s3 import ( "net/url" "os" "path" "strings" "time" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/options" ) // Config contains all configuration necessary to connect to an s3 compatible // server. type Config struct { Endpoi...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/s3/config_test.go
internal/backend/s3/config_test.go
package s3 import ( "strings" "testing" "time" "github.com/restic/restic/internal/backend/test" ) func newTestConfig(cfg Config) Config { if cfg.Connections == 0 { cfg.Connections = 5 } if cfg.RestoreDays == 0 { cfg.RestoreDays = 7 } if cfg.RestoreTimeout == 0 { cfg.RestoreTimeout = 24 * time.Hour } ...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false
restic/restic
https://github.com/restic/restic/blob/9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59/internal/backend/limiter/static_limiter.go
internal/backend/limiter/static_limiter.go
package limiter import ( "context" "io" "net/http" "golang.org/x/time/rate" ) type staticLimiter struct { upstream *rate.Limiter downstream *rate.Limiter } // Limits represents static upload and download limits. // For both, zero means unlimited. type Limits struct { UploadKb int DownloadKb int } // Ne...
go
BSD-2-Clause
9e2d60e28c662ee6e3a3d4f19e9f2d560abf9a59
2026-01-07T08:36:32.238827Z
false