Skip to content

filesystem: add Windows implementation#6072

Merged
mattklein123 merged 13 commits intoenvoyproxy:masterfrom
greenhouse-org:filesystem-part-3
Mar 19, 2019
Merged

filesystem: add Windows implementation#6072
mattklein123 merged 13 commits intoenvoyproxy:masterfrom
greenhouse-org:filesystem-part-3

Conversation

@yaelharel
Copy link
Contributor

@yaelharel yaelharel commented Feb 26, 2019

Description:
Adds Windows implementation of Filesystem::Instance and Filesystem::File interfaces.
Inject the platform-specific implementations of Filesystem::Instance& through MainCommon.
Moves IoError class from Network namespace to Api namespace.

This is step 3/3 in adding Windows filesystem support as outlined here: #5470 (comment).

Risk Level:
Low

Testing:
bazel build //source/... && bazel test //test/...

Docs Changes:
N/A

Release Notes:
N/A

Relates to issue #129

cc: @achasveachas
cc: @sesmith177

Adds Windows implementation of Filesystem::Instance and Filesystem::File
interfaces.

Inject the platform-specific implementations of Filesystem::Instance&
through MainCommon.

Moves IoError class from Network namespace to Api namespace.

Signed-off-by: Yael Harel <yharel@pivotal.io>
Signed-off-by: Arjun Sreedharan <asreedharan@pivotal.io>
Signed-off-by: Sam Smith <sesmith177@gmail.com>
@jmarantz
Copy link
Contributor

I have some context on this and will make some comments :)

@dnoe
Copy link
Contributor

dnoe commented Feb 27, 2019

Thanks, context much appreciated. I am also wondering if it makes sense to split out the mechanical refactoring moves (I see there are a few in the diff) from the logic changes and new stuff? It may make this much easier to review.

@jmarantz
Copy link
Contributor

+1 for separate PRs for refactors vs new code. Please split this in two.

@jmarantz jmarantz self-assigned this Feb 27, 2019
// frequent memory allocation of IoError instance.
// If this is used, IoCallResult has to be instantiated with a deleter that does not
// deallocate memory for this error.
#define ENVOY_ERROR_AGAIN reinterpret_cast<Api::IoError*>(0x01)
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be changed in #6037 to address an memory alignment error.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh good :) Can I suggest addressing this with a singleton? I'm generally against singletons but this seems like a good place to use one.

I'll comment also in #6037 .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We'll let that be handled in #6037 .

@yaelharel
Copy link
Contributor Author

As requested by @dnoe and @jmarantz, submitted #6104 (handle refactors).

Yael Harel added 2 commits February 28, 2019 12:05
Signed-off-by: Yael Harel <yharel@pivotal.io>
Signed-off-by: Sam Smith <sesmith177@gmail.com>
Signed-off-by: Yael Harel <yharel@pivotal.io>
Signed-off-by: Sam Smith <sesmith177@gmail.com>
@yaelharel
Copy link
Contributor Author

Hi @dnoe and @jmarantz, I think the PR is ready for another look.
Thanks!

@yaelharel
Copy link
Contributor Author

/retest

@repokitteh-read-only
Copy link

🔨 rebuilding ci/circleci: compile_time_options (failed build)

🐱

Caused by: a #6072 (comment) was created by @yaelharel.

see: more, trace.

Signed-off-by: Sam Smith <sesmith177@gmail.com>
Signed-off-by: Yael Harel <yharel@pivotal.io>
Copy link
Contributor

@dnoe dnoe left a comment

Choose a reason for hiding this comment

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

I still need to look at the test but flushing comments now to unblock you. Thanks!

throw EnvoyException(fmt::format("Invalid path: {}", path));
}

std::ios::sync_with_stdio(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this change some global state?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was copied from the existing Linux implementation:

std::ios::sync_with_stdio(false);

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this has been there for a long long time! I'm actually not sure what it's meant to be doing here, since the documentation implies it only affects the standard streams like stdin, stdout, and stderr. But nothing in this function seems to be dealing with these streams.

@mattklein123 do you remember why this was added?

Copy link
Member

Choose a reason for hiding this comment

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

No clue. Can we remove this in a follow up on both sides?

Yael Harel and others added 4 commits March 1, 2019 12:28
Signed-off-by: Yael Harel <yharel@pivotal.io>
Signed-off-by: Sam Smith <sesmith177@gmail.com>
Signed-off-by: Yael Harel <yharel@pivotal.io>
Signed-off-by: Sam Smith <sesmith177@gmail.com>
Signed-off-by: Sam Smith <sesmith177@gmail.com>
Signed-off-by: Yael Harel <yharel@pivotal.io>
Signed-off-by: Yechiel Kalmenson <ykalmenson@pivotal.io>
Signed-off-by: Yael Harel <yharel@pivotal.io>
@dnoe
Copy link
Contributor

dnoe commented Mar 6, 2019

Let me know whenever this is ready for another pass and I will take a look. Thanks!

@yaelharel
Copy link
Contributor Author

Hi @dnoe, I think that we're ready for another review. Thanks!

Yael Harel and others added 2 commits March 11, 2019 11:52
Signed-off-by: Yael Harel <yharel@pivotal.io>
Signed-off-by: Natalie Arellano <narellano@pivotal.io>
Signed-off-by: Natalie Arellano <narellano@pivotal.io>
Signed-off-by: Yael Harel <yharel@pivotal.io>
@yaelharel
Copy link
Contributor Author

/retest

@repokitteh-read-only
Copy link

🔨 rebuilding ci/circleci: compile_time_options (failed build)

🐱

Caused by: a #6072 (comment) was created by @yaelharel.

see: more, trace.

Envoy::Filesystem::InstanceImpl was splitted to
Envoy::Filesystem::InstanceImplWin32 and
Envoy::Filesystem::InstanceImplPosix

Signed-off-by: Yael Harel <yharel@pivotal.io>
Signed-off-by: Natalie Arellano <narellano@pivotal.io>
Signed-off-by: Natalie Arellano <narellano@pivotal.io>
Signed-off-by: Yael Harel <yharel@pivotal.io>
@yaelharel
Copy link
Contributor Author

Hi @dnoe, did you have a chance to review this PR again?
Thanks!

@mhoran
Copy link

mhoran commented Mar 19, 2019

Hey @alyssawilk @dnoe any thoughts on getting this merged? This is blocking the next track of work for Windows support. Thanks!

@mhoran mhoran mentioned this pull request Mar 19, 2019
@alyssawilk
Copy link
Contributor

I think this one is jmarantz@ and dpn@?

I'll ping them internally - sorry for the lag.

dnoe
dnoe previously approved these changes Mar 19, 2019
Copy link
Contributor

@dnoe dnoe left a comment

Choose a reason for hiding this comment

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

LGTM - Thanks for making these changes.

@mattklein123 mattklein123 self-assigned this Mar 19, 2019
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

LGTM with 2 small comments. Sorry for the delay.

/wait

InProgress,
// Permission denied.
Permission,
// Bad handle
Copy link
Member

Choose a reason for hiding this comment

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

This was covered in a different @danzh2010 PR, but can we remove this? This should never happen and should be covered with ASSERT/RELEASE_ASSERT if necessary depending on the situation..

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.

throw EnvoyException(fmt::format("Invalid path: {}", path));
}

std::ios::sync_with_stdio(false);
Copy link
Member

Choose a reason for hiding this comment

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

No clue. Can we remove this in a follow up on both sides?

@repokitteh-read-only
Copy link

🙀 Error while processing event:

evaluation error
error: cannot load github.com/repokitteh/modules/lib/utils.star: load("github.com/repokitteh/modules/lib/utils.star") error: module load error
🐱

Caused by: a #6072 (review) was submitted by @mattklein123.

see: more, trace.

Signed-off-by: Yael Harel <yharel@pivotal.io>
Signed-off-by: Yechiel Kalmenson <ykalmenson@pivotal.io>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thank you!

@mattklein123 mattklein123 merged commit dc23262 into envoyproxy:master Mar 19, 2019
@wrowe wrowe deleted the filesystem-part-3 branch December 24, 2019 17:25
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.

9 participants