Add database interface for logic engine to allow for use in additional client
@@ -15,7 +15,6 @@ import (
"github.com/manifoldco/torus-cli/registry"
"github.com/manifoldco/torus-cli/daemon/crypto"
- "github.com/manifoldco/torus-cli/daemon/db"
"github.com/manifoldco/torus-cli/daemon/observer"
"github.com/manifoldco/torus-cli/daemon/session"
)
@@ -27,7 +26,7 @@ import (
// logged in user.
type Engine struct {
session session.Session
- db *db.DB
+ db Database
crypto *crypto.Engine
client *registry.Client
@@ -36,8 +35,13 @@ type Engine struct {
Session Session
}
+// Database interface for logic engine
+type Database interface {
+ Set(envs ...envelope.Envelope) error
+}
+
// NewEngine returns a new Engine
-func NewEngine(s session.Session, db *db.DB, e *crypto.Engine,
+func NewEngine(s session.Session, db Database, e *crypto.Engine,
client *registry.Client) *Engine {
engine := &Engine{
session: s,
