repo

package
v0.0.0-...-7d4678c Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datastore

type Datastore interface {
	ds.Batching // must be thread-safe
}

Datastore is the interface required from a datastore to be acceptable to FSRepo.

type OnlyOne

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

OnlyOne tracks open Repos by arbitrary key and returns the already open one.

func (*OnlyOne) Open

func (o *OnlyOne) Open(key interface{}, open func() (Repo, error)) (Repo, error)

Open a Repo identified by key. If Repo is not already open, the open function is called, and the result is remember for further use.

Key must be comparable, or Open will panic. Make sure to pick keys that are unique across different concrete Repo implementations, e.g. by creating a local type:

type repoKey string
r, err := o.Open(repoKey(path), open)

Call Repo.Close when done.

type Repo

type Repo interface {
	// Config returns the ipfs configuration file from the repo. Changes made
	// to the returned config are not automatically persisted.
	Config() (*config.Config, error)

	// Datastore returns a reference to the configured data storage backend.
	Datastore() Datastore

	GC() error

	io.Closer
}

Repo represents all persistent data of a given ipfs node.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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