hit

package
v0.0.0-...-27b3b18 Latest Latest
Warning

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

Go to latest
Published: May 20, 2025 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelPath

func DelPath(db *bbolt.DB, target string, path string) error

DelPath deletes path hits.

func DelTarget

func DelTarget(db *bbolt.DB, target string) error

DelTarget deletes target hits. Entire key is removed.

Types

type History

type History struct {
	Target string `json:"target"`
	Paths  Paths  `json:"paths"`
}

History represents target hit history.

func SelectAll

func SelectAll(db *bbolt.DB) ([]*History, error)

SelectAll returns all hits.

func (*History) Save

func (hits *History) Save(db *bbolt.DB) error

Save saves hits.

func (*History) ToSlice

func (hits *History) ToSlice() [][]string

ToSlice returns string slices from given history.

type Meta

type Meta struct {
	Time   time.Time  `json:"time"`
	Rules  []string   `json:"rules"`
	Status string     `json:"status"`
	Attr   *fsys.Attr `json:"attr"`
	Acts   []string   `json:"actions"`
}

Meta represents hit meta.

func NewMeta

func NewMeta(attr *fsys.Attr, matches []string, verbs ...string) *Meta

NewMeta returns new hit meta.

func SelectLast

func SelectLast(db *bbolt.DB, path string) (*Meta, error)

SelectLast returns a path's most recent hit.

func (*Meta) Restore

func (meta *Meta) Restore(quarantineDir string, dst string) error

Restore restores a quarantined hit.

func (*Meta) ToSlice

func (meta *Meta) ToSlice(path string) []string

ToSlice returns a string slice from given meta and path.

type Paths

type Paths map[string][]*Meta

Paths represents path:hits.

func SelectTarget

func SelectTarget(db *bbolt.DB, target string) (Paths, error)

SelectTarget returns a target's hits.

func (Paths) ToSlice

func (hits Paths) ToSlice() [][]string

ToSlice returns string slices from given paths.

Jump to

Keyboard shortcuts

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