Forráskód Böngészése

Document Registry interface.

Alexey Palazhchenko 12 éve
szülő
commit
ed823af700
1 módosított fájl, 12 hozzáadás és 0 törlés
  1. 12 0
      registry.go

+ 12 - 0
registry.go

@@ -8,10 +8,19 @@ import "sync"
 // This is an interface so as to encourage other structs to implement
 // the Registry API as appropriate.
 type Registry interface {
+	// Call the given function for each registered metric.
 	Each(func(string, interface{}))
+
+	// Get the metric by the given name or nil if none is registered.
 	Get(string) interface{}
+
+	// Register the given metric under the given name.
 	Register(string, interface{})
+
+	// Run all registered healthchecks.
 	RunHealthchecks()
+
+	// Unregister the metric with the given name.
 	Unregister(string)
 }
 
@@ -22,6 +31,9 @@ type StandardRegistry struct {
 	metrics map[string]interface{}
 }
 
+// Check interface.
+var _ Registry = &StandardRegistry{}
+
 // Create a new registry.
 func NewRegistry() *StandardRegistry {
 	return &StandardRegistry{