Skip to content

Commit

Permalink
fix: rename replication fields for better clarity (#24126)
Browse files Browse the repository at this point in the history
* fix: rename replication fields for better clarity

* fix: dont rename, only add new field
  • Loading branch information
jeffreyssmith2nd committed Mar 9, 2023
1 parent 77fd64a commit b819edf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
30 changes: 15 additions & 15 deletions replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ var ErrMaxQueueSizeTooSmall = errors.Error{

// Replication contains all info about a replication that should be returned to users.
type Replication struct {
ID platform.ID `json:"id" db:"id"`
OrgID platform.ID `json:"orgID" db:"org_id"`
Name string `json:"name" db:"name"`
Description *string `json:"description,omitempty" db:"description"`
RemoteID platform.ID `json:"remoteID" db:"remote_id"`
LocalBucketID platform.ID `json:"localBucketID" db:"local_bucket_id"`
RemoteBucketID *platform.ID `json:"remoteBucketID" db:"remote_bucket_id"`
RemoteBucketName string `json:"RemoteBucketName" db:"remote_bucket_name"`
MaxQueueSizeBytes int64 `json:"maxQueueSizeBytes" db:"max_queue_size_bytes"`
CurrentQueueSizeBytes int64 `json:"currentQueueSizeBytes" db:"current_queue_size_bytes"`
RemainingQueueSizeBytes int64 `json:"remainingQueueSizeBytes" db:"remaining_queue_size_bytes"`
LatestResponseCode *int32 `json:"latestResponseCode,omitempty" db:"latest_response_code"`
LatestErrorMessage *string `json:"latestErrorMessage,omitempty" db:"latest_error_message"`
DropNonRetryableData bool `json:"dropNonRetryableData" db:"drop_non_retryable_data"`
MaxAgeSeconds int64 `json:"maxAgeSeconds" db:"max_age_seconds"`
ID platform.ID `json:"id" db:"id"`
OrgID platform.ID `json:"orgID" db:"org_id"`
Name string `json:"name" db:"name"`
Description *string `json:"description,omitempty" db:"description"`
RemoteID platform.ID `json:"remoteID" db:"remote_id"`
LocalBucketID platform.ID `json:"localBucketID" db:"local_bucket_id"`
RemoteBucketID *platform.ID `json:"remoteBucketID" db:"remote_bucket_id"`
RemoteBucketName string `json:"RemoteBucketName" db:"remote_bucket_name"`
MaxQueueSizeBytes int64 `json:"maxQueueSizeBytes" db:"max_queue_size_bytes"`
CurrentQueueSizeBytes int64 `json:"currentQueueSizeBytes"`
RemainingBytesToBeSynced int64 `json:"remainingBytesToBeSynced"`
LatestResponseCode *int32 `json:"latestResponseCode,omitempty" db:"latest_response_code"`
LatestErrorMessage *string `json:"latestErrorMessage,omitempty" db:"latest_error_message"`
DropNonRetryableData bool `json:"dropNonRetryableData" db:"drop_non_retryable_data"`
MaxAgeSeconds int64 `json:"maxAgeSeconds" db:"max_age_seconds"`
}

// ReplicationListFilter is a selection filter for listing replications.
Expand Down
6 changes: 3 additions & 3 deletions replications/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (s *service) ListReplications(ctx context.Context, filter influxdb.Replicat
return nil, err
}
for i := range rs.Replications {
rs.Replications[i].RemainingQueueSizeBytes = rsizes[rs.Replications[i].ID]
rs.Replications[i].RemainingBytesToBeSynced = rsizes[rs.Replications[i].ID]
}

return rs, nil
Expand Down Expand Up @@ -208,7 +208,7 @@ func (s *service) GetReplication(ctx context.Context, id platform.ID) (*influxdb
if err != nil {
return nil, err
}
r.RemainingQueueSizeBytes = rsizes[r.ID]
r.RemainingBytesToBeSynced = rsizes[r.ID]

return r, nil
}
Expand Down Expand Up @@ -238,7 +238,7 @@ func (s *service) UpdateReplication(ctx context.Context, id platform.ID, request
if err != nil {
return nil, err
}
r.RemainingQueueSizeBytes = rsizes[r.ID]
r.RemainingBytesToBeSynced = rsizes[r.ID]

return r, nil
}
Expand Down
4 changes: 2 additions & 2 deletions replications/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func TestListReplications(t *testing.T) {

for _, r := range got.Replications {
require.Equal(t, tt.sizes[r.ID], r.CurrentQueueSizeBytes)
require.Equal(t, tt.rsizes[r.ID], r.RemainingQueueSizeBytes)
require.Equal(t, tt.rsizes[r.ID], r.RemainingBytesToBeSynced)
}
})
}
Expand Down Expand Up @@ -394,7 +394,7 @@ func TestGetReplication(t *testing.T) {
}

require.Equal(t, tt.sizes[got.ID], got.CurrentQueueSizeBytes)
require.Equal(t, tt.rsizes[got.ID], got.RemainingQueueSizeBytes)
require.Equal(t, tt.rsizes[got.ID], got.RemainingBytesToBeSynced)

})
}
Expand Down

0 comments on commit b819edf

Please sign in to comment.