Skip to content

Commit 88ba346

Browse files
authored
feat: add max age to replications create and update (#367)
1 parent c8c7c1c commit 88ba346

File tree

6 files changed

+90
-3
lines changed

6 files changed

+90
-3
lines changed

api/api_write.gen.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/contract/openapi

Submodule openapi updated 45 files

api/model_replication_creation_request.gen.go

Lines changed: 32 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/model_replication_update_request.gen.go

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/replication/replication.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type CreateParams struct {
2525
MaxQueueSize int64
2626
DropNonRetryableData bool
2727
NoDropNonRetryableData bool
28+
MaxAge int64
2829
}
2930

3031
func (c Client) Create(ctx context.Context, params *CreateParams) error {
@@ -41,6 +42,7 @@ func (c Client) Create(ctx context.Context, params *CreateParams) error {
4142
LocalBucketID: params.LocalBucketID,
4243
RemoteBucketID: params.RemoteBucketID,
4344
MaxQueueSizeBytes: params.MaxQueueSize,
45+
MaxAgeSeconds: params.MaxAge,
4446
}
4547

4648
// set optional params if specified
@@ -118,6 +120,7 @@ type UpdateParams struct {
118120
MaxQueueSize int64
119121
DropNonRetryableData bool
120122
NoDropNonRetryableData bool
123+
MaxAge int64
121124
}
122125

123126
func (c Client) Update(ctx context.Context, params *UpdateParams) error {
@@ -153,6 +156,10 @@ func (c Client) Update(ctx context.Context, params *UpdateParams) error {
153156
body.SetDropNonRetryableData(*dropNonRetryableDataBoolPtr)
154157
}
155158

159+
if params.MaxAge != 0 {
160+
body.SetMaxAgeSeconds(params.MaxAge)
161+
}
162+
156163
// send patch request
157164
res, err := c.PatchReplicationByID(ctx, params.ReplicationID).ReplicationUpdateRequest(body).Execute()
158165
if err != nil {

cmd/influx/replication.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func newReplicationCreateCmd() cli.Command {
7272
&cli.Int64Flag{
7373
Name: "max-queue-bytes",
7474
Usage: "Max queue size in bytes",
75-
Value: 67108860, // source: https://github.com/influxdata/openapi/blob/588064fe68e7dfeebd019695aa805832632cbfb6/src/oss/schemas/ReplicationCreationRequest.yml#L19
75+
Value: 67108860, // source: https://github.com/influxdata/openapi/blob/master/src/oss/schemas/ReplicationCreationRequest.yml
7676
Destination: &params.MaxQueueSize,
7777
},
7878
&cli.BoolFlag{
@@ -85,6 +85,12 @@ func newReplicationCreateCmd() cli.Command {
8585
Usage: "Do not drop data when a non-retryable error is encountered",
8686
Destination: &params.NoDropNonRetryableData,
8787
},
88+
&cli.Int64Flag{
89+
Name: "max-age",
90+
Usage: "Specify a maximum age (in seconds) for replications data before it is dropped, or 0 for infinite",
91+
Value: 604800, // source: https://github.com/influxdata/openapi/blob/master/src/oss/schemas/ReplicationCreationRequest.yml
92+
Destination: &params.MaxAge,
93+
},
8894
),
8995
Action: func(ctx *cli.Context) error {
9096
api := getAPI(ctx)
@@ -228,6 +234,11 @@ func newReplicationUpdateCmd() cli.Command {
228234
Usage: "Do not drop data when a non-retryable error is encountered",
229235
Destination: &params.NoDropNonRetryableData,
230236
},
237+
&cli.Int64Flag{
238+
Name: "max-age",
239+
Usage: "Specify a maximum age (in seconds) for replications data before it is dropped, or 0 for infinite",
240+
Destination: &params.MaxAge,
241+
},
231242
),
232243
Action: func(ctx *cli.Context) error {
233244
api := getAPI(ctx)

0 commit comments

Comments
 (0)