didmod

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: MIT Imports: 3 Imported by: 1

Documentation

Overview

Package didmod implements a robust strategy for checking if a file may have changed, based on @apenwarr's blog post "mtime comparison considered harmful" https://apenwarr.ca/log/20181113 From the article:

 My implementation of redo remembers the following information about each
 source and target:
   * mtime
   * size
   * inode number
   * file mode
   * owner uid and gid
   * (targets only) the sequence number of the last time it was built
redo considers a dependency dirty if any of those attributes changed since
the last time a target was built

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIds

func GetIds(filename string, fi os.FileInfo) (uint64, uint32, uint32, uint32)

GetIds returns ids for the file: the inode, the volume, user id, group id

Types

type Props

type Props struct {
	Name  string      `json:"name,omitempty"`
	Mtime time.Time   `json:"mtime,omitempty"`
	Size  int64       `json:"size,omitempty"`
	Mode  os.FileMode `json:"mode,omitempty"`

	Inode   uint64 `json:"inode,omitempty"`
	Volume  uint32 `json:"volume",omitempty"`
	UserID  uint32 `json:"userid,omitempty"`
	GroupID uint32 `json:"groupid,omitempty"`
}

Props are tracked properties of a file used for checking for changes

func NewProps

func NewProps(filename string) (p Props, err error)

NewProps constructs Props by 'stat'-ing a file

func NewPropsFileInfo

func NewPropsFileInfo(filename string, fi os.FileInfo) Props

NewPropsFileInfo constructs props from an os.FileInfo, filling in as many fields as possible

func (Props) Equal

func (p Props) Equal(b Props) bool

Equal checks for strict equality between two props structs

Jump to

Keyboard shortcuts

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