yeast/impl/impl.go

26 lines
374 B
Go
Raw Normal View History

2015-02-11 01:23:58 +07:00
package impl
type (
Impl struct {
2015-02-11 19:33:46 +07:00
name string
actor func([]byte) ([]byte, error)
2015-02-11 01:23:58 +07:00
}
)
2015-02-11 19:33:46 +07:00
func New(name, impl string) *Impl {
switch impl {
2015-02-11 01:23:58 +07:00
case "units.throttler.Throttler":
2015-02-11 19:33:46 +07:00
return Throttler(name)
2015-02-11 01:23:58 +07:00
default:
return nil
}
}
func (i *Impl) Call(data []byte) (resp []byte, err error) {
return i.actor(data)
}
func (i *Impl) Units() []string {
return []string{}
}