ipfs

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2019 License: GPL-3.0 Imports: 8 Imported by: 3

README

IPFS Storage Engine

We are implementing the Put() and Get() API methods on top of IPFS.

ipfs.go: storage provider implementation

cmd/main.go: interacting with IPFS storage provider. This requires the IPFS daemon to be running.

Installation

  1. Install IPFS daemon:
    • Download ipfs binary
  2. Initialize IPFS
    • Execute ipfs init (only needs to be done once)
    • Add the core wave3 peers to your network
  3. Run IPFS daemon
    • Execute ipfs daemon --enable-pubsub-experiment
  4. Install WAVE storage provider:
    • TODO

Usage

Supernode

Supernodes are servers that have voluntarily taken on the role of storing WAVE objects from IPFS clients.

  1. Clone and follow instructions for ansible
Put/Get

We have a simple command line interface for now

  1. cmd put <file path> returns hash
  2. cmd put <hash> prints the contents of the file on the screen
Adding Supernodes

Put the bootstrap peers in a file bootstrappeers and run

while read addr; do
    ipfs bootstrap add $addr
    ipfs swarm connect $addr
done < bootstrappeers
/ip4/54.183.252.14/tcp/4001/ipfs/QmWaDiSZhFn9JYjtUMp2wXP7j6yjaVrxdjSZKfGjaYzTjM

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPFSStorageProvider

type IPFSStorageProvider struct {
	// contains filtered or unexported fields
}

IPFS Storage provider runs as a supplementary daemon to the IPFS daemon

func (*IPFSStorageProvider) Enqueue

not implemented for now

func (*IPFSStorageProvider) Get

func (ipfs *IPFSStorageProvider) Get(ctx context.Context, hash iapi.HashSchemeInstance) (content []byte, err error)

retrieves the byte array associated with the given hash. RIGHT NOW we assume that the hash is keccak-256.

func (*IPFSStorageProvider) Initialize

func (ipfs *IPFSStorageProvider) Initialize(ctx context.Context, config map[string]string) (err error)

This initializes the IPFS storage provider by establishing a connection with the IPFS daemon API (https://ipfs.io/docs/api/). The configuration expects the following options:

  • ipfs_daemon: HTTP endpoint of IPFS daemon API. Should be set to http://localhost:5001 unless you have altered the IPFS configuration
  • publish: push objects to subscribed supernodes. Set to "true" or "false" (need to be strings). If you plan on running a supernode, then you should set this to "false"

func (*IPFSStorageProvider) IterateQueue

func (ipfs *IPFSStorageProvider) IterateQueue(ctx context.Context, queueId iapi.HashSchemeInstance, iteratorToken string) (object iapi.HashSchemeInstance, nextToken string, err error)

not implemented for now

func (*IPFSStorageProvider) Location

TODO: not sure how to implement this for now

func (*IPFSStorageProvider) Put

func (ipfs *IPFSStorageProvider) Put(ctx context.Context, content []byte) (hash iapi.HashSchemeInstance, err error)

Inserts a byte array into IPFS and returns the keccak-256 hash (as a WAVE HashSchemeInstance)

func (*IPFSStorageProvider) Status

func (ipfs *IPFSStorageProvider) Status(ctx context.Context) (operational bool, info map[string]string, err error)

Returns the operational status of the IPFS storage provider by checking to see if the IPFS daemon is still up and running. Does not currently return anything in the 'info' map

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL