Просмотр исходного кода

registry: adds comments to interfaces

bergquist 7 лет назад
Родитель
Сommit
f0f6d0e915
1 измененных файлов с 12 добавлено и 1 удалено
  1. 12 1
      pkg/registry/registry.go

+ 12 - 1
pkg/registry/registry.go

@@ -34,12 +34,23 @@ func GetServices() []*Descriptor {
 	return services
 }
 
+// Service interface is the lowest common shape that services
+// are expected to forfill to be started within Grafana.
 type Service interface {
+
+	// Init is called by Grafana main process which gives the service
+	// the possibility do some initial work before its started. Things
+	// like adding routes, bus handlers should be done in the Init function
 	Init() error
 }
 
-// Useful for alerting service
+// CanBeDisabled allows the services to decide if it should
+// be started or not by itself. This is useful for services
+// that might not always be started, ex alerting.
+// This will be called after `Init()`.
 type CanBeDisabled interface {
+
+	// IsDisabled should return a bool saying if it can be started or not.
 	IsDisabled() bool
 }