VOL-1775 VOL-1779 VOL-1780 : Fix several issues with overall stability

- Apply changes as reported by golang race utility
- Added version attribute in KV object
- Added context object to db/model api
- Carrying timestamp info through context to help in the
  decision making when applying a revision change
- Replaced proxy access control mechanism with etcd reservation mechanism

Change-Id: If3d142a73b1da0d64fa6a819530f297dbfada2d3
diff --git a/db/kvstore/client.go b/db/kvstore/client.go
index 34ab711..937eefe 100644
--- a/db/kvstore/client.go
+++ b/db/kvstore/client.go
@@ -38,6 +38,7 @@
 type KVPair struct {
 	Key     string
 	Value   interface{}
+	Version int64
 	Session string
 	Lease   int64
 }
@@ -47,12 +48,13 @@
 }
 
 // NewKVPair creates a new KVPair object
-func NewKVPair(key string, value interface{}, session string, lease int64) *KVPair {
+func NewKVPair(key string, value interface{}, session string, lease int64, version int64) *KVPair {
 	kv := new(KVPair)
 	kv.Key = key
 	kv.Value = value
 	kv.Session = session
 	kv.Lease = lease
+	kv.Version = version
 	return kv
 }
 
@@ -61,14 +63,16 @@
 	EventType int
 	Key       interface{}
 	Value     interface{}
+	Version   int64
 }
 
 // NewEvent creates a new Event object
-func NewEvent(eventType int, key interface{}, value interface{}) *Event {
+func NewEvent(eventType int, key interface{}, value interface{}, version int64) *Event {
 	evnt := new(Event)
 	evnt.EventType = eventType
 	evnt.Key = key
 	evnt.Value = value
+	evnt.Version = version
 
 	return evnt
 }