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

improve nodebuilder code to not depend on NewIPFSNode #1557

Closed
wants to merge 1 commit into from

Conversation

whyrusleeping
Copy link
Member

I want to deprecate the function NewIPFSNode in favor of the node builder. this is the beginning of that change.

So far, i've left NewIPFSNode intact, but i've removed most (not all) callers of it.

I'd like some feedback on the direction i'm taking here before going any farther.

License: MIT
Signed-off-by: Jeromy jeromyj@gmail.com

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
@jbenet jbenet added the status/in-progress In progress label Aug 9, 2015
@jbenet
Copy link
Member

jbenet commented Aug 11, 2015

Tbh, I think this looks daunting. I think the caller's life is simpler with the former.

n, err := NewIPFSNode(ctx, Standard(r, false))

is simple (the Standard(...) thing is a bit weird, but otherwise straightforward), whereas

NewNodeBuilder().Offline().SetRepo(r).Build(ctx)

is not simple. I have to wonder about what the builder is, whether and when i can call Offline and SetRepo, etc.

I'm sure there's a way to do the new stuff without complicating the user's life. I would keep something like this:

n, err := core.NewNode(ctx, core.Options{
  Repo:    r,
  Offline: true,
})

@whyrusleeping
Copy link
Member Author

n, err := core.NewNode(ctx, core.Options{
  Repo:    r,
  Offline: true,
})

Yeah, the builder is really just syntactic sugar on top of that. So i can remove the sugar

@whyrusleeping
Copy link
Member Author

closing in favor of #1572

@jbenet jbenet removed the status/in-progress In progress label Aug 13, 2015
@whyrusleeping whyrusleeping deleted the builder-cleanup branch August 13, 2015 18:51
@ajnavarro ajnavarro mentioned this pull request Aug 24, 2022
72 tasks
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.

None yet

2 participants