Documentation ¶
Index ¶
- func NewIPFSClient(projectID, projectSecret string) *http.Client
- type CID
- type Datastore
- func (d *Datastore) Add(path FilePath) (files chan *File, done chan struct{}, errs chan error)
- func (d *Datastore) AddFile(path FilePath) (*File, error)
- func (d *Datastore) CID() (CID, bool)
- func (d *Datastore) FindCID(path FilePath) (CID, bool)
- func (d *Datastore) FindPath(cid CID) (FilePath, bool)
- func (d *Datastore) FromJSON(b []byte) error
- func (d *Datastore) JSON() ([]byte, error)
- func (d *Datastore) RangeStore(done func(*File) (done bool))
- func (d *Datastore) RemoveFile(path FilePath) error
- func (d *Datastore) Start() error
- func (d *Datastore) Stop() error
- func (d *Datastore) UpdateCID(cid CID)
- type File
- type FilePath
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewIPFSClient ¶
NewIPFSClient constructs an http client configured to perform basic auth on every request
Types ¶
type CID ¶
type CID string
CID represents an IPFS content identifier. See https://docs.ipfs.io/concepts/content-addressing/
type Datastore ¶
type Datastore struct {
// contains filtered or unexported fields
}
Datastore wraps a distributed datastore like IPFS, but keeps all watched files up to date
func NewDatastore ¶
func NewDatastore(sh *shell.Shell, backupLocation string, refreshInterval time.Duration) (*Datastore, error)
NewDatastore constructs a datastore with the given settings
func (*Datastore) Add ¶
Add adds the file or directory at the given path to the store while communicating any errors that are encountered. When all files have been processed a message is published one the "done" channel
func (*Datastore) RangeStore ¶
RangeStore iterates over all files in the store until done() returns true
func (*Datastore) RemoveFile ¶
func (*Datastore) Start ¶
Start launches the event listeners for the datastore, returning the first error returned
type File ¶
type File struct { CID CID `json:"cid"` AbsolutePath FilePath `json:"absolute_path"` Watcher *Watcher `json:"-"` // contains filtered or unexported fields }
File represents a file being watched
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher is a utility that can watch for updates
func NewWatcher ¶
NewWatcher constructs a new watcher for the given file