qipfs

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: MIT Imports: 35 Imported by: 7

Documentation

Index

Constants

View Source
const FilestoreType = "ipfs"

FilestoreType uniquely identifies this filestore

Variables

View Source
var ErrNeedMigration = fmt.Errorf(`ipfs: need datastore migration`)

ErrNeedMigration indicates a migration must be run before qipfs can be used

View Source
var (

	// ErrNoRepoPath is returned when no repo path is provided in the config
	ErrNoRepoPath = errors.New("must provide a repo path ('path') to initialize an ipfs filesystem")
)

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 InternalizeIPFSRepo

func InternalizeIPFSRepo(ipfsRepoPath, newRepoPath string) error

InternalizeIPFSRepo takes an ipfsRepoPath and newRepoPath it creates a copy of the ipfs repo, moves it to the new repo path and migrates that repo it cleans up any tmp directories made, and removes the new repo if any errors occur IT DOES NOT REMOVE THE ORIGINAL REPO

func LoadIPFSPluginsOnce

func LoadIPFSPluginsOnce(path string) error

LoadIPFSPluginsOnce runs IPFS plugin initialization. we need to load plugins before attempting to configure IPFS, flatfs is specified as part of the default IPFS configuration, but all flatfs code is loaded as a plugin. ¯\_(ツ)_/¯

This works without anything present in the /.ipfs/plugins/ directory b/c the default plugin set is complied into go-ipfs (and subsequently, the qri binary) by default

func Migrate

func Migrate() error

Migrate runs an IPFS fsrepo migration

func NewFilesystem

func NewFilesystem(ctx context.Context, cfgMap map[string]interface{}) (qfs.Filesystem, error)

NewFilesystem creates a new local filesystem PathResolver with no options

func NewFilesystemFromNode

func NewFilesystemFromNode(ctx context.Context, node *core.IpfsNode) (qfs.Filesystem, error)

NewFilesystemFromNode wraps an existing IPFS node with a qfs.Filesystem

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(ctx context.Context, f qfs.File) error

func (*Adder) Added

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

func (*Adder) Finalize added in v0.6.0

func (a *Adder) Finalize() (string, error)

type Filestore

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

func (*Filestore) AddFile

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

AddFile adds a file to the top level IPFS Node

func (*Filestore) Delete

func (fst *Filestore) Delete(ctx context.Context, key string) error

func (*Filestore) Done

func (fst *Filestore) Done() <-chan struct{}

Done implements the qfs.ReleasingFilesystem interface

func (*Filestore) DoneErr

func (fst *Filestore) DoneErr() error

DoneErr returns errors in closing the filesystem

func (*Filestore) Fetch

func (fst *Filestore) Fetch(ctx context.Context, source cafs.Source, key string) (qfs.File, error)

func (*Filestore) Get

func (fst *Filestore) Get(ctx context.Context, key string) (qfs.File, error)

func (*Filestore) GoOnline

func (fst *Filestore) GoOnline(ctx context.Context) error

func (*Filestore) Has

func (fst *Filestore) Has(ctx context.Context, key string) (exists bool, err error)

func (*Filestore) IPFSCoreAPI

func (fst *Filestore) IPFSCoreAPI() coreiface.CoreAPI

IPFSCoreAPI exposes the Filestore's CoreAPI interface

func (Filestore) IsContentAddressedFilesystem added in v0.6.0

func (fst Filestore) IsContentAddressedFilesystem()

IsContentAddressedFilesystem declares qipfs is content-addressed

func (*Filestore) NewAdder

func (fst *Filestore) NewAdder(ctx context.Context, pin, wrap bool) (qfs.Adder, error)

func (*Filestore) Node deprecated

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

Node exposes the internal ipfs node

Deprecated: use IPFSCoreAPI instead

func (*Filestore) Online

func (fst *Filestore) Online() bool

func (*Filestore) Pin

func (fst *Filestore) Pin(ctx context.Context, cid string, recursive bool) error

func (*Filestore) PinsetDifference

func (fst *Filestore) PinsetDifference(ctx context.Context, set map[string]struct{}) (<-chan string, error)

PinsetDifference returns a map of "Recursive"-pinned hashes that are not in the given set of hash keys. The returned set is a list of all data

func (*Filestore) Put

func (fst *Filestore) Put(ctx context.Context, file qfs.File) (key string, err error)

Put adds a file and pins

func (Filestore) Type

func (fst Filestore) Type() string

Type distinguishes this filesystem from others by a unique string prefix

func (*Filestore) Unpin

func (fst *Filestore) Unpin(ctx context.Context, cid string, recursive bool) error

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
	Path string
	// URL is an ipfs http api address, used as a fallback if we cannot
	// config an ipfs filesystem. The filesystem will instead be a `ipfs_http`
	// filesystem.
	URL string

	// weather or not to serve the local IPFS HTTP API. does not apply when
	// operating over HTTP via a URL
	EnableAPI bool
	// enable experimental IPFS pubsub service. does not apply when
	// operating over HTTP via a URL
	EnablePubSub bool
	// DisableBootstrap will remove the bootstrap addrs from the node
	DisableBootstrap bool
	// AdditionalSwarmListeningAddrs allows you to add a list of
	// addresses you want the underlying libp2p swarm to listen on
	AdditionalSwarmListeningAddrs []string
}

StoreCfg configures the datastore

func DefaultConfig

func DefaultConfig(path string) *StoreCfg

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

Directories

Path Synopsis
Package coreunix is a fork of github.com/ipfs/go-ipfs/core/coreunix gx paths used: "gx/ipfs/QmUJYo4etAQqFfSS2rarFAE97eNGB8ej64YkRT2SmsYD4r/go-ipfs/pin" ipld "gx/ipfs/QmR7TcHkR9nxkUorfi8XMTAMLUK7GiP64TWWBzY3aacc1o/go-ipld-format" dag "gx/ipfs/QmSei8kFMfqdJq7Q68d2LMnHbTWKKg2daA29ezUYFAUNgc/go-merkledag" posinfo "gx/ipfs/QmQyUyYcpKG1u53V7N25qRTGw5XwaAxTMKXbduqHotQztg/go-ipfs-posinfo" core "gx/ipfs/QmUJYo4etAQqFfSS2rarFAE97eNGB8ej64YkRT2SmsYD4r/go-ipfs/core" unixfs "gx/ipfs/QmfB3oNXGGq9S4B2a9YeCajoATms3Zw2VvDm8fK7VeLSV8/go-unixfs" balanced "gx/ipfs/QmfB3oNXGGq9S4B2a9YeCajoATms3Zw2VvDm8fK7VeLSV8/go-unixfs/importer/balanced" ihelper "gx/ipfs/QmfB3oNXGGq9S4B2a9YeCajoATms3Zw2VvDm8fK7VeLSV8/go-unixfs/importer/helpers" trickle "gx/ipfs/QmfB3oNXGGq9S4B2a9YeCajoATms3Zw2VvDm8fK7VeLSV8/go-unixfs/importer/trickle" coreiface "gx/ipfs/QmUJYo4etAQqFfSS2rarFAE97eNGB8ej64YkRT2SmsYD4r/go-ipfs/core/coreapi/interface" posinfo "gx/ipfs/QmQyUyYcpKG1u53V7N25qRTGw5XwaAxTMKXbduqHotQztg/go-ipfs-posinfo" cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" mfs "gx/ipfs/QmUwXQs8aZ472DmXZ8uJNf7HJNKoMJQVa7RaCz7ujZ3ua9/go-mfs" chunker "gx/ipfs/QmTUTG9Jg9ZRA1EzTPGTDvnwfcfKhDMnqANnP9fe4rSjMR/go-ipfs-chunker" logging "gx/ipfs/QmZChCsSt8DctjceaL56Eibc29CVQq4dGKRXC5JRZ6Ppae/go-log" bstore "gx/ipfs/QmcDDgAXDbpDUpadCJKLr49KYR4HuL7T8Z1dZTHt6ixsoR/go-ipfs-blockstore" files "gx/ipfs/QmZMWMvWMVKCbHetJ4RgndbuEF1io2UpUxwQwtNjtYPzSC/go-ipfs-files"
Package coreunix is a fork of github.com/ipfs/go-ipfs/core/coreunix gx paths used: "gx/ipfs/QmUJYo4etAQqFfSS2rarFAE97eNGB8ej64YkRT2SmsYD4r/go-ipfs/pin" ipld "gx/ipfs/QmR7TcHkR9nxkUorfi8XMTAMLUK7GiP64TWWBzY3aacc1o/go-ipld-format" dag "gx/ipfs/QmSei8kFMfqdJq7Q68d2LMnHbTWKKg2daA29ezUYFAUNgc/go-merkledag" posinfo "gx/ipfs/QmQyUyYcpKG1u53V7N25qRTGw5XwaAxTMKXbduqHotQztg/go-ipfs-posinfo" core "gx/ipfs/QmUJYo4etAQqFfSS2rarFAE97eNGB8ej64YkRT2SmsYD4r/go-ipfs/core" unixfs "gx/ipfs/QmfB3oNXGGq9S4B2a9YeCajoATms3Zw2VvDm8fK7VeLSV8/go-unixfs" balanced "gx/ipfs/QmfB3oNXGGq9S4B2a9YeCajoATms3Zw2VvDm8fK7VeLSV8/go-unixfs/importer/balanced" ihelper "gx/ipfs/QmfB3oNXGGq9S4B2a9YeCajoATms3Zw2VvDm8fK7VeLSV8/go-unixfs/importer/helpers" trickle "gx/ipfs/QmfB3oNXGGq9S4B2a9YeCajoATms3Zw2VvDm8fK7VeLSV8/go-unixfs/importer/trickle" coreiface "gx/ipfs/QmUJYo4etAQqFfSS2rarFAE97eNGB8ej64YkRT2SmsYD4r/go-ipfs/core/coreapi/interface" posinfo "gx/ipfs/QmQyUyYcpKG1u53V7N25qRTGw5XwaAxTMKXbduqHotQztg/go-ipfs-posinfo" cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" mfs "gx/ipfs/QmUwXQs8aZ472DmXZ8uJNf7HJNKoMJQVa7RaCz7ujZ3ua9/go-mfs" chunker "gx/ipfs/QmTUTG9Jg9ZRA1EzTPGTDvnwfcfKhDMnqANnP9fe4rSjMR/go-ipfs-chunker" logging "gx/ipfs/QmZChCsSt8DctjceaL56Eibc29CVQq4dGKRXC5JRZ6Ppae/go-log" bstore "gx/ipfs/QmcDDgAXDbpDUpadCJKLr49KYR4HuL7T8Z1dZTHt6ixsoR/go-ipfs-blockstore" files "gx/ipfs/QmZMWMvWMVKCbHetJ4RgndbuEF1io2UpUxwQwtNjtYPzSC/go-ipfs-files"

Jump to

Keyboard shortcuts

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