Comments (9)
I have a project that would benefit from this.
from tail.
@gcla, I think it sounds very interesting. We need to think hard about the API to make sure we don't end with a Frankenstein-do-it-all API. So we have two options:
- make sure it integrates transparently with today line-based API, e.g. by adding an option that switches it on. Line is used all over the place, so a PR will touch a lot of places. We need to make sure it makes sense.
- leave the API as it is and integrate it with a new major version of the API where it's cleaned up. The API has a lot of historical baggage, like exposed internal variables and structs. I started the work here: #11. Because I removed a orphaned upstream dependency, this new branch needs a lot of testing though.
from tail.
The former would be cleaner but the latter will take less time, given that gcla/tail works right now. @gcla what's your take on this?
from tail.
Hi @nxadm - my view is that I should follow the path you've set. :-) It looks to me as though the future of tail is in your new branch, and it would make sense to try to cleanly extend that to support byte-level tailing. What do you think? It would be a shame to retro-fit the old API, then have it be left behind.
If you agree, I can try to make time to build on your branch with a byte-level approach - or maybe I should describe it as a non-CRLF approach. My very simple-minded view of the design, without even having got down into the weeds recently, is that ReadLine
is replaced by Read
, up to some maximum number of bytes per time-window, and possibly subjected to some sort of leaky-bucket rate limiter as was in the original implementation. You can see my original change here - I can picture you wincing as you look at it :-)
It reads 1 byte at a time - it doesn't even try to buffer them up. Yuck!
from tail.
@gcla, I'll respond begin next week (aka a few days). I was AFK. Looking forward to the feature.
from tail.
@gcla, whatabout both ReadLine and ReadBytes methods? Reading one of the other is a very explicit show, so I don't see a problem with having two methods. It would make sense, though, to have one data structure.
What I really would like is to test the new branch to see if the changes I made don't break it. It passes all tests, but maybe it's just an indication that we need more tests :).
from tail.
Issue #20 is related to this.
from tail.
I think it would be better to keep this package centered around text streams and leave the handling of binary streams to another package.
The case of a program having the need for tailing both text streams and binary streams is a niche, so I don't much benefit in having the two cases under the same package. A "see also" section that mention the other project should be enough.
from tail.
I agree with @dolmen on this. It would clutter the interface to the programmer. We can spin-off a second package when/if v2 is released that build on a common package. I moved the discussion for v2 here: #36
from tail.
Related Issues (20)
- Checksum on sum.golang.org does not match HOT 4
- Tail from end of file HOT 7
- noTomb: useless fmt.Errorf calls HOT 3
- Don't tail for repeatedly opened file. HOT 5
- Dealing with utf16 string HOT 2
- [Question] The line will be truncated during kube-apiserver (another app) is writing in. HOT 2
- Cannot determine if a given line is complete or not HOT 17
- End log lost due to log rotation HOT 1
- Inotify backend does not correctly handle one file being watched twice HOT 2
- StopAtEOF does not function as expected. HOT 2
- Concurrent usage of tail results in unexpected behavior HOT 1
- Tail non-existent file: Lines channel closes when MustExist=false. HOT 3
- StartTail followed by append to file is race-prone
- package not in GOROOT HOT 1
- inotify_tracker logs fatal message without including error
- The message in the chan is incomplete. HOT 2
- File unexpectedly closes during tailing process
- Continious truncate is not handled correctly HOT 1
- read part message HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tail.