Commit Graph
262 Commits
Author SHA1 Message Date
Julio Lopez 91508dac46 Move 'snapshot gc' functionality to gc package
Motivation:
Allow generalizing TreeWalker. See follow-up commit.

Changes:
* [x] Refactoring, no functional changes.
2019-11-06 17:34:28 -08:00
Julio Lopez 3883c2751c Allow multiple simultaneous profilers (#122)
Allow multiple simultaneous profilers.
Also, allow specifying the memory sampling rate for
the memory profiler
2019-10-31 05:11:41 -07:00
Jarek Kowalski 3b1177cc4e cli: implemented 'snapshot gc' and moved verify to be snapshot verify
`snapshot gc` marks contents not reachable from the root of any snapshot
as soft-deleted

The algorithm is a mark-and-sweep with parallel iteration of objects.
Currently it stores content IDs and object IDs in a map, so won't scale
to huge repositories, but this can be fixed in the future.

This fixes #110 at least for reasonable repository sizes.
2019-09-15 21:25:48 -07:00
Jarek Kowalski 0654e30b26 linter: upgraded to golangci-lint 1.18.0, fixed or suppressed warnings 2019-09-11 06:42:08 -07:00
Jarek Kowalski 8a1ce0a353 cli: renamed content gc subcommand to blob gc 2019-09-10 21:08:16 -07:00
Jarek Kowalski 09a31fa910 cli: added -–track-memory-usage flag that periodically logs memory usage 2019-08-24 13:18:31 -07:00
Jarek Kowalski 81ea751c0c cli: added profile flags, built only with 'profiling' tag 2019-08-24 10:42:12 -07:00
Jarek Kowalski 399164b3be webdav: improved error handling
- improved HTTP error handling
- added exponential back-off around gowebdav calls
- fixed blob.ListAllBlobsConsistent which was never finishing for WebDAV

Fixes #88 - 429 Too Many Requests - PROPFIND /n0a #88
Fixex #89 - Debug log clashes with interactive repo password request
2019-08-18 10:49:11 -07:00
Jarek Kowalski d80b659d9e webdav: added tests for basic authentication, CLI options for specifying username and password. fixes #80 2019-08-17 18:09:05 -07:00
Jarek Kowalski 9893a552e2 metrics: disable google analytics as it's not providing any useful data, need to rethink the story here 2019-08-17 16:13:30 -07:00
Jarek Kowalski b365d3414c removed content.Manager.ListContents*() API 2019-07-27 19:10:58 -07:00
Jarek Kowalski 6f5abf5e09 added content.Manager Iterate()
This uses callbacks avoids having to buffer
all content infos in memory and does not require holding a lock.
2019-07-26 21:31:25 -07:00
Jarek Kowalski 829faf8e1a added 'rewrite --prefixed' flag to only rewrite prefixed content IDs (by default only rewrites non-prefixed IDs) 2019-07-18 20:29:27 -10:00
Jarek Kowalski 6ef696d97a cli: resolve symlinks for snapshot roots
also - error handling improvements in the CLI
2019-07-18 08:40:44 -10:00
Jarek Kowalski 1af3d86ec7 Added support for separate packs for metadata
This puts all content blocks with non-empty prefix into starting with
`q` instead of `p`. This neatly separates all data (p) from metadata
(q) at the storage level and allows different storage policies, since
most data is not going to be ever accessed ever, but metadata is going
to be read a lot..

We can more aggressively cache contents from `q`.
2019-07-17 08:35:35 -10:00
Jarek Kowalski e414e7a4d1 Added support for reconnect tokens
Repository.Token() generates a base64-encoded token that can
be stored in password manager that fully describes repository connection
information (blob.ConnectionInfo) and optionally a password.

Use `kopia repo status -t` to print the token.
Use `kopia repo status -t -s` to print the token that also includes
repository password.

Use `kopia repo connect from-config --token T` to reconnect using the
token.
2019-07-10 21:03:40 -07:00
Juan B. Rodriguez a24a2da3c0 Implement an sftp backed storage provider
Uses go/ssh and pkg/sftp as building blocks and implements the common
sharded.Storage interface, shared between the filesystem and webdav
providers.

A couple of notes:

- The provider assumes the user has a working public/private key
connection to the ssh server.
No other authentication method is supported

- The repository path must exist on the server

- (testing related) The pkg/sftp server doesn't offer a way to set a
server filesystem root, so, during testing, it runs from the local
directory which is repo/blob/sftp. So the tests leave some debris
behind. Additionally, that's the reason why id_rsa and known_hosts
are there at all.

- Encrypted keyfiles are currently not supported (but it could be done)
2019-07-04 11:14:05 -07:00
Jarek Kowalski 22170b4832 cli: changed 'cache set' subcommand to support changing individual parameters 2019-06-11 22:08:52 -07:00
Jarek Kowalski 0d89ae3f79 Changed upload allow specifying N previous manifests
This avoids re-hashing of files previously partially uploaded
no matter where the upload was interrupted.
2019-06-08 18:01:47 -07:00
Jarek Kowalski ae1510b65c Deprecate hashcache and replace it with simply walking previous snapshot directory tree.
This cleans up the code a lot and removes many ugly hacks.
The performance is pretty reasonable and with separate metadata cache it's likely to stay that way.
2019-06-08 18:01:47 -07:00
Jarek Kowalski 9b87c32570 improved cache info command to show all caches 2019-06-08 17:42:44 -07:00
Jarek Kowalski bf311400f4 Added separate cache for metadata.
All blocks with a non-empty prefix land in that cache which has its own
size and expires independently from content cache.
2019-06-08 11:57:23 -07:00
Jarek Kowalski 72520029b0 golangci-lint: added more linters
Also fixed pre-existing lint errors.
2019-06-02 22:56:57 -07:00
Jarek Kowalski 54edb97b3a refactoring: renamed repo/block to repo/content
Also introduced strongly typed content.ID and manifest.ID (instead of string)

This aligns identifiers across all layers of repository:

blob.ID
content.ID
object.ID
manifest.ID
2019-06-01 22:24:19 -07:00
Jarek Kowalski 916da07e0f deprecate block format v0 2019-06-01 16:40:51 -07:00
Jarek Kowalski 9e5d0beccd refactoring: renamed storage.Storage to blob.Storage
This updates the terminology everywhere - blocks become blobs and
`storage.Storage` becomes `blob.Storage`.

Also introduced blob.ID which is a specialized string type, that's
different from CABS block ID.

Also renamed CLI subcommands from `kopia storage` to `kopia blob`.

While at it introduced `block.ErrBlockNotFound` and
`object.ErrObjectNotFound` that do not leak from lower layers.
2019-06-01 14:10:35 -07:00
Jarek Kowalski 1a7a02ddbe cleanup imports by grouping all local imports together 2019-06-01 10:57:55 -07:00
Jarek Kowalski 63303904e1 switched remaining fmt.Errorf to errors.Wrap() 2019-06-01 10:57:05 -07:00
Jarek Kowalski 698d2feb66 initialization improvements:
- create filesystem directory if it does not exists
- removed dangerous --overwrite option
- changed default splitter to a non-deprecated one
2019-05-31 20:12:46 -07:00
Jarek Kowalski 03339c18af [breaking change] deprecated DYNAMIC splitter due to license issue
The splitter in question was depending on
github.com/silvasur/buzhash which is not licensed according to FOSSA bot

Switched to new faster implementation of buzhash, which is
unfortunately incompatible and will split the objects in different
places.

This change is be semi-breaking - old repositories can be read, but
when uploading large objects they will be re-uploaded where previously
they would be de-duped.

Also added 'benchmark splitters' subcommand and moved 'block cryptobenchmark'
subcommand to 'benchmark crypto'.
2019-05-30 22:20:45 -07:00
Jarek Kowalski 0c41d41276 Fixed up paths after merge 2019-05-27 15:48:39 -07:00
Jarek Kowalski a6a153b22e switched fmt.Errorf() to errors.Wrap() 2019-05-11 12:34:14 -07:00
Jarek Kowalski 2787011e02 Revamped kopia.io website.
Added build pipeline to keep the reference in sync with the code.
2019-05-09 22:11:03 -07:00
Jarek Kowalski c0fc0c7a57 cli: fixed linter issues 2019-01-21 14:26:21 -08:00
Jarek Kowalski a34f629474 cli: fixed 'repo migrate' cancellation 2019-01-21 13:13:49 -08:00
Jarek Kowalski a70d6d804d cli: parallelize snapshot migration 2019-01-20 13:23:16 -08:00
Jarek Kowalski 913f3392e3 cli: renamed 'repo migration' to 'snapshot migrate' and improved caching 2019-01-19 10:52:03 -08:00
Jarek Kowalski b37c29513b cli: added 'repo repair' subcommand which operates on the same arguments as 'repo connect', but it fixes contents of the repository by restoring missing kopia.repository file
tests: reorganized end-to-end tests
2019-01-19 05:48:40 -05:00
Jarek Kowalski 6ce6a47d00 cli: fixed flags for blockindex subcommands 2019-01-12 11:19:38 -08:00
Jarek Kowalski 2e297dc60d repo: upgraded to latest version, removed format block settings from repository create, instead --encryption=NONE disables encryption of both blocks and format 2019-01-12 09:24:12 -08:00
Jarek Kowalski be70daa3e3 cli: added warning to 'snapshot list' when no snapshots are found 2019-01-07 23:44:15 -08:00
Jarek Kowalski d5f5977e27 fixed lint error 2019-01-06 17:58:45 -08:00
Jarek Kowalski a5b33944eb added 'repo connect from-config' for importing existing config across machines 2019-01-06 17:07:48 -08:00
Jarek Kowalski b9cff7b480 cli: changed 'snapshot list' parameters meaning
--all (-a) displays snapshots from all hosts (by default only current host)

Renamed previous --all (-a) to --show-identical (-l)
Updated help.
2019-01-02 18:34:34 -08:00
Jarek Kowalski 0b89cbef3b cli: added 'repo upgrade' command that invokes Repository.Upgrade() 2018-12-31 17:12:30 -08:00
Jarek Kowalski 18532f736b cli: fixed linter warning 2018-12-29 15:29:21 -08:00
Jarek Kowalski 1cd927c8fc cli: added 'block cryptobenchmark' subcommand 2018-12-29 15:14:49 -08:00
Jarek Kowalski a6a9729f71 upgraded repo to v0.2.0 2018-12-29 15:14:29 -08:00
Jarek Kowalski 45ce0b35b1 snapshot: moved dir.Entry to snapshot.DirEntry 2018-11-03 11:44:19 -07:00
Jarek Kowalski 4edd0a13bb cli: swapped object ID and file name in ls output 2018-11-03 11:35:31 -07:00