Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(642)

Issue 1154423015: cipd: Extract high level file system operations into the separate interface. (Closed)

Created:
5 years, 6 months ago by Vadim Sh.
Modified:
5 years, 6 months ago
Reviewers:
nodir
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/infra/infra.git@master
Target Ref:
refs/heads/master
Project:
infra
Visibility:
Public.

Description

cipd: Extract high level file system operations into the separate interface. With the aim to implement this interface a bit differently on Windows. In particular on Windows files can be locked, and functions like EnsureFileGone must do "rename to a trash dir, delete whenever possible" instead of failing. R=nodir@chromium.org BUG=481661 Committed: https://chromium.googlesource.com/infra/infra/+/4513ccf52d0266b695d806a295402d335ad88de7

Patch Set 1 : extract-cipd-fs #

Total comments: 22

Patch Set 2 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+592 lines, -189 lines) Patch
M go/src/infra/tools/cipd/local/deployer.go View 15 chunks +19 lines, -101 lines 0 comments Download
M go/src/infra/tools/cipd/local/deployer_test.go View 2 chunks +1 line, -53 lines 0 comments Download
M go/src/infra/tools/cipd/local/files.go View 1 7 chunks +24 lines, -34 lines 0 comments Download
M go/src/infra/tools/cipd/local/files_test.go View 1 chunk +1 line, -1 line 0 comments Download
A go/src/infra/tools/cipd/local/fs.go View 1 1 chunk +262 lines, -0 lines 0 comments Download
A go/src/infra/tools/cipd/local/fs_test.go View 1 chunk +285 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (2 generated)
Vadim Sh.
5 years, 6 months ago (2015-06-02 05:02:13 UTC) #1
nodir
lgtm, comments are minor https://codereview.chromium.org/1154423015/diff/1/go/src/infra/tools/cipd/local/files.go File go/src/infra/tools/cipd/local/files.go (right): https://codereview.chromium.org/1154423015/diff/1/go/src/infra/tools/cipd/local/files.go#newcode248 go/src/infra/tools/cipd/local/files.go:248: // to extract a package ...
5 years, 6 months ago (2015-06-03 19:30:28 UTC) #2
Vadim Sh.
https://codereview.chromium.org/1154423015/diff/1/go/src/infra/tools/cipd/local/files.go File go/src/infra/tools/cipd/local/files.go (right): https://codereview.chromium.org/1154423015/diff/1/go/src/infra/tools/cipd/local/files.go#newcode248 go/src/infra/tools/cipd/local/files.go:248: // to extract a package to. Will use provided ...
5 years, 6 months ago (2015-06-03 22:35:09 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1154423015/20001
5 years, 6 months ago (2015-06-03 22:37:01 UTC) #6
commit-bot: I haz the power
Committed patchset #2 (id:20001) as https://chromium.googlesource.com/infra/infra/+/4513ccf52d0266b695d806a295402d335ad88de7
5 years, 6 months ago (2015-06-03 23:56:14 UTC) #7
nodir
5 years, 6 months ago (2015-06-04 00:57:36 UTC) #8
Message was sent while issue was closed.
https://codereview.chromium.org/1154423015/diff/1/go/src/infra/tools/cipd/loc...
File go/src/infra/tools/cipd/local/fs.go (right):

https://codereview.chromium.org/1154423015/diff/1/go/src/infra/tools/cipd/loc...
go/src/infra/tools/cipd/local/fs.go:236: if err := f.EnsureDirectoryGone(temp);
err != nil {
On 2015/06/03 22:35:08, Vadim Sh. wrote:
> On 2015/06/03 19:30:27, nodir wrote:
> > no need for err variable here
> 
> Why?.. It is logged.

Acknowledged.

https://codereview.chromium.org/1154423015/diff/1/go/src/infra/tools/cipd/loc...
go/src/infra/tools/cipd/local/fs.go:257: lastUsedTimeLock.Unlock()
On 2015/06/03 22:35:08, Vadim Sh. wrote:
> On 2015/06/03 19:30:27, nodir wrote:
> > You are not doing defer because Getpid is slow?
> > If yes, maybe explain this in a comment
> 
> I'm not using a defer because 4 lines of code is not that huge chunk of code
to
> forgot to unlock the lock after it. I like how Lock()/Unlock() pair visually
> identifies critical section.

in general, defers are not syntax sugar. If something panics between Lock and
Unlock (here it won't), then defer is needed.

Powered by Google App Engine
This is Rietveld 408576698