Commit Graph

279 Commits

Author SHA1 Message Date
Jarek Kowalski
2ba4e83cef moved all compression to separate package and sanitized identifiers 2019-12-10 23:25:28 -08:00
Jarek Kowalski
8ab93e0e2f addressed PR comments 2019-12-10 23:25:28 -08:00
Jarek Kowalski
c057e17379 compression: added support for min/max file sizes eligible for compression 2019-12-10 23:25:28 -08:00
Jarek Kowalski
cfa2eea1e1 object: stop verifying object length in VerifyObject
With compression, the decompressed object length is
not known until we read the content.
2019-12-10 23:25:28 -08:00
Jarek Kowalski
a97b89662d policy: added compression policy 2019-12-10 23:25:28 -08:00
Jarek Kowalski
5ae2da4aea cli: added benchmark compression 2019-12-10 23:25:28 -08:00
Julio Lopez
cb850bc1ff Reformat help message constant to pacify lll linter 2019-12-10 22:22:32 -08:00
Julio Lopez
d3f324f59b Add diff.compareEntry helper to compare attribute entries
- Use it to compare the entry attributes for all entry types.
  Allows comparing differences in file attributes among the
  contents of two directories. This is useful for verifying
  restored contents in end-to-end tests.

- Print message about modified entries only when both entries
  are files and they are being compared.
2019-12-10 22:22:32 -08:00
Pavan Navarathna
fb57e828ad Restore command
Behavior:

- Creates top directory on restore
- Fails when target directories or files already exist
- Allows restoring to local root directory
- Restores of file attributes => mod time, mode, owner info
- Only a directory can be specified as a parameter

Not implemented:

- Restoring attributes of the top folder
- Restoring symlinks
- Restoring a single file
2019-12-10 22:22:32 -08:00
Julio Lopez
887a9180fa Trivial: fix imports grouping 2019-12-10 22:22:32 -08:00
Jarek Kowalski
f6d59608ab upload: require *policy.Tree for each upload 2019-12-07 14:24:57 -08:00
Jarek Kowalski
b68ef7d781 refactored policy types and policy.Getter 2019-12-06 23:53:22 -08:00
Jarek Kowalski
6217df1a87 lint: switched to 1.21 and fixed a ton of whitespace issues discovered
by new wsl linter
2019-11-26 06:49:49 -08:00
Julio Lopez
24f292b719 Cleanup lint: empty lines (via whitespace and wsl linters) 2019-11-22 15:17:40 +09:00
Pavan Navarathna
829742599c [#124] Add optional flags to override hostname and username 2019-11-22 15:15:21 +09:00
Jarek Kowalski
b3e1eab094 server: added --server-username and --server-password to optionally require basic auth for Kopia server 2019-11-20 15:49:40 -08:00
Jarek Kowalski
e8a1eaa9ee htmlui: added experimental HTML-based UI
This is enabled by `kopia server --ui` and can be viewed in a browser
at http://localhost:51515/

Right now it can only list snapshots and policies (barely).
2019-11-20 14:41:38 -08:00
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