-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add io/fs FS support #1374
Add io/fs FS support #1374
Conversation
RFC @erikdubbelboer |
I'm ok with dropping support for 1.15. I would start without compress. Shouldn't the index page and byte-range work without any change since it's still just "files"? And I would add support for compression with in-memory cache after that. |
I think you can implement |
LGMT. I'm doing and sharing my thoughts. We first need to implement the For some FS, we may need to self-implement The challenge lies in how to elegantly implement the compression with in-memory or in-file cache. Oh, and zero alloc. Of course, it may takes a while to complete it. According to this line of thinking, compatibility existing APIs need a great care, and more tests need to be added. Zero alloc and elegant code are like tongues and teeth, that sometimes collide. |
Exactly agree. I'm also not sure about conpression with fs.Fs |
I need some help. https://github.com/valyala/fasthttp/blob/v1.40.0/fs.go#L822-L826 I don't quite understand why Going back to the source. I found that it already existed when it was created, can take a moment to answer it? @valyala |
@Aoang null byte is a string delimiter. if we see it in the path, it means it was maliciously injected, and we need not to serve such request for security reasons. if we're talking Go in general, there's no realistic cases when a path would have a null byte, especially mid-string, as Go doesn't use null bytes to indicate the end of the string, instead it just stores the string length. |
I'm confused, sync.WaitGroup fail in race tests. https://github.com/valyala/fasthttp/actions/runs/3203507569/jobs/5233684491#step:8:6 |
I'm not sure I understand what the WaitGroup is for. But I think this happens when |
Test
package testPoj
import (
"sync"
"time"
)
var wg = sync.WaitGroup{}
func R() {
wg.Add(5)
for i := 0; i < 5; i++ {
run()
}
wg.Wait()
}
func run() {
go func() {
wg.Done()
wg.Add(1)
time.Sleep(time.Second)
wg.Done()
}()
}
package testPoj
import (
"testing"
)
func TestR(t *testing.T) {
R()
}
➜ go test -v -race ./...
=== RUN TestR
--- PASS: TestR (1.01s)
PASS
ok testPoj 2.053s Could this test be inaccurate? I‘ll try again tomorrow. |
What if you have multiple goroutines calling |
Hi, in the implementation process, the package in There are so many exposed methods and variables in compress that it is not appropriate to put it in internal? Should create a > tree
.
├── allocation_test.go
├── coarseTime.go
├── coarseTime_test.go
├── compress [new package]
│ ├── compress.go
│ └── compress_test.go
├── compress.go [for compatibility, and marked as deprecated]
... |
Is there so much code that an |
I don't think it is necessary, but there are too many duplicate names, such as I think it would be a lot easier to add Do you think this is better? |
Hard to judge without diving deep into it. Isn't it possible to add an What do you mean with |
To be reviewed, I'll add comments. |
No progress? close it |
Why to close it? I think this would be great feature |
why close?need some help? |
@Aoang Why Close? |
If you're interested in continuing this work, this patch might help. Based on it, then also need to add |
No description provided.