Skip to content

Commit

Permalink
feat: add max age to replications create and update (#367)
Browse files Browse the repository at this point in the history
  • Loading branch information
DStrand1 committed Mar 18, 2022
1 parent c8c7c1c commit 88ba346
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 3 deletions.
2 changes: 2 additions & 0 deletions api/api_write.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/contract/openapi
Submodule openapi updated 45 files
+2 −0 .gitattributes
+1 −0 contracts/cloud-diff.yml
+28 −34 contracts/cloud.json
+70 −33 contracts/cloud.yml
+70 −33 contracts/common.yml
+748 −2 contracts/oss-diff.yml
+904 −158 contracts/oss.json
+817 −35 contracts/oss.yml
+0 −45 contracts/priv/cloud-priv.yml
+12 −70 contracts/priv/fluxdocsd.yml
+195 −229 contracts/priv/nifid.yml
+84 −50 contracts/ref/cloud.yml
+835 −52 contracts/ref/oss.yml
+12 −70 contracts/svc/fluxdocsd.yml
+13 −8 contracts/svc/nifid.yml
+5 −0 scripts/generate.sh
+1 −0 scripts/reference.sh
+0 −2 src/cloud-priv.yml
+16 −11 src/common/paths/query.yml
+59 −26 src/common/paths/write.yml
+1 −0 src/common/schemas/CheckBase.yml
+32 −2 src/oss.yml
+85 −0 src/oss/paths/debug_pprof_all.yml
+84 −0 src/oss/paths/debug_pprof_allocs.yml
+80 −0 src/oss/paths/debug_pprof_block.yml
+22 −0 src/oss/paths/debug_pprof_cmdline.yml
+80 −0 src/oss/paths/debug_pprof_goroutine.yml
+109 −0 src/oss/paths/debug_pprof_heap.yml
+81 −0 src/oss/paths/debug_pprof_mutex.yml
+52 −0 src/oss/paths/debug_pprof_profile.yml
+93 −0 src/oss/paths/debug_pprof_threadcreate.yml
+44 −0 src/oss/paths/debug_pprof_trace.yml
+6 −0 src/oss/schemas/ReplicationCreationRequest.yml
+4 −0 src/oss/schemas/ReplicationUpdateRequest.yml
+2 −0 src/svc-fluxdocsd.yml
+6 −6 src/svc-nifid.yml
+1 −19 src/svc/fluxdocsd/paths/fluxdocs.yml
+1 −69 src/svc/fluxdocsd/paths/fluxdocs_id.yml
+27 −0 src/svc/fluxdocsd/paths/fluxdocs_search_searchTerm.yml
+0 −0 src/svc/nifid/paths/broker_subs.yml
+0 −0 src/svc/nifid/paths/broker_subs_id.yml
+0 −0 src/svc/nifid/paths/broker_subs_id_status.yml
+7 −0 src/svc/nifid/schemas/Subscription.yml
+2 −0 src/svc/nifid/schemas/SubscriptionParams.yml
+2 −5 src/svc/nifid/schemas/SubscriptionStatus.yml
33 changes: 32 additions & 1 deletion api/model_replication_creation_request.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions api/model_replication_update_request.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions clients/replication/replication.go
Expand Up @@ -25,6 +25,7 @@ type CreateParams struct {
MaxQueueSize int64
DropNonRetryableData bool
NoDropNonRetryableData bool
MaxAge int64
}

func (c Client) Create(ctx context.Context, params *CreateParams) error {
Expand All @@ -41,6 +42,7 @@ func (c Client) Create(ctx context.Context, params *CreateParams) error {
LocalBucketID: params.LocalBucketID,
RemoteBucketID: params.RemoteBucketID,
MaxQueueSizeBytes: params.MaxQueueSize,
MaxAgeSeconds: params.MaxAge,
}

// set optional params if specified
Expand Down Expand Up @@ -118,6 +120,7 @@ type UpdateParams struct {
MaxQueueSize int64
DropNonRetryableData bool
NoDropNonRetryableData bool
MaxAge int64
}

func (c Client) Update(ctx context.Context, params *UpdateParams) error {
Expand Down Expand Up @@ -153,6 +156,10 @@ func (c Client) Update(ctx context.Context, params *UpdateParams) error {
body.SetDropNonRetryableData(*dropNonRetryableDataBoolPtr)
}

if params.MaxAge != 0 {
body.SetMaxAgeSeconds(params.MaxAge)
}

// send patch request
res, err := c.PatchReplicationByID(ctx, params.ReplicationID).ReplicationUpdateRequest(body).Execute()
if err != nil {
Expand Down
13 changes: 12 additions & 1 deletion cmd/influx/replication.go
Expand Up @@ -72,7 +72,7 @@ func newReplicationCreateCmd() cli.Command {
&cli.Int64Flag{
Name: "max-queue-bytes",
Usage: "Max queue size in bytes",
Value: 67108860, // source: https://github.com/influxdata/openapi/blob/588064fe68e7dfeebd019695aa805832632cbfb6/src/oss/schemas/ReplicationCreationRequest.yml#L19
Value: 67108860, // source: https://github.com/influxdata/openapi/blob/master/src/oss/schemas/ReplicationCreationRequest.yml
Destination: &params.MaxQueueSize,
},
&cli.BoolFlag{
Expand All @@ -85,6 +85,12 @@ func newReplicationCreateCmd() cli.Command {
Usage: "Do not drop data when a non-retryable error is encountered",
Destination: &params.NoDropNonRetryableData,
},
&cli.Int64Flag{
Name: "max-age",
Usage: "Specify a maximum age (in seconds) for replications data before it is dropped, or 0 for infinite",
Value: 604800, // source: https://github.com/influxdata/openapi/blob/master/src/oss/schemas/ReplicationCreationRequest.yml
Destination: &params.MaxAge,
},
),
Action: func(ctx *cli.Context) error {
api := getAPI(ctx)
Expand Down Expand Up @@ -228,6 +234,11 @@ func newReplicationUpdateCmd() cli.Command {
Usage: "Do not drop data when a non-retryable error is encountered",
Destination: &params.NoDropNonRetryableData,
},
&cli.Int64Flag{
Name: "max-age",
Usage: "Specify a maximum age (in seconds) for replications data before it is dropped, or 0 for infinite",
Destination: &params.MaxAge,
},
),
Action: func(ctx *cli.Context) error {
api := getAPI(ctx)
Expand Down

0 comments on commit 88ba346

Please sign in to comment.