watcher

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package watcher provides file change detection for a git repository. It supports fsnotify-based filesystem watching (primary) and git polling (fallback).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Path string
	Kind EventKind
}

Event represents a file change event.

type EventKind

type EventKind int

EventKind represents the type of file change.

const (
	Created EventKind = iota
	Modified
	Deleted
)

func (EventKind) String

func (k EventKind) String() string

type LogFunc

type LogFunc func(format string, args ...any)

LogFunc is an optional debug logging function.

type Watcher

type Watcher interface {
	// Events returns a channel that receives file change events.
	Events() <-chan Event
	// Close stops the watcher and releases resources.
	Close() error
}

Watcher watches a git repository for file changes and emits events.

func New

func New(cfg config.Config, repo *git.Repo, logFn LogFunc) (Watcher, error)

New creates a Watcher based on the given configuration. If PollOnly is set, only git polling is used. Otherwise, fsnotify is the primary watcher with git polling as a fallback. The optional logFn is used for debug logging; pass nil to disable.

Jump to

Keyboard shortcuts

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