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

Migrating library APIs #1159

Closed
wking opened this issue Apr 28, 2015 · 1 comment
Closed

Migrating library APIs #1159

wking opened this issue Apr 28, 2015 · 1 comment
Labels
need/community-input Needs input from the wider community

Comments

@wking
Copy link
Contributor

wking commented Apr 28, 2015

As discussed in #1158, sometimes we want to make changes to our public library APIs. How should we do that? Do we need ‘gofix’ style translators? Should we be logging runtime deprecation warnings? Some folks do some sed-like things with go fmt. Maybe we're just explaining migrations in our release notes? What do we want this to look like?

I'm currently leaning towards a well-definied distinction between stable (core/…) and fluxy (shell/…`) APIs (see #1158), with migration suggestions in the release notes whenever we make a backwards-incompatible change to an existing API. Since I can't find a way to get compile-time deprecation warnings in Go, I'd suggest this strategy:

  1. Implement new interface using a new function name (to not collide with the existing usage).

  2. Add a mention of the new interface (and deprecated old interface) to all subsequent release notes, giving a target version for the actual removal. For example:

    We've added an AddFromReader function to shell/fsutils. The old Add from core/coreunix is deprecated and will be removed in version 0.4.0, which we won't land before 2015-09-01. To update your existing code, change usage like:

    keyString, err := coreunix.Add(ipfsNode, reader)
    if err != nil {
        return err
    }
    

    to

    fileNode, err := fsutils.AddFromReader(ipfsNode, reader)
    if err != nil {
        return err
    }
    key, err := fileNode.Key()
    if err != nil {
        return err
    }
    keyString := key.String()
    
  3. Keep printing that deprecation warning and migration advice in subsequent release notes leading up to 0.4.0.

  4. Cut 0.4.0 with a prominent list of removals and migration advice.

Once we get to 1.0, things like this will hopefully happen less frequently (if we do a good job planning the API now), so the gaps between backwards-incompatible changes should be larger.

Spun off from ipfs/team-mgmt#6.

wking added a commit to wking/go-ipfs that referenced this issue Apr 29, 2015
Folks should be using the node-returning AddFromReader defined in
shell/fsnode instead, since that creates the same node but returns the
dag.Node object itself, instead of the stringified key.  It's cheaper
to go from Node to stringified key than it is to go the other way
around, and you need the Node to do anything besides printing the
stringified key, so the shell/fsnode version has a better API and we
want to push people in that direction.  The shell/fsnode version also
uses our intended high-/low-level API distinction (core/... is for
low-level stuff) [1].  This commit starts the deprecation/migration
using the procedure outlined here [2].

[1]: ipfs#1158
[2]: ipfs#1159
wking added a commit to wking/go-ipfs that referenced this issue Apr 29, 2015
Folks should be using the node-returning AddFromReader defined in
shell/fsnode instead, since that creates the same node but returns the
dag.Node object itself, instead of the stringified key.  It's cheaper
to go from Node to stringified key than it is to go the other way
around, and you need the Node to do anything besides printing the
stringified key, so the shell/fsnode version has a better API and we
want to push people in that direction.  The shell/fsnode version also
uses our intended high-/low-level API distinction (core/... is for
low-level stuff) [1].  This commit starts the deprecation/migration
using the procedure outlined here [2].

[1]: ipfs#1158
[2]: ipfs#1159
wking added a commit to wking/go-ipfs that referenced this issue Apr 30, 2015
Folks should be using the node-returning AddFromReader defined in
shell/unixfs instead, since that creates the same node but returns the
dag.Node object itself, instead of the stringified key.  It's cheaper
to go from Node to stringified key than it is to go the other way
around, and you need the Node to do anything besides printing the
stringified key, so the shell/unixfs version has a better API and we
want to push people in that direction.  The shell/unixfs version also
uses our intended high-/low-level API distinction (core/... is for
low-level stuff) [1].  This commit starts the deprecation/migration
using the procedure outlined here [2].

[1]: ipfs#1158
[2]: ipfs#1159
wking added a commit to wking/go-ipfs that referenced this issue May 1, 2015
Folks should be using the node-returning AddFromReader defined in
shell/unixfs instead, since that creates the same node but returns the
dag.Node object itself, instead of the stringified key.  It's cheaper
to go from Node to stringified key than it is to go the other way
around, and you need the Node to do anything besides printing the
stringified key, so the shell/unixfs version has a better API and we
want to push people in that direction.  The shell/unixfs version also
uses our intended high-/low-level API distinction (core/... is for
low-level stuff) [1].  This commit starts the deprecation/migration
using the procedure outlined here [2], with the API-release-notes
directory proposed here [3] and accepted here [4].

[1]: ipfs#1158
[2]: ipfs#1159
[3]: https://github.com/ipfs/go-ipfs/pull/1136/files#r29379579
[4]: https://github.com/ipfs/go-ipfs/pull/1136/files#r29498385
wking added a commit to wking/go-ipfs that referenced this issue May 2, 2015
Folks should be using the node-returning AddFromReader defined in
shell/unixfs instead, since that creates the same node but returns the
dag.Node object itself, instead of the stringified key.  It's cheaper
to go from Node to stringified key than it is to go the other way
around, and you need the Node to do anything besides printing the
stringified key, so the shell/unixfs version has a better API and we
want to push people in that direction.  The shell/unixfs version also
uses our intended high-/low-level API distinction (core/... is for
low-level stuff) [1].  This commit starts the deprecation/migration
using the procedure outlined here [2], with the API-release-notes
directory proposed here [3] and accepted here [4].

[1]: ipfs#1158
[2]: ipfs#1159
[3]: https://github.com/ipfs/go-ipfs/pull/1136/files#r29379579
[4]: https://github.com/ipfs/go-ipfs/pull/1136/files#r29498385
wking added a commit to wking/go-ipfs that referenced this issue May 2, 2015
Folks should be using the node-returning AddFromReader defined in
shell/unixfs instead, since that creates the same node but returns the
dag.Node object itself, instead of the stringified key.  It's cheaper
to go from Node to stringified key than it is to go the other way
around, and you need the Node to do anything besides printing the
stringified key, so the shell/unixfs version has a better API and we
want to push people in that direction.  The shell/unixfs version also
uses our intended high-/low-level API distinction (core/... is for
low-level stuff) [1].  This commit starts the deprecation/migration
using the procedure outlined here [2], with the API-release-notes
directory proposed here [3] and accepted here [4].

[1]: ipfs#1158
[2]: ipfs#1159
[3]: https://github.com/ipfs/go-ipfs/pull/1136/files#r29379579
[4]: https://github.com/ipfs/go-ipfs/pull/1136/files#r29498385
wking added a commit to wking/go-ipfs that referenced this issue May 4, 2015
Folks should be using the node-returning AddFromReader defined in
shell/unixfs instead, since that creates the same node but returns the
dag.Node object itself, instead of the stringified key.  It's cheaper
to go from Node to stringified key than it is to go the other way
around, and you need the Node to do anything besides printing the
stringified key, so the shell/unixfs version has a better API and we
want to push people in that direction.  The shell/unixfs version also
uses our intended high-/low-level API distinction (core/... is for
low-level stuff) [1].  This commit starts the deprecation/migration
using the procedure outlined here [2], with the API-release-notes
directory proposed here [3] and accepted here [4].

[1]: ipfs#1158
[2]: ipfs#1159
[3]: https://github.com/ipfs/go-ipfs/pull/1136/files#r29379579
[4]: https://github.com/ipfs/go-ipfs/pull/1136/files#r29498385
@whyrusleeping whyrusleeping added the need/community-input Needs input from the wider community label Aug 23, 2016
@Stebalien
Copy link
Member

Superseded by the "CoreAPI" interfaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/community-input Needs input from the wider community
Projects
None yet
Development

No branches or pull requests

3 participants