fix: rename replication fields for better clarity (#24126)
* fix: rename replication fields for better clarity * fix: dont rename, only add new fieldpull/24135/head
parent
77fd64a975
commit
b819edf095
|
@ -20,21 +20,21 @@ var ErrMaxQueueSizeTooSmall = errors.Error{
|
||||||
|
|
||||||
// Replication contains all info about a replication that should be returned to users.
|
// Replication contains all info about a replication that should be returned to users.
|
||||||
type Replication struct {
|
type Replication struct {
|
||||||
ID platform.ID `json:"id" db:"id"`
|
ID platform.ID `json:"id" db:"id"`
|
||||||
OrgID platform.ID `json:"orgID" db:"org_id"`
|
OrgID platform.ID `json:"orgID" db:"org_id"`
|
||||||
Name string `json:"name" db:"name"`
|
Name string `json:"name" db:"name"`
|
||||||
Description *string `json:"description,omitempty" db:"description"`
|
Description *string `json:"description,omitempty" db:"description"`
|
||||||
RemoteID platform.ID `json:"remoteID" db:"remote_id"`
|
RemoteID platform.ID `json:"remoteID" db:"remote_id"`
|
||||||
LocalBucketID platform.ID `json:"localBucketID" db:"local_bucket_id"`
|
LocalBucketID platform.ID `json:"localBucketID" db:"local_bucket_id"`
|
||||||
RemoteBucketID *platform.ID `json:"remoteBucketID" db:"remote_bucket_id"`
|
RemoteBucketID *platform.ID `json:"remoteBucketID" db:"remote_bucket_id"`
|
||||||
RemoteBucketName string `json:"RemoteBucketName" db:"remote_bucket_name"`
|
RemoteBucketName string `json:"RemoteBucketName" db:"remote_bucket_name"`
|
||||||
MaxQueueSizeBytes int64 `json:"maxQueueSizeBytes" db:"max_queue_size_bytes"`
|
MaxQueueSizeBytes int64 `json:"maxQueueSizeBytes" db:"max_queue_size_bytes"`
|
||||||
CurrentQueueSizeBytes int64 `json:"currentQueueSizeBytes" db:"current_queue_size_bytes"`
|
CurrentQueueSizeBytes int64 `json:"currentQueueSizeBytes"`
|
||||||
RemainingQueueSizeBytes int64 `json:"remainingQueueSizeBytes" db:"remaining_queue_size_bytes"`
|
RemainingBytesToBeSynced int64 `json:"remainingBytesToBeSynced"`
|
||||||
LatestResponseCode *int32 `json:"latestResponseCode,omitempty" db:"latest_response_code"`
|
LatestResponseCode *int32 `json:"latestResponseCode,omitempty" db:"latest_response_code"`
|
||||||
LatestErrorMessage *string `json:"latestErrorMessage,omitempty" db:"latest_error_message"`
|
LatestErrorMessage *string `json:"latestErrorMessage,omitempty" db:"latest_error_message"`
|
||||||
DropNonRetryableData bool `json:"dropNonRetryableData" db:"drop_non_retryable_data"`
|
DropNonRetryableData bool `json:"dropNonRetryableData" db:"drop_non_retryable_data"`
|
||||||
MaxAgeSeconds int64 `json:"maxAgeSeconds" db:"max_age_seconds"`
|
MaxAgeSeconds int64 `json:"maxAgeSeconds" db:"max_age_seconds"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReplicationListFilter is a selection filter for listing replications.
|
// ReplicationListFilter is a selection filter for listing replications.
|
||||||
|
|
|
@ -135,7 +135,7 @@ func (s *service) ListReplications(ctx context.Context, filter influxdb.Replicat
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
for i := range rs.Replications {
|
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
|
return rs, nil
|
||||||
|
@ -208,7 +208,7 @@ func (s *service) GetReplication(ctx context.Context, id platform.ID) (*influxdb
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
r.RemainingQueueSizeBytes = rsizes[r.ID]
|
r.RemainingBytesToBeSynced = rsizes[r.ID]
|
||||||
|
|
||||||
return r, nil
|
return r, nil
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ func (s *service) UpdateReplication(ctx context.Context, id platform.ID, request
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
r.RemainingQueueSizeBytes = rsizes[r.ID]
|
r.RemainingBytesToBeSynced = rsizes[r.ID]
|
||||||
|
|
||||||
return r, nil
|
return r, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@ func TestListReplications(t *testing.T) {
|
||||||
|
|
||||||
for _, r := range got.Replications {
|
for _, r := range got.Replications {
|
||||||
require.Equal(t, tt.sizes[r.ID], r.CurrentQueueSizeBytes)
|
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)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -394,7 +394,7 @@ func TestGetReplication(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
require.Equal(t, tt.sizes[got.ID], got.CurrentQueueSizeBytes)
|
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)
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue