-
Notifications
You must be signed in to change notification settings - Fork 19
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
filesystem/debug: improved NewServer #37
base: master
Are you sure you want to change the base?
Conversation
NewServer with callbacks based on functional options for friendly APIs. Replaces NewUFS. Add .Debug() to return a Debug-enabled version of the FileServer. Remove -root and -debug flags, use functional options instead. Most likely will conflict with Harvey-OS#32.
Based on NewServer rather than NewUFS.
Use NewServer rather than NewUFS.
Add debug.Server which wraps a NineServer and logs before and after calling functions for the underlying server. Add Trace option to protocol.Server. Makes Harvey-OS#34 obsolete
Sloppy merge, should have tested build afterwards.
Server.Trace was replaced by Trace option.
Set trace for the various servers to no-op log by default. Users can then change the trace function using the Trace option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll just go with this.
func Trace(tracer protocol.Tracer) ServerOpt { | ||
return func(s *FileServer) error { | ||
if tracer == nil { | ||
return errors.New("tracer cannot be nil") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or, hey, in here,
tracer = func(string, ...interface{}) {}
for convenience, we can do that later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I set tracer = nologf
in NewServer
, this seems like it should return an error if you try to pass nil
as the tracer.
Should not be nil otherwise the *.Trace will return an error.
Forgot to s/File/file.
Any thoughts on merging this? I noticed that #39 duplicates some of this PR. |
We should look at merging this in. There are some conflicts due to more recent PRs being merged in first. |
Several changes in this PR (rebase of #36):
ufs.NewServer
with callbacks based on functional options for friendly APIs.ufs.NewUFS
.protocol.NineServer
.debug.Server
andfilesystem.Server
.