-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(sync): allow remote storage #2007
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,4 @@ vendor/ | |
.vscode/ | ||
examples/config-sync-localhost.json | ||
node_modules | ||
.tool-versions |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ package extensions | |
import ( | ||
"net" | ||
"net/url" | ||
"os" | ||
"strings" | ||
|
||
zerr "zotregistry.io/zot/errors" | ||
|
@@ -41,23 +42,31 @@ func EnableSyncExtension(config *config.Config, metaDB mTypes.MetaDB, | |
isPeriodical := len(registryConfig.Content) != 0 && registryConfig.PollInterval != 0 | ||
isOnDemand := registryConfig.OnDemand | ||
|
||
if isPeriodical || isOnDemand { | ||
service, err := sync.New(registryConfig, config.Extensions.Sync.CredentialsFile, | ||
storeController, metaDB, log) | ||
if err != nil { | ||
return nil, err | ||
} | ||
if !(isPeriodical || isOnDemand) { | ||
continue | ||
} | ||
|
||
if isPeriodical { | ||
// add to task scheduler periodic sync | ||
gen := sync.NewTaskGenerator(service, log) | ||
sch.SubmitGenerator(gen, registryConfig.PollInterval, scheduler.MediumPriority) | ||
} | ||
tmpDir := config.Extensions.Sync.TmpDir | ||
if tmpDir == "" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would say, that by default, it should still sync temporarily under each repo, like today(main). if a TmpDir is given in config, then use that, this way all the tests should pass. right @rchincha ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, we do not want to step outside of our "storageRootDir" path. That's all the space we will own and manage, and nothing outside of it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @elee1766 My suggestion is, if there is a cloud backend defined in storage, then instead, do a second step of writing to that backend after the local sync is done |
||
// use an os tmpdir as tmpdir if not set | ||
tmpDir = os.TempDir() | ||
} | ||
|
||
if isOnDemand { | ||
// onDemand services used in routes.go | ||
onDemand.Add(service) | ||
} | ||
service, err := sync.New(registryConfig, config.Extensions.Sync.CredentialsFile, tmpDir, | ||
storeController, metaDB, log) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
if isPeriodical { | ||
// add to task scheduler periodic sync | ||
gen := sync.NewTaskGenerator(service, log) | ||
sch.SubmitGenerator(gen, registryConfig.PollInterval, scheduler.MediumPriority) | ||
} | ||
|
||
if isOnDemand { | ||
// onDemand services used in routes.go | ||
onDemand.Add(service) | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would remove this.