Skip to content

Commit

Permalink
feat: bump go-dcp to v1.1.41 and expose seqNo and revNo
Browse files Browse the repository at this point in the history
  • Loading branch information
erayarslan committed Apr 26, 2024
1 parent 2bbc8c0 commit d38e0e4
Show file tree
Hide file tree
Showing 14 changed files with 50 additions and 24 deletions.
15 changes: 12 additions & 3 deletions connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,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.EventTime, event.Cas, event.VbID)
e = couchbase.NewMutateEvent(
event.Key, event.Value,
event.CollectionName, event.EventTime, event.Cas, event.VbID, event.SeqNo, event.RevNo,
)
case models.DcpExpiration:
e = couchbase.NewExpireEvent(event.Key, nil, event.CollectionName, event.EventTime, event.Cas, event.VbID)
e = couchbase.NewExpireEvent(
event.Key, nil,
event.CollectionName, event.EventTime, event.Cas, event.VbID, event.SeqNo, event.RevNo,
)
case models.DcpDeletion:
e = couchbase.NewDeleteEvent(event.Key, nil, event.CollectionName, event.EventTime, event.Cas, event.VbID)
e = couchbase.NewDeleteEvent(
event.Key, nil,
event.CollectionName, event.EventTime, event.Cas, event.VbID, event.SeqNo, event.RevNo,
)
default:
return
}
Expand Down
23 changes: 20 additions & 3 deletions couchbase/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, eventTime time.Time, cas uint64, vbID uint16) Event {
func NewDeleteEvent(
key []byte, value []byte,
collectionName string, eventTime time.Time, cas uint64, vbID uint16, seqNo uint64, revNo uint64,
) Event {
return Event{
Key: key,
Value: value,
Expand All @@ -23,10 +28,15 @@ func NewDeleteEvent(key []byte, value []byte, collectionName string, eventTime t
EventTime: eventTime,
Cas: cas,
VbID: vbID,
RevNo: revNo,
SeqNo: seqNo,
}
}

func NewExpireEvent(key []byte, value []byte, collectionName string, eventTime time.Time, cas uint64, vbID uint16) Event {
func NewExpireEvent(
key []byte, value []byte,
collectionName string, eventTime time.Time, cas uint64, vbID uint16, seqNo uint64, revNo uint64,
) Event {
return Event{
Key: key,
Value: value,
Expand All @@ -35,10 +45,15 @@ func NewExpireEvent(key []byte, value []byte, collectionName string, eventTime t
EventTime: eventTime,
Cas: cas,
VbID: vbID,
RevNo: revNo,
SeqNo: seqNo,
}
}

func NewMutateEvent(key []byte, value []byte, collectionName string, eventTime time.Time, cas uint64, vbID uint16) Event {
func NewMutateEvent(
key []byte, value []byte,
collectionName string, eventTime time.Time, cas uint64, vbID uint16, seqNo uint64, revNo uint64,
) Event {
return Event{
Key: key,
Value: value,
Expand All @@ -47,5 +62,7 @@ func NewMutateEvent(key []byte, value []byte, collectionName string, eventTime t
EventTime: eventTime,
Cas: cas,
VbID: vbID,
RevNo: revNo,
SeqNo: seqNo,
}
}
2 changes: 1 addition & 1 deletion example/default-mapper/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ replace github.com/Trendyol/go-dcp-couchbase => ./../..
require github.com/Trendyol/go-dcp-couchbase v1.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
Expand Down
4 changes: 2 additions & 2 deletions example/default-mapper/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion example/simple-logger/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions example/simple-logger/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion example/simple/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ replace github.com/Trendyol/go-dcp-couchbase => ./../..
require github.com/Trendyol/go-dcp-couchbase v1.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
Expand Down
4 changes: 2 additions & 2 deletions example/simple/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion example/struct-config/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.20
replace github.com/Trendyol/go-dcp-couchbase => ./../..

require (
github.com/Trendyol/go-dcp v1.1.40
github.com/Trendyol/go-dcp v1.1.41
github.com/Trendyol/go-dcp-couchbase v1.0.0
)

Expand Down
4 changes: 2 additions & 2 deletions example/struct-config/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ retract (
)

require (
github.com/Trendyol/go-dcp v1.1.40
github.com/Trendyol/go-dcp v1.1.41
github.com/couchbase/gocbcore/v10 v10.4.0
github.com/prometheus/client_golang v1.19.0
github.com/sirupsen/logrus v1.9.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion test/integration/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.20
replace github.com/Trendyol/go-dcp-couchbase => ../../.

require (
github.com/Trendyol/go-dcp v1.1.40
github.com/Trendyol/go-dcp v1.1.41
github.com/Trendyol/go-dcp-couchbase v0.0.0-00010101000000-000000000000
)

Expand Down
4 changes: 2 additions & 2 deletions test/integration/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit d38e0e4

Please sign in to comment.