Documentation ¶
Overview ¶
Package snapshot manages file tree snapshots created by the "fsdiff snapshot" command.
Index ¶
- Constants
- func Marshal(v interface{}) ([]byte, error)
- func Unmarshal(data []byte, v interface{}) error
- type CreateOpt
- type FileInfo
- type Metadata
- type Snapshot
- func (s *Snapshot) Close() error
- func (s *Snapshot) FilesByChecksum() ([]*FileInfo, error)
- func (s *Snapshot) FilesByPath() ([]*FileInfo, error)
- func (s *Snapshot) Metadata() *Metadata
- func (s *Snapshot) Read(readFunc func(byPath, byChecksum *bolt.Bucket) error) error
- func (s *Snapshot) Write(writeFunc func(byPath, byChecksum *bolt.Bucket) error) error
Constants ¶
const FormatVersion = 1
FormatVersion represents the current snapshot file format version.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreateOpt ¶
type CreateOpt func(c *createSnapshotOptions)
CreateOpt represents a Snapshot creation option.
func CreateOptCarryOn ¶
func CreateOptCarryOn() CreateOpt
CreateOptCarryOn sets the Snapshot creation to continue in case of filesystem error.
func CreateOptExclude ¶
CreateOptExclude sets at list of gitignore-compatible exclusion pattern.
func CreateOptShallow ¶
func CreateOptShallow() CreateOpt
CreateOptShallow sets the Snapshot creation to skip files checksum computation.
type FileInfo ¶
type FileInfo struct { Path string Size int64 Mtime time.Time Uid uint32 // FIXME: rename field to "UID" during next snapshot format version increment Gid uint32 // FIXME: rename field to "GID" during next snapshot format version increment Mode os.FileMode LinkTo string IsDir bool IsSock bool IsPipe bool IsDev bool Checksum []byte }
FileInfo represents information about a file referenced in a Snapshot.
type Metadata ¶
type Metadata struct { // FormatVersion is the snapshot format version, for backward compatibility. FormatVersion int // FsdiffVersion is the version of the "fsdiff" command that has been used to create the snapshot. FsdiffVersion string // Date is the date when the snapshot has been created. Date time.Time // RootDir is the absolute path to the snapshotted root directory. RootDir string // Shallow indicates if the snapshot has been done in "shallow" mode. Shallow bool }
Metadata represent a Snapshot metadata.
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot represents a filesystem snapshot.
func Create ¶
Create creates a new Snapshot of directory <root> to be stored to file <outFile>. If the <shallow> argument is true, the snapshot will be performed in "shallow" mode (i.e. without computing files checksum).
func (*Snapshot) FilesByChecksum ¶
FilesByChecksum returns a list of FileInfo referenced by checksum in the Snapshot.
func (*Snapshot) FilesByPath ¶
FilesByPath returns a list of FileInfo referenced by path in the Snapshot.