scan

package
v0.0.0-...-6c0d6cf Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeFolder

func InitializeFolder(baseFs afero.Fs, path string) (afero.Fs, error)

InitializeFolder prepares a folder to be used by CoBack. Creates the folder if necessary and returns an afero.Fs which roots at the specified folder.

func Scan

func Scan(fs afero.Fs) catalog.Catalog

Scan recursively scans the whole file system

func ScanAdd

func ScanAdd(fs afero.Fs, c catalog.Catalog, diff FileSystemDiff) catalog.Catalog

ScanAdd performs a scan on a folder and checks the contents against a catalog. If new files are missing from the catalog they are added and a modified catalog is returned.

func ScanFolder

func ScanFolder(fs afero.Fs, root string, filter FileFilter) catalog.Catalog

ScanFolder recursively scans the root folder and adds all files to the catalog

func SyncCatalogWithCollectionFolder

func SyncCatalogWithCollectionFolder(fs afero.Fs) (catalog.Catalog, error)

SyncCatalogWithCollectionFolder makes sure that the catalog in the folder is in sync with the file system The fs parameter is treated as the root of the Collection folder.

func SyncCatalogWithImportFolder

func SyncCatalogWithImportFolder(fs afero.Fs) (catalog.Catalog, error)

SyncCatalogWithImportFolder makes sure that the catalog in the folder is in sync with the file system The fs parameter is treated as the root of the import folder.

func SyncCatalogWithStagingFolder

func SyncCatalogWithStagingFolder(fs afero.Fs, collection catalog.Catalog) (catalog.Catalog, error)

SyncCatalogWithStagingFolder makes sure that the catalog in the folder is in sync with the file system The fs parameter is treated as the root of the staging folder.

Types

type DoubleProgressBar

type DoubleProgressBar interface {
	SetTotal(count int64, size int64)
	IncrBy(n int)
	CurrentCount() int64
	CurrentSize() int64
	Wait()
}

DoubleProgressBar contains two progress bars, one for file count and one for size

type FileFilter

type FileFilter interface {
	Include(path string) bool
}

FileFilter is an interface for filters used in the catalog scanning pipeline

func ExtensionFilter

func ExtensionFilter(extensions ...string) FileFilter

ExtensionFilter filters the files based on their extension. The listed extensions will be excluded

type FileSystemDiff

type FileSystemDiff struct {
	Ok     map[string]bool
	Add    map[string]bool
	Delete map[string]bool
	Update map[string]bool
}

FileSystemDiff contains the details of catalog checked against a folder in the file system. Ok (set of paths): these files have the same size, modification time and content in the catalog and the FS Add (set of paths): these files are present in the FS but not int the catalog, have to be added Delete (set of paths): these files are present in the catalog but not present in the FS anymore, have to be deleted Update (set of paths): these files have different size, modification time or content in the catalog and the FS.

Probably a full re-scan should be done

func Diff

func Diff(fs afero.Fs, c catalog.Catalog, deepCheck bool) FileSystemDiff

Diff scans a folder and compares it to the catalog the same way as DiffFiltered does but without filtering out any files

func DiffFiltered

func DiffFiltered(fs afero.Fs, c catalog.Catalog, filter FileFilter, deepCheck bool) FileSystemDiff

DiffFiltered scans a folder and compares its contents to the contents of the catalog. It performs a full scan and returns the file paths separated into multiple lists based on the file status.

func NewFileSystemDiff

func NewFileSystemDiff() FileSystemDiff

NewFileSystemDiff creates a new FileSystemDiff struct

Jump to

Keyboard shortcuts

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