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

experimental ideas in passing a filesystem to the context. #56

Closed
wants to merge 5 commits into from
Closed

experimental ideas in passing a filesystem to the context. #56

wants to merge 5 commits into from

Conversation

bsutton
Copy link

@bsutton bsutton commented Dec 11, 2019

I've pushed this PR to start a discussion around #55

I've more work to do but it looks like we could passing an optional filesystem to a context makes a lot of sense.
This then broadly allows path to support multiple file systems as dart does.

We will still need a zone in order to inject a filesystem into the default context.

I think that the logic would be that when 'current' is calling _readCWD that _readCWD would check for a zone key if and only if:
The context is running in a non-root zone.
No file system has been passed.

This is perhaps a little limiting as there may be circumstances where you want to pass a filesystem to a context and then still overload it using a zone.

If that is the case then we should simply say that if the zone has a filesystem key (e.g. #path.filesystem) then we should always use that filesystem.

Thoughts?

I will look to push sample code with a zone in the next few days.

Brett

@@ -4,7 +4,8 @@

import 'dart:math' as math;

import '../path.dart' as p;
import 'package:file/file.dart' as fs;
Copy link
Member

Choose a reason for hiding this comment

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

I left a comment on the original issue - I think this is an SDK problem if we can confirm that Uri.base does something unexpected in the zone with an overridden filesystem.

If we do decide that we need to do something in this package we'll need to find a way to do it without depending on package:file. This is a very core package in the Dart ecosystem, and maintaining no dependencies is critical.

@bsutton
Copy link
Author

bsutton commented Dec 12, 2019 via email

@bsutton
Copy link
Author

bsutton commented Dec 13, 2019

So this is untested.
Again the aim use it as a basis for discussion.

This version has a much smaller change set now that I understand the function of a Context.
Currently I've used the quiver package for an LRU implementation.
Will need to discuss how you want to handle this (build our own or be dependent on quiver).

This version feels like it might actually do the job.

Comments?

@bsutton
Copy link
Author

bsutton commented Dec 13, 2019

All unit tests are now passing and no external dependencies.

@bsutton bsutton closed this Jan 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants