Documentation ¶
Index ¶
- func InitializeFolder(baseFs afero.Fs, path string) (afero.Fs, error)
- func Scan(fs afero.Fs) catalog.Catalog
- func ScanAdd(fs afero.Fs, c catalog.Catalog, diff FileSystemDiff) catalog.Catalog
- func ScanFolder(fs afero.Fs, root string, filter FileFilter) catalog.Catalog
- func SyncCatalogWithCollectionFolder(fs afero.Fs) (catalog.Catalog, error)
- func SyncCatalogWithImportFolder(fs afero.Fs) (catalog.Catalog, error)
- func SyncCatalogWithStagingFolder(fs afero.Fs, collection catalog.Catalog) (catalog.Catalog, error)
- type DoubleProgressBar
- type FileFilter
- type FileSystemDiff
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeFolder ¶
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 ScanAdd ¶
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 ¶
ScanFolder recursively scans the root folder and adds all files to the catalog
func SyncCatalogWithCollectionFolder ¶
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 ¶
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 ¶
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 ¶
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 ¶
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