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

implement checksums in the owncloud storage driver #1629

Merged
merged 1 commit into from
Apr 14, 2021

Conversation

C0rby
Copy link
Contributor

@C0rby C0rby commented Apr 8, 2021

No description provided.

@labkode
Copy link
Member

labkode commented Apr 9, 2021

@C0rby we usually abbreviate checksum as xs not cs in case you wanna change it.

@C0rby
Copy link
Contributor Author

C0rby commented Apr 9, 2021

@labkode, I don't really have a hard opinion on this.
The prefix was already there just commented so I just used it. Also in other places we use cs.

ChecksumPrefix string = OcisPrefix + "cs." // followed by the algorithm, eg. ocis.cs.sha1

But I'm also fine with changing it to xs.
@butonic what do you think?

@IljaN
Copy link
Member

IljaN commented Apr 9, 2021

I`d say that we try to stay consistent as much as possible. :)

@butonic
Copy link
Contributor

butonic commented Apr 12, 2021

I agree with @refs, we should try to be consistent. ... @labkode what could be the explanation behind using xs for checksums? Is that some legacy thing? Is cs taken by something else?

@@ -682,6 +684,14 @@ func (fs *ocfs) convertToResourceInfo(ctx context.Context, fi os.FileInfo, ip st

ri.PermissionSet = fs.permissionSet(ctx, ri.Owner)

// checksums
if _, ok := mdKeysMap[checksumsKey]; (!fi.IsDir()) && returnAllKeys || ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

I like to vote for more explicit error handling here. The handling of the IsDir() case should be done explicitely as that will ease debugging later big times. Also, would'nt a log message be helpful in the case that something is a dir that should not be or vise versa?

Also, I am only 38 years in programming and still do not know quickly what A && B || C really evaluates to, how about helping me poor soul with additional parenthesis?

appctx.GetLogger(ctx).Error().Err(err).Str("nodepath", nodePath).Str("algorithm", algo).Msg("file not fount")
default:
appctx.GetLogger(ctx).Error().Err(err).Str("nodepath", nodePath).Str("algorithm", algo).Msg("could not read checksum")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

How nice can it be :-)

defer f.Close()

r1 := io.TeeReader(f, sh)
r2 := io.TeeReader(r1, mh)
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, bear with me, but.... short variable names have a long history of proving that they're not cool. We tried that in C already back in the dark days, paying back with lots of head scratching... So why not just spend a few more chars to get speaking names? Yes, also for dumb, short living local variables... Ok, I am not blaming you here for the golang way of doing things ;-)

if err != nil {
return err
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This means that we do not require checksums, right? But if the feature "checksums" is activated, shouldn't it be an error/warning if the upload comes completely without checksum? Or is that checked elsewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, as it is right now checksums are optional. I don't know if we even have the flag to "activate" checksums.
Also I'm not sure how much sense it makes to spend too much effort in the owncloud storage driver since we are only using it for the webUI acceptance tests and even them will in the near future need to switch to the ocis storage driver.

This PR is just to make the webUI tests for the Thumbnails PR pass. owncloud/ocis#1898

@C0rby
Copy link
Contributor Author

C0rby commented Apr 12, 2021

@dragotin, I must confess that I just copied the checksum code from the decomposedfs. But I can still implement your feedback nonetheless.

@C0rby C0rby force-pushed the owncloud-storage-checksums branch from 12ed199 to 8018db6 Compare April 12, 2021 10:14
@C0rby C0rby force-pushed the owncloud-storage-checksums branch from 8018db6 to 2dde017 Compare April 12, 2021 11:16
@ishank011 ishank011 merged commit a4b5148 into cs3org:master Apr 14, 2021
@C0rby C0rby deleted the owncloud-storage-checksums branch April 14, 2021 11:37
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.

6 participants