ipfs_filestore

package
v0.0.0-...-9b73b1a Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2019 License: MIT Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIPFSRepoNeedsMigration = fmt.Errorf(`Your IPFS repo needs an update!

Please make sure you have the latest version of IPFS (go-ipfs, at least v0.4.17)
from either https://dist.ipfs.io or your favourite package manager. 

Then run 'ipfs daemon' from a terminal. It should ask if you'd like to perform
a migration, select yes. 

Once you've migrated, run Qri connect again.`)

Functions

func InitRepo

func InitRepo(repoPath, configPath string) error

InitRepo is a more specific version of the init command: github.com/ipfs/go-ipfs/cmd/ipfs/init.go it's adapted to let qri initialize a repo. This func should be maintained to reflect the ipfs master branch.

func OptEnablePubSub

func OptEnablePubSub(o *StoreCfg)

OptEnablePubSub configures ipfs to use the experimental pubsub store

Types

type Adder

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

Adder wraps a coreunix adder to conform to the cafs adder interface

func (*Adder) AddFile

func (a *Adder) AddFile(f cafs.File) error

func (*Adder) Added

func (a *Adder) Added() chan cafs.AddedFile

func (*Adder) Close

func (a *Adder) Close() error

type Filestore

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

func NewFilestore

func NewFilestore(config ...Option) (*Filestore, error)

func (*Filestore) AddFile

func (fs *Filestore) AddFile(file cafs.File, pin bool) (hash string, err error)

AddFile adds a file to the top level IPFS Node

func (*Filestore) Delete

func (fs *Filestore) Delete(key string) error

func (*Filestore) Fetch

func (fs *Filestore) Fetch(source cafs.Source, key string) (cafs.File, error)

func (*Filestore) Get

func (fs *Filestore) Get(key string) (cafs.File, error)

func (*Filestore) GoOnline

func (fs *Filestore) GoOnline() error

func (*Filestore) Has

func (fs *Filestore) Has(key string) (exists bool, err error)

func (*Filestore) NewAdder

func (fs *Filestore) NewAdder(pin, wrap bool) (cafs.Adder, error)

func (*Filestore) Node

func (fs *Filestore) Node() *core.IpfsNode

func (*Filestore) Online

func (fs *Filestore) Online() bool

func (Filestore) PathPrefix

func (f Filestore) PathPrefix() string

func (*Filestore) Pin

func (fs *Filestore) Pin(path string, recursive bool) error

func (*Filestore) Put

func (fs *Filestore) Put(file cafs.File, pin bool) (key string, err error)

func (*Filestore) Unpin

func (fs *Filestore) Unpin(path string, recursive bool) error

type Option

type Option func(o *StoreCfg)

Option is a function that adjusts the store configuration

func OptsFromMap

func OptsFromMap(opts map[string]interface{}) Option

OptsFromMap detects options from a map based on special keywords

type StoreCfg

type StoreCfg struct {
	// embed options for creating a node
	core.BuildCfg
	// optionally just supply a node. will override everything
	Node *core.IpfsNode
	// path to a local filesystem fs repo
	FsRepoPath string
	// operating context
	Ctx context.Context
	// EnableAPI
	EnableAPI bool
}

StoreCfg configures the datastore

func DefaultConfig

func DefaultConfig() *StoreCfg

DefaultConfig results in a local node that attempts to draw from the default ipfs filesotre location

func (*StoreCfg) InitRepo

func (cfg *StoreCfg) InitRepo() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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