386 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
Keepers
a823231afd
cache go mod in linter action (#367) 2022-07-20 09:20:22 -06:00
Vaibhav Kamra
1a31a07425
Populate ExchangeInfo correctly (#373)
Message Info added back to package.
2022-07-20 08:30:28 -04:00
Keepers
37f2c44dc7
accept backupID flag, not backupDetailsID (#370) 2022-07-20 00:22:25 +00:00
Vaibhav Kamra
9f8287dc48
Support specifying repo config via env (#363)
This allows the user to specify repo configuration via environment variables when a config file is not available.

This is a temporary fix - ideally we would leverage Viper for this but we currently only use Viper if a config file
is available so that needs to be refactored a bit.

[1]
`TENANT_ID` (already supported)
`BUCKET`
`ENDPOINT`
`PREFIX`
2022-07-19 16:42:28 -07:00
Keepers
43c024f4b2
add per-data type flags to backup details (#355)
* add per-data type flags to backup details

Adds the contacts, contact folders, emails, email folders, events,
and users flag support to `corso backup create exchange`
to enable selector support.
2022-07-19 16:38:48 -06: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
Aarti Jivrajani
7f60c00466
[Minor] Rename cli flag folder to email-folder (#343)
rename cli flag mail to email
2022-07-19 11:21:30 -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
Danny
ecdfbbc1a8
CI Cache Implementation (#354)
Caching adding for build and mods. Significantly improves CI `go test -v ./...`.
2022-07-15 16:54:24 -04:00
Keepers
efaa2da1bb
add --all and --data to backup create (#342)
* add --all and --data to backup create

Adds flags for backing up all exchange data, and
for isolating the data in the backup by data type.
Introduces validation and selector creation in
backup create.  Switches the --user flag variable
type from a string to a []string.
2022-07-15 10:27:20 -06: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
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