From eb6147a50c3c6b5a5f73bb260692a31db7dd8699 Mon Sep 17 00:00:00 2001 From: Eray Arslan Date: Fri, 26 Apr 2024 22:13:44 +0300 Subject: [PATCH] feat: bump go-dcp to v1.1.41 and expose seqNo and revNo --- connector.go | 15 +++++++++++--- couchbase/event.go | 23 ++++++++++++++++++--- example/default-mapper/go.mod | 2 +- example/default-mapper/go.sum | 4 ++-- example/simple-logger/go.mod | 2 +- example/simple-logger/go.sum | 4 ++-- example/simple-sink-response-handler/go.mod | 2 +- example/simple-sink-response-handler/go.sum | 4 ++-- example/simple/go.mod | 2 +- example/simple/go.sum | 4 ++-- example/struct-config/go.mod | 2 +- example/struct-config/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- test/integration/go.mod | 2 +- test/integration/go.sum | 4 ++-- 16 files changed, 53 insertions(+), 27 deletions(-) diff --git a/connector.go b/connector.go index 48bd748..76c7bc8 100644 --- a/connector.go +++ b/connector.go @@ -52,11 +52,20 @@ func (c *connector) listener(ctx *models.ListenerContext) { var e couchbase.Event switch event := ctx.Event.(type) { case models.DcpMutation: - e = couchbase.NewMutateEvent(event.Key, event.Value, event.CollectionName, event.Cas, event.EventTime, event.VbID) + e = couchbase.NewMutateEvent( + event.Key, event.Value, + event.CollectionName, event.Cas, event.EventTime, event.VbID, event.SeqNo, event.RevNo, + ) case models.DcpExpiration: - e = couchbase.NewExpireEvent(event.Key, nil, event.CollectionName, event.Cas, event.EventTime, event.VbID) + e = couchbase.NewExpireEvent( + event.Key, nil, + event.CollectionName, event.Cas, event.EventTime, event.VbID, event.SeqNo, event.RevNo, + ) case models.DcpDeletion: - e = couchbase.NewDeleteEvent(event.Key, nil, event.CollectionName, event.Cas, event.EventTime, event.VbID) + e = couchbase.NewDeleteEvent( + event.Key, nil, + event.CollectionName, event.Cas, event.EventTime, event.VbID, event.SeqNo, event.RevNo, + ) default: return } diff --git a/couchbase/event.go b/couchbase/event.go index 9e8d62f..9851bd9 100644 --- a/couchbase/event.go +++ b/couchbase/event.go @@ -12,9 +12,14 @@ type Event struct { IsDeleted bool IsExpired bool IsMutated bool + SeqNo uint64 + RevNo uint64 } -func NewDeleteEvent(key []byte, value []byte, collectionName string, cas uint64, eventTime time.Time, vbID uint16) Event { +func NewDeleteEvent( + key []byte, value []byte, + collectionName string, cas uint64, eventTime time.Time, vbID uint16, seqNo uint64, revNo uint64, +) Event { return Event{ Key: key, Value: value, @@ -23,10 +28,15 @@ func NewDeleteEvent(key []byte, value []byte, collectionName string, cas uint64, Cas: cas, EventTime: eventTime, VbID: vbID, + SeqNo: seqNo, + RevNo: revNo, } } -func NewExpireEvent(key []byte, value []byte, collectionName string, cas uint64, eventTime time.Time, vbID uint16) Event { +func NewExpireEvent( + key []byte, value []byte, + collectionName string, cas uint64, eventTime time.Time, vbID uint16, seqNo uint64, revNo uint64, +) Event { return Event{ Key: key, Value: value, @@ -35,10 +45,15 @@ func NewExpireEvent(key []byte, value []byte, collectionName string, cas uint64, Cas: cas, EventTime: eventTime, VbID: vbID, + SeqNo: seqNo, + RevNo: revNo, } } -func NewMutateEvent(key []byte, value []byte, collectionName string, cas uint64, eventTime time.Time, vbID uint16) Event { +func NewMutateEvent( + key []byte, value []byte, + collectionName string, cas uint64, eventTime time.Time, vbID uint16, seqNo uint64, revNo uint64, +) Event { return Event{ Key: key, Value: value, @@ -47,5 +62,7 @@ func NewMutateEvent(key []byte, value []byte, collectionName string, cas uint64, Cas: cas, EventTime: eventTime, VbID: vbID, + SeqNo: seqNo, + RevNo: revNo, } } diff --git a/example/default-mapper/go.mod b/example/default-mapper/go.mod index caf3e78..dcde377 100644 --- a/example/default-mapper/go.mod +++ b/example/default-mapper/go.mod @@ -7,7 +7,7 @@ replace github.com/Trendyol/go-dcp-elasticsearch => ./../.. require github.com/Trendyol/go-dcp-elasticsearch v0.0.0 require ( - github.com/Trendyol/go-dcp v1.1.40 // indirect + github.com/Trendyol/go-dcp v1.1.41 // indirect github.com/andybalholm/brotli v1.1.0 // indirect github.com/ansrivas/fiberprometheus/v2 v2.6.1 // indirect github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef // indirect diff --git a/example/default-mapper/go.sum b/example/default-mapper/go.sum index 7c17c4a..329dfa8 100644 --- a/example/default-mapper/go.sum +++ b/example/default-mapper/go.sum @@ -2,8 +2,8 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= -github.com/Trendyol/go-dcp v1.1.40 h1:gjkytvIcOmt3XmUWUu+BFHrdsBcZLnSpxn5K0t8gMEI= -github.com/Trendyol/go-dcp v1.1.40/go.mod h1:d3BOdiI+FKXSnkrwZtnP+vjMjlnRBmiyOsuEX1yrwHg= +github.com/Trendyol/go-dcp v1.1.41 h1:R3oWXhV22mwen79K3VJ+VYMiJz/QVadNQA8u6NOChBs= +github.com/Trendyol/go-dcp v1.1.41/go.mod h1:d3BOdiI+FKXSnkrwZtnP+vjMjlnRBmiyOsuEX1yrwHg= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/ansrivas/fiberprometheus/v2 v2.6.1 h1:wac3pXaE6BYYTF04AC6K0ktk6vCD+MnDOJZ3SK66kXM= diff --git a/example/simple-logger/go.mod b/example/simple-logger/go.mod index 445f0bd..85dccc2 100644 --- a/example/simple-logger/go.mod +++ b/example/simple-logger/go.mod @@ -10,7 +10,7 @@ require ( ) require ( - github.com/Trendyol/go-dcp v1.1.40 // indirect + github.com/Trendyol/go-dcp v1.1.41 // indirect github.com/andybalholm/brotli v1.1.0 // indirect github.com/ansrivas/fiberprometheus/v2 v2.6.1 // indirect github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef // indirect diff --git a/example/simple-logger/go.sum b/example/simple-logger/go.sum index 7c17c4a..329dfa8 100644 --- a/example/simple-logger/go.sum +++ b/example/simple-logger/go.sum @@ -2,8 +2,8 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= -github.com/Trendyol/go-dcp v1.1.40 h1:gjkytvIcOmt3XmUWUu+BFHrdsBcZLnSpxn5K0t8gMEI= -github.com/Trendyol/go-dcp v1.1.40/go.mod h1:d3BOdiI+FKXSnkrwZtnP+vjMjlnRBmiyOsuEX1yrwHg= +github.com/Trendyol/go-dcp v1.1.41 h1:R3oWXhV22mwen79K3VJ+VYMiJz/QVadNQA8u6NOChBs= +github.com/Trendyol/go-dcp v1.1.41/go.mod h1:d3BOdiI+FKXSnkrwZtnP+vjMjlnRBmiyOsuEX1yrwHg= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/ansrivas/fiberprometheus/v2 v2.6.1 h1:wac3pXaE6BYYTF04AC6K0ktk6vCD+MnDOJZ3SK66kXM= diff --git a/example/simple-sink-response-handler/go.mod b/example/simple-sink-response-handler/go.mod index caf3e78..dcde377 100644 --- a/example/simple-sink-response-handler/go.mod +++ b/example/simple-sink-response-handler/go.mod @@ -7,7 +7,7 @@ replace github.com/Trendyol/go-dcp-elasticsearch => ./../.. require github.com/Trendyol/go-dcp-elasticsearch v0.0.0 require ( - github.com/Trendyol/go-dcp v1.1.40 // indirect + github.com/Trendyol/go-dcp v1.1.41 // indirect github.com/andybalholm/brotli v1.1.0 // indirect github.com/ansrivas/fiberprometheus/v2 v2.6.1 // indirect github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef // indirect diff --git a/example/simple-sink-response-handler/go.sum b/example/simple-sink-response-handler/go.sum index 7c17c4a..329dfa8 100644 --- a/example/simple-sink-response-handler/go.sum +++ b/example/simple-sink-response-handler/go.sum @@ -2,8 +2,8 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= -github.com/Trendyol/go-dcp v1.1.40 h1:gjkytvIcOmt3XmUWUu+BFHrdsBcZLnSpxn5K0t8gMEI= -github.com/Trendyol/go-dcp v1.1.40/go.mod h1:d3BOdiI+FKXSnkrwZtnP+vjMjlnRBmiyOsuEX1yrwHg= +github.com/Trendyol/go-dcp v1.1.41 h1:R3oWXhV22mwen79K3VJ+VYMiJz/QVadNQA8u6NOChBs= +github.com/Trendyol/go-dcp v1.1.41/go.mod h1:d3BOdiI+FKXSnkrwZtnP+vjMjlnRBmiyOsuEX1yrwHg= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/ansrivas/fiberprometheus/v2 v2.6.1 h1:wac3pXaE6BYYTF04AC6K0ktk6vCD+MnDOJZ3SK66kXM= diff --git a/example/simple/go.mod b/example/simple/go.mod index caf3e78..dcde377 100644 --- a/example/simple/go.mod +++ b/example/simple/go.mod @@ -7,7 +7,7 @@ replace github.com/Trendyol/go-dcp-elasticsearch => ./../.. require github.com/Trendyol/go-dcp-elasticsearch v0.0.0 require ( - github.com/Trendyol/go-dcp v1.1.40 // indirect + github.com/Trendyol/go-dcp v1.1.41 // indirect github.com/andybalholm/brotli v1.1.0 // indirect github.com/ansrivas/fiberprometheus/v2 v2.6.1 // indirect github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef // indirect diff --git a/example/simple/go.sum b/example/simple/go.sum index 7c17c4a..329dfa8 100644 --- a/example/simple/go.sum +++ b/example/simple/go.sum @@ -2,8 +2,8 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= -github.com/Trendyol/go-dcp v1.1.40 h1:gjkytvIcOmt3XmUWUu+BFHrdsBcZLnSpxn5K0t8gMEI= -github.com/Trendyol/go-dcp v1.1.40/go.mod h1:d3BOdiI+FKXSnkrwZtnP+vjMjlnRBmiyOsuEX1yrwHg= +github.com/Trendyol/go-dcp v1.1.41 h1:R3oWXhV22mwen79K3VJ+VYMiJz/QVadNQA8u6NOChBs= +github.com/Trendyol/go-dcp v1.1.41/go.mod h1:d3BOdiI+FKXSnkrwZtnP+vjMjlnRBmiyOsuEX1yrwHg= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/ansrivas/fiberprometheus/v2 v2.6.1 h1:wac3pXaE6BYYTF04AC6K0ktk6vCD+MnDOJZ3SK66kXM= diff --git a/example/struct-config/go.mod b/example/struct-config/go.mod index 5a0916c..07e268b 100644 --- a/example/struct-config/go.mod +++ b/example/struct-config/go.mod @@ -5,7 +5,7 @@ go 1.20 replace github.com/Trendyol/go-dcp-elasticsearch => ./../.. require ( - github.com/Trendyol/go-dcp v1.1.40 + github.com/Trendyol/go-dcp v1.1.41 github.com/Trendyol/go-dcp-elasticsearch v0.0.0 ) diff --git a/example/struct-config/go.sum b/example/struct-config/go.sum index 7c17c4a..329dfa8 100644 --- a/example/struct-config/go.sum +++ b/example/struct-config/go.sum @@ -2,8 +2,8 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= -github.com/Trendyol/go-dcp v1.1.40 h1:gjkytvIcOmt3XmUWUu+BFHrdsBcZLnSpxn5K0t8gMEI= -github.com/Trendyol/go-dcp v1.1.40/go.mod h1:d3BOdiI+FKXSnkrwZtnP+vjMjlnRBmiyOsuEX1yrwHg= +github.com/Trendyol/go-dcp v1.1.41 h1:R3oWXhV22mwen79K3VJ+VYMiJz/QVadNQA8u6NOChBs= +github.com/Trendyol/go-dcp v1.1.41/go.mod h1:d3BOdiI+FKXSnkrwZtnP+vjMjlnRBmiyOsuEX1yrwHg= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/ansrivas/fiberprometheus/v2 v2.6.1 h1:wac3pXaE6BYYTF04AC6K0ktk6vCD+MnDOJZ3SK66kXM= diff --git a/go.mod b/go.mod index fa94c28..ce1e318 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/Trendyol/go-dcp-elasticsearch go 1.20 require ( - github.com/Trendyol/go-dcp v1.1.40 + github.com/Trendyol/go-dcp v1.1.41 github.com/elastic/go-elasticsearch/v7 v7.17.10 github.com/json-iterator/go v1.1.12 github.com/prometheus/client_golang v1.19.0 diff --git a/go.sum b/go.sum index 7c17c4a..329dfa8 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= -github.com/Trendyol/go-dcp v1.1.40 h1:gjkytvIcOmt3XmUWUu+BFHrdsBcZLnSpxn5K0t8gMEI= -github.com/Trendyol/go-dcp v1.1.40/go.mod h1:d3BOdiI+FKXSnkrwZtnP+vjMjlnRBmiyOsuEX1yrwHg= +github.com/Trendyol/go-dcp v1.1.41 h1:R3oWXhV22mwen79K3VJ+VYMiJz/QVadNQA8u6NOChBs= +github.com/Trendyol/go-dcp v1.1.41/go.mod h1:d3BOdiI+FKXSnkrwZtnP+vjMjlnRBmiyOsuEX1yrwHg= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/ansrivas/fiberprometheus/v2 v2.6.1 h1:wac3pXaE6BYYTF04AC6K0ktk6vCD+MnDOJZ3SK66kXM= diff --git a/test/integration/go.mod b/test/integration/go.mod index 6f6fee7..0f71cd3 100644 --- a/test/integration/go.mod +++ b/test/integration/go.mod @@ -11,7 +11,7 @@ require ( ) require ( - github.com/Trendyol/go-dcp v1.1.40 // indirect + github.com/Trendyol/go-dcp v1.1.41 // indirect github.com/andybalholm/brotli v1.1.0 // indirect github.com/ansrivas/fiberprometheus/v2 v2.6.1 // indirect github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef // indirect diff --git a/test/integration/go.sum b/test/integration/go.sum index 7c17c4a..329dfa8 100644 --- a/test/integration/go.sum +++ b/test/integration/go.sum @@ -2,8 +2,8 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= -github.com/Trendyol/go-dcp v1.1.40 h1:gjkytvIcOmt3XmUWUu+BFHrdsBcZLnSpxn5K0t8gMEI= -github.com/Trendyol/go-dcp v1.1.40/go.mod h1:d3BOdiI+FKXSnkrwZtnP+vjMjlnRBmiyOsuEX1yrwHg= +github.com/Trendyol/go-dcp v1.1.41 h1:R3oWXhV22mwen79K3VJ+VYMiJz/QVadNQA8u6NOChBs= +github.com/Trendyol/go-dcp v1.1.41/go.mod h1:d3BOdiI+FKXSnkrwZtnP+vjMjlnRBmiyOsuEX1yrwHg= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/ansrivas/fiberprometheus/v2 v2.6.1 h1:wac3pXaE6BYYTF04AC6K0ktk6vCD+MnDOJZ3SK66kXM=