3166 Commits

Author SHA1 Message Date
Keepers
105fd7383a
add e2e backup-restore integration test (#311)
* add e2e backup-restore integration test

Adds an e2e integration test that starts by backing up
data, and ends with restoring it.  Also makes various
amendments to other code where necessary to
facilitate this exercise.
2022-07-14 09:00:55 -06:00
Danny
76a5d6bba3
Issue #15 adding lint to CI Pipeline. (#325)
Added golangci-lint run check to repo. Currently enables only the defaults.

https://golangci-lint.run/usage/linters
2022-07-13 22:59:58 +00:00
Vaibhav Kamra
c1c9cfe118
Address issues flagged by golangci-lint (#341) 2022-07-13 22:21:04 +00:00
Vaibhav Kamra
6f9fe0dd9e
Fix lint failures: Check return types (#338) 2022-07-13 15:43:42 -06:00
Keepers
39c85e1a84
add output formatting control to cli (#329)
* add output formatting control to cli

Adds the capacity for the CLI to output either a
text table or a json blob to the terminal.  Table is
the default behavior, json is toggled with the --json
flag.
2022-07-13 14:15:08 -06:00
ashmrtn
36346548d7
Change user/host information in kopia (#328)
These fields can be used to lookup snapshots in kopia as they are part
of the `Source` struct. They are also stored in the kopia sessions but
they should not cause session collisions. Sessions have unique IDs to go
along with this information.
2022-07-12 16:12:58 -07:00
Vaibhav Kamra
efe4319080
Fix for issues caught by go-lint (#327)
Error list visible [here](https://github.com/alcionai/corso/actions/runs/2653381666)
2022-07-12 11:19:32 -06:00
Keepers
80db9a56c7
reduce restore point details to matching refs (#310)
* reduce restore point details to matching refs

A selector should be able to reduce a set of restore point
details to only those that pass its inclusion and
exclusion rules.
2022-07-11 14:44:08 -06:00
ashmrtn
2415addd05
Allow getting data from kopia for a directory subtree (#299)
* Implement getting data for directory subtree

Return a slice of collections with data for a given directory subtree in
kopia. Traverse the full directory before creating a DataCollection
instead of sending items as they are found because future
implementations may cause blocking on send. This could reduce
parallelism because the code won't be able to find other directories to
traverse until the files are seen. Kopia also currently loads the entire
directory at once so there's not much benefit to streaming.

System will now continuing pulling data until completion and report all
errors at the end of the run.

* Tests for getting persisted subtree data including some error cases
2022-07-11 18:22:28 +00:00
Danny
b9652c66e3
GC Serialization fix: event message support (#304)
Support for eventMessage Request and Response capabilities added for serialization.
2022-07-11 13:04:20 -04:00
Keepers
608d19e821
add filters package (#300)
* add filters package

Filters allow a caller to define some comparator-
ie, a filter- and use that filter to try matching various
inputs.
2022-07-11 10:39:22 -06:00
Vaibhav Kamra
fa190da682
Rename restorepoint to backup (#314) 2022-07-11 16:06:04 +00:00
Vaibhav Kamra
e5f5c38d4e
Add tools dependency (#313)
Adding tools.go allows us to declare a dependency on the stringer package (used for go generate)

Reference: https://play-with-go.dev/tools-as-dependencies_go115_en/
2022-07-11 08:47:15 -07:00
Vaibhav Kamra
acb468d0f6
Implement backup details CLI (#306)
Returns RestorePointDetails

Closes #297
2022-07-08 23:16:34 +00:00
Sidhartha Mani
c5f152477d
cleanup build scripts and simplify build/build-container (#301) 2022-07-08 22:25:21 +00:00
ashmrtn
e7a6d07c5b
Basic mocks for kopia Entry and File (#307) 2022-07-08 13:59:20 -07:00
Danny
60ab132960
GC: Create Consistent Snapshot (#292)
GraphConnector: Query consistency feature added
See document for implementation details: [document](https://www.notion.so/alcion/GraphConnector-RestorePoint-Consistency-for-Queries-81cce329c6e84cd79121cda0d511e1f6)
2022-07-08 15:45:25 -04:00
Vaibhav Kamra
0a5aa8ce73
Wire up RestorePoints to backup list (#305)
Currently displays the restorepoints in tablular form. We can add json output in a follow-up using the segment-cli library.

Closes #269
2022-07-08 09:12:43 -06:00
Vaibhav Kamra
6e9bd634e4
Create RestorePoint and RestorePointDetails (#290)
Update the backup operation to create RestorePoint and RestorePointDetails models in the repository

Add modelstore to the operation to allow backup/restore operations to update/query for corso models

Closes #268
2022-07-08 01:41:40 +00:00
Vaibhav Kamra
9d21d65bc7
Use MockExchangeData in kopia backup tests (#303)
This implements the DataStreamInfo interface needed by BackupCollections
2022-07-08 00:23:34 +00:00
ashmrtn
5605a204d1
Factor out common code for getting kopia items (#298)
* Factor out common code for getting kopia items

Both directory and single item restore in kopia need to do common tasks
like getting the item in question. Factor out that common code and
adjust tests to prep for directory restore.
2022-07-07 16:04:06 -07:00
Keepers
c29a4fffe0
wire selectors up through backup handling (#278)
* wire selectors up through backup handling

Selectors are implemented enough to add them end-
to-end in some places.  This starts with backup
creation, since that's the most stable set of code in
the repo at the moment.
2022-07-07 17:02:25 -06:00
ashmrtn
1143a33ce6
Allow multiple items in DataCollection from kopia (#296)
Use a slice to back the data instead of adding directly to the channel
for two reasons (this may change in the future though):
  * kopia loads all data about a directory at the same time
  * consumers of the DataCollection may not pull items from the channel
    at a fast rate, which could block adding to the channel. This could
    lead to delays in discovering other directories to traverse in
    multi-threaded scenarios
2022-07-07 14:54:46 -07:00
Keepers
10f112452a
refactor the selector api to scope factories (#289)
* refactor the selector api to scope factories

Rather than have the service selector offer an api of
include* or exclude* for each of its recognized
data scopes, instead expose a set of factory funcs
for each datat scope and a smaller api of functions
that can consume those scopes.
2022-07-07 15:41:29 -06:00
Keepers
503fca14f5
use gc status to populate op results (#287)
Exports access to the graphconnector status prop
so that restore and backup ops can track those metrics.
2022-07-07 13:10:45 -06:00
Keepers
4e7c9bd1e8
refine None selector and scope population (#285)
Selectors.None is changed to the empty string so that
zero valued properties within the map default to None
rather than an unrecognized value.
2022-07-06 16:32:10 -06:00
Keepers
e8ec528113
break gc iterator cb to own func, fix err scope (#282)
A misuse of variable declaration that overlapped with
var shadowing on 'err' was causing the attachment retry
error to get lost, meaning failures to retrieve attachments
are occurring silently.
2022-07-06 12:49:32 -06:00
ashmrtn
70e7a1e2d3
Split KopiaWrapper into handle and backup/restore logic (#281)
* Split KopiaWrapper into repo handle and logic

With ModelStore, multiple structs need a reference to the kopia repo.
Make a small wrapper class (conn) that can open and initialize a repo. The
wrapper handles concurrent closes and opens and does ref counting to
ensure it only drops the kopia handle when the last reference is closed.

Rename KopiaWrapper to Wrapper and keep backup/restore functionality
in it.
2022-07-06 11:09:35 -07:00
Vaibhav Kamra
233aa43f4c
RestorePoint and RestorePointDetails models (#279)
RestorePoint and RestorePointDetails models.

Refs #268
2022-07-06 11:03:39 -07:00
Keepers
22ecfba402
implement exchange selector include/exclude funcs (#276) 2022-07-06 10:29:42 -06:00
ashmrtn
9606546336
Use test setup/teardown to reduce code duplication (#277)
Tests that run multiple sub-tests do not use the fields in the test
suite because that would cause the model store instance to be reused
instead of having a new model store instance for each subtest.
2022-07-06 07:57:17 -07:00
ashmrtn
ed4c71c093
Implement more ModelStore Get functions (#267)
* Implement ModelStore GetByType and Get

* Add tests for ModelStore Get functions

* Add stricter "type" checks for loaded models

Take modelType as parameter and check the model in question matches that
type. Adds a little extra layer of protection if models happen to have
the same struct layout.
2022-07-05 15:51:29 -07:00
Keepers
8725cacc22
add restore, backup result persistence skeleton (#275)
e2e wiring of persistence is not yet complete.
Will need modelstore integration, and additional
information about file and error counts from kw and gc.
2022-07-05 14:42:10 -06:00
ashmrtn
26fc4c9075
Implement ModelStore update (#265)
* Add ModelStore Update operation

* Tests for ModelStore Update function

* Add regression test for error during Update()

Ensure that if an error occurs during a ModelStore update operation the
previously stored model remains unchanged and no new model is visible to
the user.
2022-07-05 11:35:53 -07:00
ashmrtn
6bee4e5b41
Use latest kopia version in corso (#274)
newest release includes all changes we currently require
2022-07-05 10:57:23 -07:00
Keepers
25a1e972e6
update selector to match current design (#266)
* update selector to match current design

The selector design is progressing in the Showdown doc.
This updates the existing structs to match the expectations in that doc.
2022-07-05 10:20:19 -06:00
ashmrtn
cdf368ad20
Implement ModelStore delete functions (#264)
* Implement ModelStore delete functions

* Add tests for ModelStore.Delete()
2022-07-01 14:46:43 -07:00
ashmrtn
5ec6d4f286
Base model revision (#263)
* Update model interface and base struct

* Update code and tests for new Model interface
2022-07-01 14:17:15 -07:00
ashmrtn
99691f46d5
ModelStore Put/Get implmentations (#261)
* Simple Get and Put implementations

Get implementation is currently the one that uses the kopia ID of the
model/manifest.

* Basic tests for ModelStore Get/Put
2022-07-01 11:07:01 -07:00
Keepers
2aeafa36bd
add unit tests for cli command addition (#260)
* add unit tests for cli command addition
2022-07-01 08:37:50 -06:00
Keepers
8c399a6dc1
allow connect to create .corso config file (#256)
* allow connect to create .corso config file

Current bug: if no .corso config file exists, then repo connect
will always fail, even if it has the correct details to build
a new config file.  Solution: allow connect to build a .corso
config file when missing, so long as the operation succeeds
otherwise.

In tandem, return an error whenever a user attempts to
call repo connect with details that do not match the existing
.corso config file.
2022-06-30 13:03:26 -06:00
Keepers
ae778df5ae
rename scope to selector (#257)
* rename scope to selector

per design changes, source is being renamed to selector
for better readability and clarity.
2022-06-30 09:50:24 -06:00
Keepers
ce52cc5f41
Add the backup list command to the cli (#254)
* Add the backup list command to the cli

Adds `corso backup list <service>` to the cli commands.
Currently does nothing, while we're waiting on
downstream implementation.  e2e hookup will arrive later.
2022-06-30 09:30:37 -06:00
Keepers
abc8b44718
add operation results structs (#253)
* add operation results structs

Operations, both backup and restore, need to hold the
results of their operation, and be able to marshal the struct
to json for output.
2022-06-29 13:56:13 -06:00
ashmrtn
ed3844b714
API definition for model store (#249)
Basic API definitions for model store CRUD operations
2022-06-29 10:35:41 -07:00
ashmrtn
1c6f0994e4
Switch DataCollection to return a channel (#244)
* Change DataCollection to return channel directly

Precursor to restoring multiple items from kopia. Allows one to keep a
DataCollection open until all items are processed without blocking
consumers of the DataCollection (they can use a select-block if needed).

* Update tests for new DataCollection interface

* Handle context cancellation with DataCollection
2022-06-28 12:48:24 -07:00
Vaibhav Kamra
0707d00ab5
Add a Dockerfile for corso (#247)
Adds a Dockerfile under the docker to package the corso binary.

This currently requires the user to build the corso binary (for linux/amd64) in the build image
prior to building the docker image. Follow up PRs will introduce a Makefile.

Also moves the build image to the build folder and adds a couple of README.md files with
instructions.

Fixes #218
2022-06-28 12:15:30 -07:00
Danny
3ee7ff0c0b
Recoverable and Non-Recoverable errors (#232)
GraphConnector exports 2 error types. Recoverable and NonRecoverable. The package also implements error checks to confirm if errors are one of the exported types.
2022-06-27 20:29:15 -04:00
Keepers
60eb8eec08
refactor cli/config for better local testing (#245) 2022-06-27 15:25:06 -06:00
Keepers
689c5cc1e9
separate tenantID from m365 creds (#231)
* separate tenantID from m365 creds

Now that account.Account is in place, tenant id needs
to get removed from the credential set (it isn't actually
a secret) and placed in the account configuration instead.
2022-06-27 13:54:37 -06:00