tracker

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

Tracker

Getting started

make build
make test-tracker

Status

  • Supports local file systems for Linux and OSX.
  • Local file system support for Windows can be added very easily (it's supported by Go).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSDriver

type FSDriver interface {
	// Walk traverses the file system entries and writes each entry to fsEntriesCh.
	// It must check for an error in errCh (which indicates the receiver of fsEntriesCh encountered
	// a problem and terminate if one is present.
	// Walk is the PRODUCER on fsEntriesCh and IS RESPONSIBLE FOR CLOSING IT!!
	Walk(ctx context.Context, fsName db.FSName, path string, fsEntriesCh chan<- db.FSEntry, errCh <-chan error) error
}

FSDriver represents the operations that may be performed on a file system.

type RefreshOption

type RefreshOption func(*config)

func WithEntriesChannelSize

func WithEntriesChannelSize(n int) RefreshOption

WithEntriesChannelSize is a functional parameter that allows to choose the size of the entries channel used by AddNewFileSystemEntries.

type Tracker

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

Tracker contains the elements necessary to track file system mutations.

func NewTracker

func NewTracker(ctx context.Context, logger *zap.Logger, store storer, fsDriver FSDriver, fsName db.FSName) (*Tracker, error)

NewTracker creates a new initiliased Tracker.

func (*Tracker) GetRootPath

func (t *Tracker) GetRootPath(ctx context.Context) (string, error)

TODO: the fact that this method returns an interface indicates a problem.

the implementation of this method likely belongs to the sync package, not the tracker.

func (*Tracker) ListMutations

func (t *Tracker) ListMutations(ctx context.Context) (db.FSMutations, error)

ListMutations finds all mutations that have taken place in the file system between VersionPrevious and VersionNew.

func (*Tracker) RefreshFSContents

func (t *Tracker) RefreshFSContents(ctx context.Context, opts ...RefreshOption) error

RefreshFSContents walks the specified file system and saves the new contents as VersionNew. In order to proceed, RefreshFSContents first drops all VersionPrevious entries and moves the current VersionNew entries as VersionPrevious.

Directories

Path Synopsis
db

Jump to

Keyboard shortcuts

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