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

filesystem/debug: improved NewServer #37

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

jcrussell
Copy link

Several changes in this PR (rebase of #36):

  • Add ufs.NewServer with callbacks based on functional options for friendly APIs.
  • Replaces ufs.NewUFS.
  • Move debug to separate package that wraps any protocol.NineServer.
  • Add tracing to debug.Server and filesystem.Server.

jcrussell and others added 7 commits June 13, 2018 14:14
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.
Copy link

@rminnich rminnich left a 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")

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.

Copy link
Author

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.
@jcrussell
Copy link
Author

Any thoughts on merging this? I noticed that #39 duplicates some of this PR.

@sevki sevki mentioned this pull request Jul 1, 2020
@gmacd
Copy link
Member

gmacd commented Jul 11, 2020

We should look at merging this in. There are some conflicts due to more recent PRs being merged in first.

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.

3 participants