Skip to content
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

Add PutEncryptedObject and FPutEncryptedObject calls #821

Merged
merged 1 commit into from
Sep 27, 2017

Conversation

poornas
Copy link
Contributor

@poornas poornas commented Sep 22, 2017

Partially fixes #819.

  • revive PutEncryptedObject call back, and add a FPutEncryptedObject
    variant. Options struct is now passed in without a pointer.

Leaving the Get calls for @aead.

)

// PutEncryptedObject - Encrypt and store object.
func (c Client) PutEncryptedObject(bucketName, objectName string, reader io.Reader, encryptMaterials encrypt.Materials, metadata map[string][]string, progress io.Reader) (n int64, err error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait why are we doing it like this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we do it like this:
PutEncryptedObject(bucket, object string, r io.Reader, mat encrypt.Materials) (int64,error)

return 0, err
}

m := make(map[string]string)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary - no metadata...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed.

)

// FPutEncryptedObject - Encrypt and store an object with contents from file at filePath.
func (c Client) FPutEncryptedObject(bucketName, objectName, filePath, contentType string, encryptMaterials encrypt.Materials) (n int64, err error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the contentType?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed this

func (opts PutObjectOptions) validate() (err error) {
for k := range opts.UserMetadata {
if isStandardHeader(k) ||
isCSEHeader(k) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not line-break

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@@ -230,3 +237,15 @@ func isStandardHeader(headerKey string) bool {
}
return false
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@poornas poornas force-pushed the kfactor2 branch 5 times, most recently from 3cb393d to 531f7f2 Compare September 25, 2017 21:18
@@ -55,7 +55,7 @@ func (opts *PutObjectOptions) getNumThreads() (numThreads int) {

// getMetaData - constructs the headers from metadata entered by user in
// PutObjectOptions struct
func (opts *PutObjectOptions) getMetadata() (headers http.Header) {
func (opts PutObjectOptions) getMetadata() (headers http.Header) {
Copy link
Member

@harshavardhana harshavardhana Sep 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we are at it let's rename this function to simply Header() also the returned value is just header not headers

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@@ -87,6 +87,15 @@ func (opts *PutObjectOptions) getMetadata() (headers http.Header) {
return
}

func (opts PutObjectOptions) validate() (err error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment.. and a unit test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@harshavardhana
Copy link
Member

Can you squash your changes @poornas ?

- revive PutEncryptedObject call back, and add a FPutEncryptedObject
 variant.
@poornas
Copy link
Contributor Author

poornas commented Sep 26, 2017

done.

@deekoder deekoder merged commit c61055a into minio:master Sep 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API cleanup and new APIs to be added
4 participants