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

serialfile: localize os.Open into NewSerialFile #1629

Merged
merged 2 commits into from
Sep 3, 2015

Conversation

rht
Copy link
Contributor

@rht rht commented Aug 31, 2015

No description provided.

@jbenet jbenet added the status/in-progress In progress label Aug 31, 2015
@rht rht force-pushed the localize-os-open branch 2 times, most recently from 0d4d18d to 9219fc1 Compare August 31, 2015 04:47
@@ -42,21 +36,11 @@ func newSerialFile(name, path string, file *os.File, stat os.FileInfo) (File, er

// for directories, stat all of the contents first, so we know what files to
// open when NextFile() is called
contents, err := file.Readdir(0)
contents, err := ioutil.ReadDir(path)
Copy link
Member

Choose a reason for hiding this comment

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

why change this? we already have the file. no need to make an extra syscall

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What if os.Open() is done only when !stat.IsDir()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not possible because in NextFile(), f.Close() requires the opened os.File object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Still possible but then NextFile() no longer uses newSerialFile().

@rht rht force-pushed the localize-os-open branch 2 times, most recently from 3ed13af to 0d36141 Compare August 31, 2015 06:42
@jbenet
Copy link
Member

jbenet commented Sep 2, 2015

LGTM. @whyrusleeping ?

@jbenet
Copy link
Member

jbenet commented Sep 2, 2015

I think this needs rebasing on top of symlink PR

@rht
Copy link
Contributor Author

rht commented Sep 3, 2015

Rebased

@whyrusleeping
Copy link
Member

that goprocess issue is happening more and more frequently. Otherwise, this LGTM

License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
@rht
Copy link
Contributor Author

rht commented Sep 3, 2015

@jbenet this is one of #1641's dependency. Rebased.

jbenet added a commit that referenced this pull request Sep 3, 2015
serialfile: localize os.Open into NewSerialFile
@jbenet jbenet merged commit 28df97e into ipfs:master Sep 3, 2015
@jbenet jbenet removed the status/in-progress In progress label Sep 3, 2015
@ajnavarro ajnavarro mentioned this pull request Aug 24, 2022
72 tasks
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.

3 participants