VOL-1027 : Initial commit of voltha 2.0 data model

Change-Id: Ib8006de1af2166281ccf1c9d7c2b9156991bf4e4
diff --git a/db/model/transaction.go b/db/model/transaction.go
new file mode 100644
index 0000000..b7288ab
--- /dev/null
+++ b/db/model/transaction.go
@@ -0,0 +1,53 @@
+package model
+
+import "fmt"
+
+type Transaction struct {
+	proxy *Proxy
+	txid  string
+}
+
+func NewTransaction(proxy *Proxy, txid string) *Transaction {
+	tx := &Transaction{
+		proxy: proxy,
+		txid:  txid,
+	}
+	return tx
+}
+func (t *Transaction) Get(path string, depth int, deep bool) *Revision {
+	if t.txid == "" {
+		fmt.Errorf("closed transaction")
+		return nil
+	}
+	// TODO: need to review the return values at the different layers!!!!!
+	return t.proxy.Get(path, depth, deep, t.txid).(*Revision)
+}
+func (t *Transaction) Update(path string, data interface{}, strict bool) *Revision {
+	if t.txid == "" {
+		fmt.Errorf("closed transaction")
+		return nil
+	}
+	return t.proxy.Update(path, data, strict, t.txid).(*Revision)
+}
+func (t *Transaction) Add(path string, data interface{}) *Revision {
+	if t.txid == "" {
+		fmt.Errorf("closed transaction")
+		return nil
+	}
+	return t.proxy.Add(path, data, t.txid).(*Revision)
+}
+func (t *Transaction) Remove(path string) *Revision {
+	if t.txid == "" {
+		fmt.Errorf("closed transaction")
+		return nil
+	}
+	return t.proxy.Remove(path, t.txid).(*Revision)
+}
+func (t *Transaction) Cancel() {
+	t.proxy.cancelTransaction(t.txid)
+	t.txid = ""
+}
+func (t *Transaction) Commit() {
+	t.proxy.commitTransaction(t.txid)
+	t.txid = ""
+}