Skip to content

Conversation

@torcolvin
Copy link
Collaborator

@torcolvin torcolvin commented Dec 2, 2025

CBG-5013 move gocb dcp client to separate file to prep for DCPClient becoming an interface

  • Rename dcp_client.go to gocb_dcp_client.go
  • Rename DCPClient to GocbDCPClient

Integration Tests

Copilot AI review requested due to automatic review settings December 2, 2025 16:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR renames the DCPClient struct to GoCBDCPClient and moves it to a dedicated file (gocb_dcp_client.go) in preparation for making DCPClient an interface. The changes are purely structural - no functional behavior is modified.

Key changes:

  • Renamed base/dcp_client.go to base/gocb_dcp_client.go
  • Renamed all occurrences of DCPClient type to GoCBDCPClient
  • Updated all method receivers and return types accordingly

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
base/gocb_dcp_client.go Renamed struct DCPClient to GoCBDCPClient, updated all method receivers and function signatures
base/dcp_client_test.go Updated test helper method receiver and variable type declarations to use GoCBDCPClient
base/dcp_client_stream_observer.go Updated all stream observer method receivers from DCPClient to GoCBDCPClient
tools/cache_perf_tool/dcpDataGeneration.go Updated variable and function signatures to use GoCBDCPClient instead of DCPClient

var ErrVbUUIDMismatch = errors.New("VbUUID mismatch when failOnRollback set")

type DCPClient struct {
type GoCBDCPClient struct {
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The struct name has inconsistent casing: 'GoCB' should be 'Gocb' to follow Go naming conventions (GocbDCPClient).

Suggested change
type GoCBDCPClient struct {
type GocbDCPClient struct {

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We aren't consistent with GoCB and Gocb. Most things use GoCB except GocbV2Bucket.


// NewDCPClientForTest is a test-only function to create a DCP client with a specific number of vbuckets.
func NewDCPClientForTest(ctx context.Context, t *testing.T, ID string, callback sgbucket.FeedEventCallbackFunc, options DCPClientOptions, bucket *GocbV2Bucket, numVbuckets uint16) (*DCPClient, error) {
func NewDCPClientForTest(ctx context.Context, t *testing.T, ID string, callback sgbucket.FeedEventCallbackFunc, options DCPClientOptions, bucket *GocbV2Bucket, numVbuckets uint16) (*GoCBDCPClient, error) {
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function name 'NewDCPClientForTest' no longer matches the struct type 'GoCBDCPClient'. Consider renaming to 'NewGoCBDCPClientForTest' for consistency.

Copilot uses AI. Check for mistakes.
}

func createDCPClient(t *testing.T, ctx context.Context, bucket *base.GocbV2Bucket, callback sgbucket.FeedEventCallbackFunc, dbStats *expvar.Map, numWorkers, numVBuckets int) (*base.DCPClient, error) {
func createDCPClient(t *testing.T, ctx context.Context, bucket *base.GocbV2Bucket, callback sgbucket.FeedEventCallbackFunc, dbStats *expvar.Map, numWorkers, numVBuckets int) (*base.GoCBDCPClient, error) {
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function name 'createDCPClient' no longer matches the struct type 'GoCBDCPClient'. Consider renaming to 'createGoCBDCPClient' for consistency.

Suggested change
func createDCPClient(t *testing.T, ctx context.Context, bucket *base.GocbV2Bucket, callback sgbucket.FeedEventCallbackFunc, dbStats *expvar.Map, numWorkers, numVBuckets int) (*base.GoCBDCPClient, error) {
func createGoCBDCPClient(t *testing.T, ctx context.Context, bucket *base.GocbV2Bucket, callback sgbucket.FeedEventCallbackFunc, dbStats *expvar.Map, numWorkers, numVBuckets int) (*base.GoCBDCPClient, error) {

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't rename this because it is a test tool.

@torcolvin torcolvin merged commit a9f6471 into main Dec 3, 2025
42 checks passed
@torcolvin torcolvin deleted the CBG-5013-rename-only branch December 3, 2025 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants