Documentation ¶
Index ¶
- Constants
- Variables
- func Base64(b []byte) string
- func CompareIndices(pathA, pathB string) error
- func DirsToIndex(indexPath string, dirs []Dir, basePath string, t StorageType) error
- func IndexBenchRead() error
- func IndexBenchWrite() error
- func IndexPath(path, indexFile string, prefixes []string) error
- func RootCmd() *cobra.Command
- type BoltIndex
- type Diff
- type Dir
- type DirSeal
- type FileDiff
- type FileSeal
- type IndexStorage
- type LoadedIndex
- type PebbleIndex
- type SqliteIndex
- type StorageType
- type StoredSeal
Constants ¶
View Source
const SealFile = ".seal.json"
SealFile is the filepath that is used in every sealed directory.
Variables ¶
View Source
var ( Before time.Time PrintInterval time.Duration IndexFile string PathPrefixes []string WriteLock sync.Mutex )
View Source
var ( PrintIndexProgress = false IndexProgressInterval = 15 * time.Second )
View Source
var ( PrintSealing = false PrintAllSealing = false )
View Source
var ( PrintVerify = false PrintAllVerify = false )
View Source
var PrintDirsToIndex = true
Functions ¶
func CompareIndices ¶
func DirsToIndex ¶
func DirsToIndex(indexPath string, dirs []Dir, basePath string, t StorageType) error
func IndexBenchRead ¶
func IndexBenchRead() error
func IndexBenchWrite ¶
func IndexBenchWrite() error
Types ¶
type BoltIndex ¶
type BoltIndex struct {
// contains filtered or unexported fields
}
func OpenBoltDB ¶
func (*BoltIndex) LoadAfterHash ¶
func (i *BoltIndex) LoadAfterHash(hash []byte, count int) ([]StoredSeal, error)
type Diff ¶
type Diff struct { Identical bool HashChecked bool Want *DirSeal Have *DirSeal NameMatches bool TotalSizeMatches bool SHA256Matches bool FilesAdded []*FileSeal FilesMissing []*FileSeal FilesChanged []*FileDiff }
Diff holds the differences between two DirSeals.
func (*Diff) PrintDifferences ¶
func (d *Diff) PrintDifferences()
PrintDifferences prints the differences between two seals.
type Dir ¶
type DirSeal ¶
type DirSeal struct { Name string TotalSize int64 SHA256 []byte Modified time.Time Sealed time.Time // Verified time.Time Files []*FileSeal }
DirSeal represents a complete seal of the directory including all files and subdirectories.
The SHA256 is calculated by sorting the files by name and appending all sizes as 8 bytes in big endian format as well as the raw bytes of the files SHA256 hash.
type FileDiff ¶
type FileDiff struct { Want *FileSeal Have *FileSeal IsDirMatches bool SizeMatches bool ModifiedMatches bool SHA256Matches bool }
FileDiff holds the differences between two FileSeals.
type FileSeal ¶
type FileSeal struct { OldVersion bool `json:",omitempty"` Deleted bool `json:",omitempty"` Name string IsDir bool `json:",omitempty"` Size int64 SHA256 []byte Modified time.Time Sealed time.Time }
FileSeal represents one file inside a directory. If IsDir is true, the fields are populated from the seal file of the subdirectory with this name.
The SHA256 is calculated from the contents of the file.
type IndexStorage ¶
type LoadedIndex ¶
type LoadedIndex struct { Dirs []Dir ByHash map[string]*StoredSeal ByPath map[string]*StoredSeal }
func LoadIndex ¶
func LoadIndex(indexPath string, t StorageType) (*LoadedIndex, error)
type PebbleIndex ¶
type PebbleIndex struct {
// contains filtered or unexported fields
}
func OpenPebble ¶
func OpenPebble(indexPath string) (*PebbleIndex, error)
func (*PebbleIndex) Close ¶
func (i *PebbleIndex) Close() error
func (*PebbleIndex) Flush ¶
func (i *PebbleIndex) Flush() error
func (*PebbleIndex) LoadAfterHash ¶
func (i *PebbleIndex) LoadAfterHash(hash []byte, count int) ([]StoredSeal, error)
type SqliteIndex ¶
type SqliteIndex struct {
// contains filtered or unexported fields
}
func OpenSqlite ¶
func OpenSqlite(indexPath string) (*SqliteIndex, error)
func (*SqliteIndex) Close ¶
func (i *SqliteIndex) Close() error
func (*SqliteIndex) LoadAfterHash ¶
func (i *SqliteIndex) LoadAfterHash(hash []byte, count int) ([]StoredSeal, error)
type StorageType ¶
type StorageType string
const StorageTypeBoltDB StorageType = "boltdb"
const StorageTypePebble StorageType = "pebble"
const StorageTypeSQLite StorageType = "sqlite"
type StoredSeal ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.