VOL-1175: Added proxy CRUD for new data model
Change-Id: Ie218a2567746d87a951f23aa6b774b2f01541cf9
diff --git a/db/model/proxy.go b/db/model/proxy.go
index 82ab113..8085eaf 100644
--- a/db/model/proxy.go
+++ b/db/model/proxy.go
@@ -21,6 +21,28 @@
"strings"
)
+type OperationContext struct {
+ Path string
+ Data interface{}
+ FieldName string
+ ChildKey string
+}
+
+func NewOperationContext(path string, data interface{}, fieldName string, childKey string) *OperationContext {
+ oc := &OperationContext{
+ Path: path,
+ Data: data,
+ FieldName: fieldName,
+ ChildKey: childKey,
+ }
+ return oc
+}
+
+func (oc *OperationContext) Update(data interface{}) *OperationContext {
+ oc.Data = data
+ return oc
+}
+
type Proxy struct {
Root *Root
Node *Node
@@ -87,16 +109,16 @@
}
func (p *Proxy) openTransaction() *Transaction {
- txid := p.Root.makeTxBranch()
+ txid := p.Root.MakeTxBranch()
return NewTransaction(p, txid)
}
func (p *Proxy) commitTransaction(txid string) {
- p.Root.foldTxBranch(txid)
+ p.Root.FoldTxBranch(txid)
}
func (p *Proxy) cancelTransaction(txid string) {
- p.Root.deleteTxBranch(txid)
+ p.Root.DeleteTxBranch(txid)
}
func (p *Proxy) RegisterCallback(callbackType CallbackType, callback func(), args ...interface{}) {