pfinternal

package
v0.0.0-...-3e16184 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2016 License: GPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UpdateTypeError_ = iota

	UpdateTypeCreate = iota
	UpdateTypeUpdate = iota
	UpdateTypeDelete = iota
)
View Source
const (
	PathStateError_ = iota

	PathStateNew        = iota
	PathStateUpdated    = iota
	PathStateUnaffected = iota
)
View Source
const (
	EntityTypeFile = iota
	EntityTypePath = iota
)
View Source
const (
	Sha1Algorithm   = "sha1"
	Sha256Algorithm = "sha256"
)
View Source
const (
	CurrentSchemaVersion = 2
)
View Source
const (
	DbType = "sqlite3"
)
View Source
const (
	LogPackageVersion = 1
)
View Source
const (
	PathListBatchSize = 3
)

Variables

View Source
var ErrFileChanged = errors.New("mtime for filename does not match")
View Source
var ErrNoHash = errors.New("no hash recorded for the filename")

TODO(dustin): !! We ended-up going the other direction with our errors. Deimplement these?

Functions

func ConfigureRootLogger

func ConfigureRootLogger()

func EntityTypeName

func EntityTypeName(entityType int) string

func NewCatalogResource

func NewCatalogResource(catalogFilepath *string, hashAlgorithm *string) (cr *catalogResource, err error)

func NewLogger

func NewLogger(context string) log.Logger

func PathStateName

func PathStateName(pathState int) string

func SetDebugLogging

func SetDebugLogging()

func UpdateTypeName

func UpdateTypeName(updateType int) string

Types

type Catalog

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

func NewCatalog

func NewCatalog(catalogResource *catalogResource, scanPath *string, allowUpdates bool, hashAlgorithm *string, reportingChannel chan<- *ChangeEvent) (cp *Catalog, err error)

func (*Catalog) BranchCatalog

func (self *Catalog) BranchCatalog(childPathName *string) (*Catalog, error)

func (*Catalog) Cleanup

func (self *Catalog) Cleanup() (err error)

func (*Catalog) Close

func (self *Catalog) Close() error

func (*Catalog) Open

func (self *Catalog) Open() error

func (*Catalog) PruneOldFiles

func (self *Catalog) PruneOldFiles() (err error)

Delete all file records that haven't been touched in this run (because all of the ones that match known files have been updated to a later timestamp than they had).

func (*Catalog) PruneOldPaths

func (self *Catalog) PruneOldPaths() (err error)

Delete all path records that haven't been touched in this run (because all of the ones that match known files have been updated to a later timestamp than they had).

type ChangeEvent

type ChangeEvent struct {
	EntityType int
	ChangeType int
	RelPath    string
}

type Path

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

func NewPath

func NewPath(hashAlgorithm *string, reportingChannel chan<- *ChangeEvent) *Path

func (*Path) GenerateFileHash

func (self *Path) GenerateFileHash(filepath *string) (hash string, err error)

func (*Path) GeneratePathHash

func (self *Path) GeneratePathHash(scanPath *string, relPath *string, existingCatalog *Catalog) (hash string, err error)

Generate a hash for a path.

Jump to

Keyboard shortcuts

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