fsrepo

package
v0.9.0-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2019 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package fsrepo is a file-system implementation of repo

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = fmt.Errorf("Not Found")

ErrNotFound is for when a qri profile isn't found

Functions

func Filepath

func Filepath(rf File) string

Filepath gives the relative filepath to a repofiles in a given repository

func NewRepo

func NewRepo(store cafs.Filestore, fsys qfs.Filesystem, pro *profile.Profile, base string) (repo.Repo, error)

NewRepo creates a new file-based repository

Types

type EventLog added in v0.3.0

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

EventLog is a file-based implementation of the repo.EventLog interface

func NewEventLog added in v0.3.0

func NewEventLog(base string, file File, store cafs.Filestore) EventLog

NewEventLog allocates a new file-based EventLog instance

func (EventLog) Events added in v0.3.0

func (ql EventLog) Events(limit, offset int) ([]*repo.Event, error)

Events fetches a set of Events from the store

func (EventLog) EventsSince added in v0.3.0

func (ql EventLog) EventsSince(t time.Time) ([]*repo.Event, error)

EventsSince fetches a set of Events from the store that occur after a given timestamp

func (EventLog) LogEvent added in v0.3.0

func (ql EventLog) LogEvent(t repo.EventType, ref repo.DatasetRef) error

LogEvent adds a Event to the store

type File

type File int

File represents a type file in a qri repository

const (
	// FileUnknown makes the default file value invalid
	FileUnknown File = iota
	// FileLockfile is the on-disk mutex lock
	FileLockfile
	// FileInfo stores information about this repository
	// like version number, size of repo, etc.
	FileInfo
	// FileConfig holds configuration specific to this repo
	FileConfig
	// FileDatasets holds the list of datasets
	FileDatasets
	// FileEventLogs is a log of all queries in order they're run
	FileEventLogs
	// FileJSONRefs is a file for the user's local namespace
	// No longer in use
	FileJSONRefs
	// FileRefs is a flatbuffer file of this repo's dataset references
	FileRefs
	// FilePeers holds peer repositories
	// Ideally this won't stick around for long
	FilePeers
	// FileAnalytics holds analytics data
	FileAnalytics
	// FileSearchIndex is the path to a search index
	FileSearchIndex
	// FileSelectedRefs is the path to the current ref selection
	FileSelectedRefs
	// FileChangeRequests is a file of change requests
	FileChangeRequests
)

type ProfileStore added in v0.3.0

type ProfileStore struct {
	sync.Mutex
	// contains filtered or unexported fields
}

ProfileStore is an on-disk json file implementation of the repo.Peers interface

func NewProfileStore added in v0.3.1

func NewProfileStore(bp basepath) *ProfileStore

NewProfileStore allocates a ProfileStore

func (*ProfileStore) DeleteProfile added in v0.3.0

func (r *ProfileStore) DeleteProfile(id profile.ID) error

DeleteProfile removes a profile from the store

func (*ProfileStore) GetProfile added in v0.3.0

func (r *ProfileStore) GetProfile(id profile.ID) (*profile.Profile, error)

GetProfile fetches a profile from the store

func (*ProfileStore) List added in v0.3.0

func (r *ProfileStore) List() (map[profile.ID]*profile.Profile, error)

List hands back the list of peers

func (*ProfileStore) PeerIDs added in v0.3.0

func (r *ProfileStore) PeerIDs(id profile.ID) ([]peer.ID, error)

PeerIDs gives the peer.IDs list for a given peername

func (*ProfileStore) PeerProfile added in v0.3.0

func (r *ProfileStore) PeerProfile(id peer.ID) (*profile.Profile, error)

PeerProfile gives the profile that corresponds with a given peer.ID

func (*ProfileStore) PeernameID added in v0.3.0

func (r *ProfileStore) PeernameID(peername string) (profile.ID, error)

PeernameID gives the profile.ID for a given peername

func (*ProfileStore) PutProfile added in v0.3.0

func (r *ProfileStore) PutProfile(p *profile.Profile) error

PutProfile adds a peer to the store

type Refstore added in v0.1.1

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

Refstore is a file-based implementation of the repo.Refstore interface. It stores names in a json file

func (Refstore) DeleteRef added in v0.1.1

func (rs Refstore) DeleteRef(del repo.DatasetRef) error

DeleteRef removes a name from the store

func (Refstore) GetRef added in v0.1.1

func (rs Refstore) GetRef(get repo.DatasetRef) (repo.DatasetRef, error)

GetRef completes a partially-known reference

func (Refstore) PutRef added in v0.1.1

func (rs Refstore) PutRef(r repo.DatasetRef) (err error)

PutRef adds a reference to the store

func (Refstore) RefCount added in v0.1.1

func (rs Refstore) RefCount() (int, error)

RefCount returns the size of the Refstore

func (Refstore) References added in v0.1.1

func (rs Refstore) References(offset, limit int) ([]repo.DatasetRef, error)

References gives a set of dataset references from the store

type Repo

type Repo struct {
	repo.Refstore
	EventLog
	// contains filtered or unexported fields
}

Repo is a filesystem-based implementation of the Repo interface

func (*Repo) Destroy

func (r *Repo) Destroy() error

Destroy destroys this repository

func (Repo) Filesystem added in v0.7.0

func (r Repo) Filesystem() qfs.Filesystem

Filesystem returns this repo's Filesystem

func (Repo) Path added in v0.8.0

func (r Repo) Path() string

Path returns the path to the root of the repo directory

func (*Repo) PrivateKey added in v0.3.0

func (r *Repo) PrivateKey() crypto.PrivKey

PrivateKey returns this repo's private key

func (*Repo) Profile

func (r *Repo) Profile() (*profile.Profile, error)

Profile gives this repo's peer profile

func (*Repo) Profiles added in v0.3.0

func (r *Repo) Profiles() profile.Store

Profiles returns this repo's Peers implementation

func (*Repo) Search

func (r *Repo) Search(p repo.SearchParams) ([]repo.DatasetRef, error)

Search this repo for dataset references

func (*Repo) SetFilesystem added in v0.8.0

func (r *Repo) SetFilesystem(fs qfs.Filesystem)

SetFilesystem implements QFSSetter, currently used during lib contstruction

func (*Repo) SetProfile added in v0.3.0

func (r *Repo) SetProfile(p *profile.Profile) error

SetProfile updates this repo's peer profile info

func (Repo) Store

func (r Repo) Store() cafs.Filestore

Store returns the underlying cafs.Filestore driving this repo

func (*Repo) UpdateSearchIndex

func (r *Repo) UpdateSearchIndex(store cafs.Filestore) error

UpdateSearchIndex refreshes this repos search index

Jump to

Keyboard shortcuts

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