Keep actor private
Also this: core/units.go:21: impl.Impl.Call is a field, not a method
This commit is contained in:
parent
26224fd975
commit
8748c22d6e
|
@ -4,7 +4,7 @@ package impl
|
||||||
// Comes handy when you need to mock a unit
|
// Comes handy when you need to mock a unit
|
||||||
func Echo() *Impl {
|
func Echo() *Impl {
|
||||||
return &Impl{
|
return &Impl{
|
||||||
Call: func(data []byte) (resp []byte, err error) {
|
actor: func(data []byte) (resp []byte, err error) {
|
||||||
return data, nil
|
return data, nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
14
impl/impl.go
14
impl/impl.go
|
@ -2,14 +2,10 @@ package impl
|
||||||
|
|
||||||
type (
|
type (
|
||||||
Impl struct {
|
Impl struct {
|
||||||
Call func([]byte) ([]byte, error)
|
actor func([]byte) ([]byte, error)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (i *Impl) Units() []string {
|
|
||||||
return []string{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func New(name string) *Impl {
|
func New(name string) *Impl {
|
||||||
switch name {
|
switch name {
|
||||||
case "units.throttler.Throttler":
|
case "units.throttler.Throttler":
|
||||||
|
@ -18,3 +14,11 @@ func New(name string) *Impl {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (i *Impl) Call(data []byte) (resp []byte, err error) {
|
||||||
|
return i.actor(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *Impl) Units() []string {
|
||||||
|
return []string{}
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package impl
|
||||||
|
|
||||||
func Throttler() *Impl {
|
func Throttler() *Impl {
|
||||||
return &Impl{
|
return &Impl{
|
||||||
Call: func(data []byte) (resp []byte, err error) {
|
actor: func(data []byte) (resp []byte, err error) {
|
||||||
return data, nil
|
return data, nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue