|
@@ -45,7 +45,7 @@ func (e *Event) Index() uint64 {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Converts an event object into a response object.
|
|
// Converts an event object into a response object.
|
|
|
-func (event *Event) Response() interface{} {
|
|
|
|
|
|
|
+func (event *Event) Response(currentIndex uint64) interface{} {
|
|
|
if !event.Node.Dir {
|
|
if !event.Node.Dir {
|
|
|
response := &Response{
|
|
response := &Response{
|
|
|
Action: event.Action,
|
|
Action: event.Action,
|
|
@@ -57,6 +57,10 @@ func (event *Event) Response() interface{} {
|
|
|
Expiration: event.Node.Expiration,
|
|
Expiration: event.Node.Expiration,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if currentIndex != 0 {
|
|
|
|
|
+ response.Index = currentIndex
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if response.Action == Set {
|
|
if response.Action == Set {
|
|
|
if response.PrevValue == "" {
|
|
if response.PrevValue == "" {
|
|
|
response.NewKey = true
|
|
response.NewKey = true
|
|
@@ -79,6 +83,10 @@ func (event *Event) Response() interface{} {
|
|
|
Dir: node.Dir,
|
|
Dir: node.Dir,
|
|
|
Index: node.ModifiedIndex,
|
|
Index: node.ModifiedIndex,
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if currentIndex != 0 {
|
|
|
|
|
+ responses[i].Index = currentIndex
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return responses
|
|
return responses
|
|
|
}
|
|
}
|