record

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PurgeAttr

func PurgeAttr(f *os.File) error

PurgeAttr removes xtagger's extended attribute from the given file.

Types

type Attribute

type Attribute map[string]*Record

Represents the whole content of a user.xtagger xattr entry

func FLoadAttribute

func FLoadAttribute(f *os.File) (Attribute, error)

Loads the xtagger extended attribute for File f. Returns an empty Attribute if the file does not have an extended attribute.

func LoadAttribute

func LoadAttribute(path string) (Attribute, error)

Loads the xtagger extended attribute for path.

func (Attribute) Exists

func (r Attribute) Exists(name string) bool

func (Attribute) FStore

func (r Attribute) FStore(f *os.File) error

Stores the xtagger extended attribute in File's inode.

func (Attribute) FilterByName

func (r Attribute) FilterByName(name ...string) Attribute

func (Attribute) FprintRecordsWithPath

func (r Attribute) FprintRecordsWithPath(w io.Writer, path string) (n int, err error)

func (Attribute) MostRecent

func (r Attribute) MostRecent() (name string, rec *Record)

Returns the newest Record. Returns zero-values if no record was found.

func (Attribute) Store

func (r Attribute) Store(path string) error

Stores the xtagger extended attribute in path's inode.

type Record

type Record struct {
	Checksum  string      `json:"c"` //Hex-string of the SHA256sum of the file.
	HashAlgo  hashes.Algo `json:"h"` //Name of the used hashing algorithm.
	Timestamp int64       `json:"t"` //Unix timestamp of the record's creation.
	Valid     bool        `json:"v"` //Record valid if true, invalidated if false.
}

Represents a single record within a user.xtagger xattr entry

func NewRecord

func NewRecord() *Record

Returns a new record with the current time as timestamp. All other member fields are zero-values.

func (*Record) Copy

func (r *Record) Copy() *Record

func (*Record) Equals

func (a *Record) Equals(b *Record) bool

Jump to

Keyboard shortcuts

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