This commit is contained in:
parent
c53942ac53
commit
d09b763aa7
24 changed files with 941 additions and 17 deletions
|
@ -2,8 +2,18 @@ package model
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CacheInterface defines the cache interface available to plugins
|
||||
type CacheInterface interface {
|
||||
Get(key string, destination interface{}) error
|
||||
Set(key string, value interface{}, expiration *time.Time) error
|
||||
SetWithTTL(key string, value interface{}, ttl time.Duration) error
|
||||
Delete(key string) error
|
||||
Exists(key string) (bool, error)
|
||||
}
|
||||
|
||||
var (
|
||||
// ErrPluginNotFound is returned when a requested plugin doesn't exist
|
||||
ErrPluginNotFound = errors.New("plugin not found")
|
||||
|
@ -24,5 +34,5 @@ type Plugin interface {
|
|||
RequiresConfig() bool
|
||||
|
||||
// OnMessage processes an incoming message and returns platform actions
|
||||
OnMessage(msg *Message, config map[string]interface{}) []*MessageAction
|
||||
OnMessage(msg *Message, config map[string]interface{}, cache CacheInterface) []*MessageAction
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue