repo

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Root location of the repository
	Root = ".datahop"
)

Variables

View Source
var (
	ErrorRepoClosed = errors.New("cannot access config, repo not open")
)

Functions

func ConfigFilename

func ConfigFilename(configroot string) (string, error)

ConfigFilename returns the configuration file path given a configuration root directory. If the configuration root directory is empty, use the default one

func Init

func Init(repoPath, swarmPort string) error

Init initialises ipfs persistent repository to a given location

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 FSRepo

type FSRepo struct {
	io.Closer
	// contains filtered or unexported fields
}

FSRepo implements Repo

func (*FSRepo) Close

func (r *FSRepo) Close() error

Close repo

func (*FSRepo) Config

func (r *FSRepo) Config() (*config.Config, error)

Config returns repository config

func (*FSRepo) Datastore

func (r *FSRepo) Datastore() Datastore

Datastore returns datastore of the node

func (*FSRepo) Matrix added in v0.0.11

func (r *FSRepo) Matrix() *matrix.MatrixKeeper

Matrix returns nodes matrix

func (*FSRepo) Path

func (r *FSRepo) Path() string

Path of the repository

func (*FSRepo) SetState

func (r *FSRepo) SetState() error

SetState updates local state file with bloom filter

func (*FSRepo) State

func (r *FSRepo) State() *bloom.BloomFilter

State returns nodes crdt bloom filter state

type Repo

type Repo interface {
	Path() string
	Config() (*config.Config, error)
	Datastore() Datastore
	Close() error
	State() *bloom.BloomFilter
	SetState() error
	Matrix() *matrix.MatrixKeeper
}

Repo exposes basic repo operations

func Open

func Open(repoPath string) (Repo, error)

Open the FSRepo at path. Returns an error if the repo is not initialized.

Jump to

Keyboard shortcuts

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