29 lines
683 B
Markdown
29 lines
683 B
Markdown
---
|
|
type: tasks
|
|
after:
|
|
- ./add.md
|
|
---
|
|
|
|
A simple mechanism should be developed which "watches" a garage directory or
|
|
file for changes. This mechanism has too sides.
|
|
|
|
## Producer
|
|
|
|
When making a change to a file in garage (putting or deleting) the producer
|
|
should publish the path to that file to a bucket-specific pubsub channel on
|
|
NATS.
|
|
|
|
This only applies for file changes which are expected to have a watcher.
|
|
|
|
## Watcher
|
|
|
|
The watcher is a simple mechanism which looks like this:
|
|
|
|
```go
|
|
type Watcher interface {
|
|
Wait(context.Context) (string, error) // returns the path to the changed file
|
|
}
|
|
```
|
|
|
|
It can be initialized with either a specific file path or a doublestar matcher.
|