Enable Grafana extensions at build time. (#11752)

* extensions: import and build

* bus: use predefined error

* enterprise: build script for enterprise packages

* poc: auto registering services and dependency injection

(cherry picked from commit b5b1ef875f905473af41e49f8071cb9028edc845)

* poc: backend services registry progress

(cherry picked from commit 97be69725881241bfbf1e7adf0e66801d6b0af3d)

* poc: minor update

(cherry picked from commit 03d7a6888b81403f458b94305792e075568f0794)

* ioc: introduce manuel ioc

* enterprise: adds setting for enterprise

* build: test and build specific ee commit

* cleanup: test testing code

* removes example hello service
This commit is contained in:
Carl Bergquist
2018-04-27 13:41:58 +02:00
committed by Torkel Ödegaard
parent afce0feb05
commit 28f7b6dad1
30 changed files with 1678 additions and 105 deletions
+10 -3
View File
@@ -2,7 +2,7 @@ package bus
import (
"context"
"fmt"
"errors"
"reflect"
)
@@ -10,6 +10,8 @@ type HandlerFunc interface{}
type CtxHandlerFunc func()
type Msg interface{}
var ErrHandlerNotFound = errors.New("handler not found")
type Bus interface {
Dispatch(msg Msg) error
DispatchCtx(ctx context.Context, msg Msg) error
@@ -38,12 +40,17 @@ func New() Bus {
return bus
}
// Want to get rid of global bus
func GetBus() Bus {
return globalBus
}
func (b *InProcBus) DispatchCtx(ctx context.Context, msg Msg) error {
var msgName = reflect.TypeOf(msg).Elem().Name()
var handler = b.handlers[msgName]
if handler == nil {
return fmt.Errorf("handler not found for %s", msgName)
return ErrHandlerNotFound
}
var params = make([]reflect.Value, 2)
@@ -64,7 +71,7 @@ func (b *InProcBus) Dispatch(msg Msg) error {
var handler = b.handlers[msgName]
if handler == nil {
return fmt.Errorf("handler not found for %s", msgName)
return ErrHandlerNotFound
}
var params = make([]reflect.Value, 1)