9f0c8d6616
This changeset implements webhook notification endpoints for dispatching registry events. Repository instances can be decorated by a listener that converts calls into context-aware events, using a bridge. Events generated in the bridge are written to a sink. Implementations of sink include a broadcast and endpoint sink which can be used to configure event dispatch. Endpoints represent a webhook notification target, with queueing and retries built in. They can be added to a Broadcaster, which is a simple sink that writes a block of events to several sinks, to provide a complete dispatch mechanism. The main caveat to the current approach is that all unsent notifications are inmemory. Best effort is made to ensure that notifications are not dropped, to the point where queues may back up on faulty endpoints. If the endpoint is fixed, the events will be retried and all messages will go through. Internally, this functionality is all made up of Sink objects. The queuing functionality is implemented with an eventQueue sink and retries are implemented with retryingSink. Replacing the inmemory queuing with something persistent should be as simple as replacing broadcaster with a remote queue and that sets up the sinks to be local workers listening to that remote queue. Metrics are kept for each endpoint and exported via expvar. This may not be a permanent appraoch but should provide enough information for troubleshooting notification problems. Signed-off-by: Stephen J Day <stephen.day@docker.com> |
||
---|---|---|
.. | ||
decorator | ||
notifications | ||
blobstore.go | ||
cloudfrontlayerhandler.go | ||
delegatelayerhandler.go | ||
doc.go | ||
filereader_test.go | ||
filereader.go | ||
filewriter_test.go | ||
filewriter.go | ||
layer_test.go | ||
layer.go | ||
layerhandler.go | ||
layerreader.go | ||
layerstore.go | ||
layerupload.go | ||
manifeststore_test.go | ||
manifeststore.go | ||
paths_test.go | ||
paths.go | ||
registry.go | ||
revisionstore.go | ||
services.go | ||
tagstore.go |