-
Notifications
You must be signed in to change notification settings - Fork 6
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
Storage Backend Implementation using Stow #189
Conversation
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.
Good job! Took a first pass
@@ -50,8 +70,57 @@ type StorageBackend struct { | |||
S3 *S3 | |||
} | |||
|
|||
func (s *StorageBackend) GetConfigMap() stow.ConfigMap { |
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.
Why is this struct with the same case statements in every method?
Sounds like this should be an interface with different implementations for each backend.
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.
Yup, I have created a BackendConfigurer
interface which is implemented by all configured backends to return the config to setup stow.
server/jobs/job_store.go
Outdated
delete(j.jobs, jobID) | ||
} else if !errors.Is(err, &StorageBackendNotConfigured{}) { |
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.
You wouldn't need this error check if you were using an interface with different implementations.
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.
Decided to use a two value return statement in the Write() method. So, we will no longer have to look for custom errors to decide if we want to delete the job from memory.
server/jobs/storage_backend.go
Outdated
} | ||
|
||
containerFound = true | ||
_, err = container.Put(key, reader, 100, nil) |
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.
what is 100?
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.
It's the size of the reader according to the documentation. I've updated the GetReader(
) method to return the size if the reader which is passed into this method call.
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.
Left couple comments
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.
💯
This PR uses stow to create a generic storage backend that can read and write from s3, azure blob storage, local disk storage etc.