open-consul/agent/config
Dhia Ayachi 378f688a6a
file watcher to be used for configuration auto-reload feature (#12301)
* add config watcher to the config package

* add logging to watcher

* add test and refactor to add WatcherEvent.

* add all API calls and fix a bug with recreated files

* add tests for watcher

* remove the unnecessary use of context

* Add debug log and a test for file rename

* use inode to detect if the file is recreated/replaced and only listen to create events.

* tidy ups (#1535)

* tidy ups

* Add tests for inode reconcile

* fix linux vs windows syscall

* fix linux vs windows syscall

* fix windows compile error

* increase timeout

* use ctime ID

* remove remove/creation test as it's a use case that fail in linux

* fix linux/windows to use Ino/CreationTime

* fix the watcher to only overwrite current file id

* fix linter error

* fix remove/create test

* set reconcile loop to 200 Milliseconds

* fix watcher to not trigger event on remove, add more tests

* on a remove event try to add the file back to the watcher and trigger the handler if success

* fix race condition

* fix flaky test

* fix race conditions

* set level to info

* fix when file is removed and get an event for it after

* fix to trigger handler when we get a remove but re-add fail

* fix error message

* add tests for directory watch and fixes

* detect if a file is a symlink and return an error on Add

* rename Watcher to FileWatcher and remove symlink deref

* add fsnotify@v1.5.1

* fix go mod

* fix flaky test

* Apply suggestions from code review

Co-authored-by: Ashwin Venkatesh <ashwin@hashicorp.com>

* fix a possible stack overflow

* do not reset timer on errors, rename OS specific files

* start the watcher when creating it

* fix data race in tests

* rename New func

* do not call handler when a remove event happen

* events trigger on write and rename

* fix watcher tests

* make handler async

* remove recursive call

* do not produce events for sub directories

* trim "/" at the end of a directory when adding

* add missing test

* fix logging

* add todo

* fix failing test

* fix flaking tests

* fix flaky test

* add logs

* fix log text

* increase timeout

* reconcile when remove

* check reconcile when removed

* fix reconcile move test

* fix logging

* delete invalid file

* Apply suggestions from code review

Co-authored-by: R.B. Boyer <4903+rboyer@users.noreply.github.com>

* fix review comments

* fix is watched to properly catch a remove

* change test timeout

* fix test and rename id

* fix test to create files with different mod time.

* fix deadlock when stopping watcher

* Apply suggestions from code review

Co-authored-by: R.B. Boyer <4903+rboyer@users.noreply.github.com>

* fix a deadlock when calling stop while emitting event is blocked

* make sure to close the event channel after the event loop is done

* add go doc

* back date file instead of sleeping

* Apply suggestions from code review

Co-authored-by: R.B. Boyer <4903+rboyer@users.noreply.github.com>

* check error

Co-authored-by: Ashwin Venkatesh <ashwin@hashicorp.com>
Co-authored-by: R.B. Boyer <4903+rboyer@users.noreply.github.com>
2022-02-21 11:36:52 -05:00
..
testdata [sync ent] increase segment max limit to 4*64, make configurable (#1424) (#11795) 2021-12-09 15:36:11 -08:00
agent_limits.go
builder.go config: correctly capture all errors. 2022-01-05 17:51:03 -05:00
builder_oss.go
builder_oss_test.go
builder_test.go config: correctly capture all errors. 2022-01-05 17:51:03 -05:00
config.go
config_oss.go
default.go [sync ent] increase segment max limit to 4*64, make configurable (#1424) (#11795) 2021-12-09 15:36:11 -08:00
default_oss.go
deprecated.go
deprecated_test.go bulk rewrite using this script 2022-01-20 10:46:23 -06:00
doc.go
file_watcher.go file watcher to be used for configuration auto-reload feature (#12301) 2022-02-21 11:36:52 -05:00
file_watcher_test.go file watcher to be used for configuration auto-reload feature (#12301) 2022-02-21 11:36:52 -05:00
flags.go
flags_test.go
flagset.go
golden_test.go
limits.go
limits_windows.go
merge.go
merge_test.go
runtime.go
runtime_oss.go
runtime_oss_test.go
runtime_test.go [sync ent] increase segment max limit to 4*64, make configurable (#1424) (#11795) 2021-12-09 15:36:11 -08:00
segment_oss.go
segment_oss_test.go