Skip to content

interface for go-ipfs clientsย #176

Closed

Description

@jbenet

Would be great to setup a very simple interface for programmatic go-ipfs clients.

Let's use this issue to outline what the interface below should look like

package ipfs

// maybe rebind things clients will need, so they dont have to import
// a ton of packages.
type Key u.Key
type Block blocks.Block
type Object mdag.Node
...

// Node is an IPFS Node
type Node interface {

   // blocks
   GetBlock(Key) (Block, error)
   PutBlock(Key, Block) error

   // objects
   GetObject(Key) (Object, error)
   PutObject(Object) error

   // etc.
}

And some nice functions that can setup a node for you, given certain specific types of workflows:

// when you have a directory locally
func NewNodeWithConfigDir(string) (ipfs.Node, error) { ... }

// when you create your own config
func NewNodeWithConfig(cfg config.Config) (ipfs.Node, error) { ... }

// creates new keys, memory only ds, etc...
func NewEphemeralNode() (ipfs.Node, error) { ... }

// etc.

Activity

  1. whyrusleeping commented on Oct 14, 2014

    @whyrusleeping
    Member

    Huh, dhtHell would love to have this

  2. added
    help wantedSeeking public contribution on this issue
    and removed
    help wantedSeeking public contribution on this issue
    on Oct 14, 2014
  3. whyrusleeping commented on Oct 14, 2014

    @whyrusleeping
    Member

    ehmry, thats called the DagWriter, its in unixfs/io

  4. whyrusleeping commented on Oct 16, 2014

    @whyrusleeping
    Member

    i like that

  5. btc commented on Jan 15, 2015

    @btc
    Contributor

    hey @ehmry would you like to submit a PR for DAGService as an interface?

  6. whyrusleeping commented on Apr 7, 2015

    @whyrusleeping
    Member

    I think it was the distinction between mutable and immutable dag nodes. But i could be wrong

  7. 2 remaining items

  8. whyrusleeping commented on Jan 1, 2016

    @whyrusleeping
    Member

    i have a common interface here: https://github.com/whyrusleeping/fallback-ipfs-shell

    that lets us have the same 'object' be either an http client or an embedded node. It needs some documentation work, but it's the direction I want to go with this.

  9. daviddias commented on Jan 1, 2016

    @daviddias
    Member

    Let's transform this issue into a documentation effort on how to use IPFS programatically in go, using:

    • HTTP API
    • Core (for embedding IPFS directly)

    There is currently one example available at https://ipfs.io/ipfs/QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D/example#/ipfs/QmQwAP9vFjbCtKvD8RkJdCvPHqLQjZfW7Mqbbqx18zd8j7/api/service/readme.md (would be good to verify that it still follows the current API)

    @RichardLitt this would fit nicely into the API documentation efforts

  10. added
    exp/noviceSomeone with a little familiarity can pick up
    and removed on Feb 2, 2016
  11. novocodev commented on Jun 7, 2016

    @novocodev

    I'd like to use IPFS embedded in my golang App, has the convenience API described at the top of this ticket been implemented or are there any further examples of how to access the current IPFS implementation programatically.

  12. whyrusleeping commented on Dec 15, 2016

    @whyrusleeping
    Member

    @lgierth can this be closed in favor of core api discussions?

  13. ghost closed this as completedon Dec 18, 2016
  14. added a commit that references this issue on Oct 23, 2021
  15. added a commit that references this issue on May 30, 2023
    7d82623
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    exp/noviceSomeone with a little familiarity can pick uphelp wantedSeeking public contribution on this issuetopic/coreTopic coretopic/docs-ipfsTopic docs-ipfs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions