From 9fd2f9eabe93713c0e8fb7dd094e77109db84265 Mon Sep 17 00:00:00 2001 From: RanXom Date: Tue, 14 Jul 2026 11:46:12 +0530 Subject: feat(watcher): introduce filesystem watcher abstraction --- internal/watcher/watcher.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 internal/watcher/watcher.go (limited to 'internal/watcher/watcher.go') diff --git a/internal/watcher/watcher.go b/internal/watcher/watcher.go new file mode 100644 index 0000000..5465554 --- /dev/null +++ b/internal/watcher/watcher.go @@ -0,0 +1,21 @@ +package watcher + +import "context" + +type Watcher struct { + config Config +} + +func New(config Config) *Watcher { + return &Watcher{ + config: config, + } +} + +// Run starts the watcher. +// +// Placeholder implementation. +func (w *Watcher) Run(ctx context.Context) error { + <-ctx.Done() + return nil +} -- cgit v1.2.3 From b336f4a1328e24ac77a1cfee8c52b18caa555620 Mon Sep 17 00:00:00 2001 From: RanXom Date: Tue, 14 Jul 2026 12:03:34 +0530 Subject: feat(watcher): watch configured directories --- internal/watcher/watcher.go | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'internal/watcher/watcher.go') diff --git a/internal/watcher/watcher.go b/internal/watcher/watcher.go index 5465554..1ca8e37 100644 --- a/internal/watcher/watcher.go +++ b/internal/watcher/watcher.go @@ -1,7 +1,5 @@ package watcher -import "context" - type Watcher struct { config Config } @@ -11,11 +9,3 @@ func New(config Config) *Watcher { config: config, } } - -// Run starts the watcher. -// -// Placeholder implementation. -func (w *Watcher) Run(ctx context.Context) error { - <-ctx.Done() - return nil -} -- cgit v1.2.3 From 9eb299c3ac08e2bea4dfe9e3355178566bcf0501 Mon Sep 17 00:00:00 2001 From: RanXom Date: Fri, 17 Jul 2026 00:36:31 +0530 Subject: refactor(watcher): isolate debounce loop --- internal/watcher/watcher.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'internal/watcher/watcher.go') diff --git a/internal/watcher/watcher.go b/internal/watcher/watcher.go index 1ca8e37..ee16b7b 100644 --- a/internal/watcher/watcher.go +++ b/internal/watcher/watcher.go @@ -1,11 +1,20 @@ package watcher +import "time" + type Watcher struct { config Config + + debounce chan struct{} } func New(config Config) *Watcher { + if config.Debounce <= 0 { + config.Debounce = 500 * time.Millisecond + } + return &Watcher{ - config: config, + config: config, + debounce: make(chan struct{}), } } -- cgit v1.2.3 From c8a8431158f07b75adc1fd86b344790075b9cf7a Mon Sep 17 00:00:00 2001 From: RanXom Date: Fri, 17 Jul 2026 10:33:58 +0530 Subject: refactor(watcher): buffer debounce notifications --- internal/watcher/watcher.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'internal/watcher/watcher.go') diff --git a/internal/watcher/watcher.go b/internal/watcher/watcher.go index ee16b7b..303eced 100644 --- a/internal/watcher/watcher.go +++ b/internal/watcher/watcher.go @@ -15,6 +15,6 @@ func New(config Config) *Watcher { return &Watcher{ config: config, - debounce: make(chan struct{}), + debounce: make(chan struct{}, 1), } } -- cgit v1.2.3