isle/tasks/nats/garage-watcher.md

685 B

type after
task
./pubsub.md

A simple mechanism should be developed which "watches" a garage directory or file for changes. This mechanism has two 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:

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.