100 Commits

Author SHA1 Message Date
Keepers
532922f662
introduce exchange info selector support (#379)
* introduce exchange info selector support

Adds support in selectors/exchange for queries based on
backup.ExchangeInfo entries.  This allows the declaration
of selectors based on non-identifier details such as sender,
subject, or receivedAt time.

Changes Exclude scope matching from being an Any-
match comparator to an All-match.  This keeps exclude
and include behavior identical, hopefully making less
confusion for users.
2022-07-21 15:08:03 -06:00
Danny
dfcba3bf0a
Fail-fast option added (#377)
Fail-fast option added.
2022-07-21 14:59:11 +00:00
Danny
fe92d7c9db
Issue #359: create folder enhancement added. (#375)
Issue #359: create folder feature added.
Feature required to finish task #374
2022-07-21 13:32:53 +00:00
Keepers
6224a92e7a
filter backup details by flags (#371)
* filter backup details by flags

`backup details` should have its output filtered by the flags provided by
the user.  In addition, the selector's FilterDetails should maintain
information (esp service info) about the entries, rather than slicing them
down to only the path reference.
2022-07-20 16:25:28 -06:00
Vaibhav Kamra
1a31a07425
Populate ExchangeInfo correctly (#373)
Message Info added back to package.
2022-07-20 08:30:28 -04:00
Keepers
746c88a233
refactor selector scopes to accept slices (#352)
* refactor selector scopes to accept slices

Cli flag implementation was showcasing a toil issue: building
selectors required a lot of repetitious code for combining
inputs into sets of scopes.  Since all of these productions
were effectively identical (eg: for each user, then each folder,
create a scope with the ids), the cleaner solution is to pack
that behavior into the scope constructors themselves.
2022-07-19 16:04:07 -06:00
Danny
0422b9ecbe
Restore Policy options added (#350)
* Issue #349:
Added policy for restore to code base.  Policy Items are placed in the `internal/common` directory
2022-07-19 21:28:23 +00:00
Keepers
625cf744a6
adds the onError option to operations (#347)
* adds the onError option to operations

Adds the OnError option to operations.Options.  OnError tells
corso whether to continue despite concurrent processing
errors, or to exit processing on any error.  Also includes flag
support for setting the option.  Only adds the options, does
not assert error handling behavior in corso.
2022-07-19 14:20:12 -06:00
Keepers
6d04c82992
correct count of successful status items (#366)
* correct count of successful status items
2022-07-19 13:53:42 -06:00
Keepers
6c22d5c0ce
adds store package for wrapping model_store (#346)
* adds store package for wrapping model_store

Introduces the pkg/store package, which contains funcs
for wrapping the model_store with common requests.
This package choice was made for its combination
of being in an accessible place, centralizing functionality
and not introducing circular dependencies.
2022-07-19 11:54:53 -06:00
Danny
d00332f328
GC async population of m365 objects mail (#332)
-- Changes made to incorporate async population of a DataCollection
2022-07-18 21:01:58 +00:00
Danny
5a9f2e4601
GC custom errors to inherit from internal/common (#337)
Custom error package added and extended to the internal/connector package
2022-07-15 21:21:11 +00:00
Keepers
bd3b2a8096
clean up leftover restorepoint var names (#344) 2022-07-14 11:48:14 -06:00
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
Vaibhav Kamra
c1c9cfe118
Address issues flagged by golangci-lint (#341) 2022-07-13 22:21:04 +00: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
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
Vaibhav Kamra
fa190da682
Rename restorepoint to backup (#314) 2022-07-11 16:06:04 +00:00
Vaibhav Kamra
acb468d0f6
Implement backup details CLI (#306)
Returns RestorePointDetails

Closes #297
2022-07-08 23:16:34 +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
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
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
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
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
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
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
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
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
Keepers
108065df75
remove repository.Account (#229)
* remove repository.Account

Now that account.Account exists, we can replace the
deprecated repository.Account struct with the account
version.
2022-06-23 16:02:12 -06:00
ashmrtn
902294b70d
S3 test prefix naming (#228)
* Update how S3 storage structs are generated

  * fix bug in printing year of date
  * use the name of the test instead of trying to pull name from runtime
  * always log the time when making the storage struct
  * don't allow user to specify prefix

* Fixup tests for new test storage API

* Update function name and comment
2022-06-23 11:55:26 -07:00
Keepers
0bd23ab2ab
move config unions to common code (#224)
* move config unions to common code

The configuration union handlers in Storage and Account
overlapped significantly in behavior.  Moving those helpers into
a common code folder was requested.  Although the behavior
was similar across the files, the types were not, requiring
the addition of generics to solve the need.
2022-06-23 12:16:20 -06:00