Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
fad9e84e
Commit
fad9e84e
authored
2 years ago
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
NewCmixFromBackup returns a marshalled backup report
parent
b43d7d3a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!510
Release
,
!299
Implement NewCmixFromBackup
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bindings/backup.go
+25
-9
25 additions, 9 deletions
bindings/backup.go
with
25 additions
and
9 deletions
bindings/backup.go
+
25
−
9
View file @
fad9e84e
...
...
@@ -22,6 +22,16 @@ type Backup struct {
b
*
backup
.
Backup
}
// BackupReport is the bindings' representation of the return values of
// NewCmixFromBackup.
type
BackupReport
struct
{
// The JSON encoded list of E2E partner IDs
backupIdListJson
[]
byte
// The backup parameters found within the backup file
backupParams
[]
byte
}
// UpdateBackupFunc contains a function callback that returns new backups.
type
UpdateBackupFunc
interface
{
UpdateBackup
(
encryptedBackup
[]
byte
)
...
...
@@ -42,27 +52,33 @@ type UpdateBackupFunc interface {
// - backupPassphrase - backup passphrase provided by the user. Used to decrypt backup.
// - backupFileContents - the file contents of the backup.
//
// Return Values
// - backupIdListJson - JSON encoded list of the E2E partner IDs contained in the backup file.
// - backupParams - JSON encoded backup parameters contained in the backup file.
// Returns:
// - []byte - the JSON marshalled bytes of the BackupReport object.
func
NewCmixFromBackup
(
ndfJSON
,
storageDir
string
,
sessionPassword
,
backupPassphrase
[]
byte
,
backupFileContents
[]
byte
)
(
backupIdListJson
[]
byte
,
backupParams
[]
byte
,
err
error
)
{
backupPassphrase
[]
byte
,
backupFileContents
[]
byte
)
([]
byte
,
error
)
{
// Restore from backup
backupIdList
,
backupParamsStr
,
err
:=
backup
.
NewCmixFromBackup
(
ndfJSON
,
storageDir
,
sessionPassword
,
backupPassphrase
,
backupFileContents
)
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
err
}
backupIdListJson
,
err
=
json
.
Marshal
(
backupIdList
)
// Marshal ID List
backupIdListJson
,
err
:=
json
.
Marshal
(
backupIdList
)
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
err
}
// Construct report
report
:=
BackupReport
{
backupIdListJson
:
backupIdListJson
,
backupParams
:
[]
byte
(
backupParamsStr
),
}
return
backupIdListJson
,
[]
byte
(
backupParamsStr
),
nil
// Marshal report
return
json
.
Marshal
(
report
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment