watcher

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package watcher provides file system watching utilities for detecting database file/directory deletions and triggering recreation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

Watcher monitors a file or directory for deletion and calls onDelete when removed. It watches the parent directory since fsnotify cannot watch non-existent files.

func New

func New(targetPath string, onDelete func()) (*Watcher, error)

New creates a new Watcher for the given target path. The onDelete callback is called when the target is deleted.

func (*Watcher) Start

func (w *Watcher) Start() error

Start begins watching for file deletion events.

func (*Watcher) Stop

func (w *Watcher) Stop() error

Stop stops the watcher.

Jump to

Keyboard shortcuts

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