repo

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: May 3, 2022 License: Apache-2.0 Imports: 18 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

func (*FSRepo) StateKeeper added in v0.0.16

func (r *FSRepo) StateKeeper() *StateKeeper

StateKeeper returns nodes matrix

type Repo

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

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.

type State added in v0.0.16

type State struct {
	Filter     *bloom.BloomFilter
	Membership bool
}

type StateKeeper added in v0.0.16

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

func LoadStateKeeper added in v0.0.16

func LoadStateKeeper(root string) (*StateKeeper, error)

func (*StateKeeper) AddOrUpdateState added in v0.0.16

func (s *StateKeeper) AddOrUpdateState(name string, membership bool, deltas []string) (*bloom.BloomFilter, error)

func (*StateKeeper) GetState added in v0.0.16

func (s *StateKeeper) GetState(name string) (*State, error)

func (*StateKeeper) GetStates added in v0.0.16

func (s *StateKeeper) GetStates() map[string]*State

func (*StateKeeper) SaveStates added in v0.0.16

func (s *StateKeeper) SaveStates() (map[string]*State, error)

Jump to

Keyboard shortcuts

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