|
| 1 | +/* |
| 2 | + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one |
| 3 | + * or more contributor license agreements. Licensed under the Elastic License; |
| 4 | + * you may not use this file except in compliance with the Elastic License. |
| 5 | + */ |
| 6 | + |
| 7 | +import React from 'react'; |
| 8 | +import { FormattedMessage } from '@kbn/i18n/react'; |
| 9 | +import { i18n } from '@kbn/i18n'; |
| 10 | +import { byteUnitsUrl, timeUnitsUrl } from '../../services/documentation_links'; |
| 11 | + |
| 12 | +const byteUnitsHelpText = ( |
| 13 | + <FormattedMessage |
| 14 | + id="xpack.crossClusterReplication.followerIndexForm.advancedSettings.byteUnitsHelpText" |
| 15 | + defaultMessage="Example values: 10b, 1024kb, 1mb, 5gb, 2tb, 1pb. {link}" |
| 16 | + values={{ link: ( |
| 17 | + <a href={byteUnitsUrl} target="_blank"> |
| 18 | + <FormattedMessage |
| 19 | + id="xpack.crossClusterReplication.followerIndexForm.advancedSettings.byteUnitsHelpTextLinkMessage" |
| 20 | + defaultMessage="Learn more." |
| 21 | + /> |
| 22 | + </a> |
| 23 | + ) }} |
| 24 | + /> |
| 25 | +); |
| 26 | + |
| 27 | +const timeUnitsHelpText = ( |
| 28 | + <FormattedMessage |
| 29 | + id="xpack.crossClusterReplication.followerIndexForm.advancedSettings.timeUnitsHelpText" |
| 30 | + defaultMessage="Example values: 2d, 24h, 20m, 30s, 500ms, 10000micros, 80000nanos. {link}" |
| 31 | + values={{ link: ( |
| 32 | + <a href={timeUnitsUrl} target="_blank"> |
| 33 | + <FormattedMessage |
| 34 | + id="xpack.crossClusterReplication.followerIndexForm.advancedSettings.timeUnitsHelpTextLinkMessage" |
| 35 | + defaultMessage="Learn more." |
| 36 | + /> |
| 37 | + </a> |
| 38 | + ) }} |
| 39 | + /> |
| 40 | +); |
| 41 | + |
| 42 | +export const advancedSettingsFields = [ |
| 43 | + { |
| 44 | + field: 'maxReadRequestOperationCount', |
| 45 | + title: i18n.translate( |
| 46 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxReadRequestOperationCountTitle', { |
| 47 | + defaultMessage: 'Max read request operation count' |
| 48 | + } |
| 49 | + ), |
| 50 | + description: i18n.translate( |
| 51 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxReadRequestOperationCountDescription', { |
| 52 | + defaultMessage: 'The maximum number of operations to pull per read from the remote cluster.' |
| 53 | + } |
| 54 | + ), |
| 55 | + label: i18n.translate( |
| 56 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxReadRequestOperationCountLabel', { |
| 57 | + defaultMessage: 'Max read request operation count (optional)' |
| 58 | + } |
| 59 | + ), |
| 60 | + type: 'number', |
| 61 | + }, { |
| 62 | + field: 'maxOutstandingReadRequests', |
| 63 | + title: i18n.translate( |
| 64 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxOutstandingReadRequestsTitle', { |
| 65 | + defaultMessage: 'Max outstanding read requests' |
| 66 | + } |
| 67 | + ), |
| 68 | + description: i18n.translate('xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxOutstandingReadRequestsDescription', { |
| 69 | + defaultMessage: 'The maximum number of outstanding read requests from the remote cluster.' |
| 70 | + }), |
| 71 | + label: i18n.translate( |
| 72 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxOutstandingReadRequestsLabel', { |
| 73 | + defaultMessage: 'Max outstanding read requests (optional)' |
| 74 | + } |
| 75 | + ), |
| 76 | + type: 'number', |
| 77 | + }, { |
| 78 | + field: 'maxReadRequestSize', |
| 79 | + title: i18n.translate( |
| 80 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxReadRequestSizeTitle', { |
| 81 | + defaultMessage: 'Max read request size' |
| 82 | + } |
| 83 | + ), |
| 84 | + description: i18n.translate('xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxReadRequestSizeDescription', { |
| 85 | + defaultMessage: 'The maximum size in bytes of per read of a batch of operations pulled from the remote cluster.' |
| 86 | + }), |
| 87 | + label: i18n.translate( |
| 88 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxReadRequestSizeLabel', { |
| 89 | + defaultMessage: 'Max read request size (optional)' |
| 90 | + } |
| 91 | + ), |
| 92 | + helpText: byteUnitsHelpText, |
| 93 | + }, { |
| 94 | + field: 'maxWriteRequestOperationCount', |
| 95 | + title: i18n.translate( |
| 96 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxWriteRequestOperationCountTitle', { |
| 97 | + defaultMessage: 'Max write request operation count' |
| 98 | + } |
| 99 | + ), |
| 100 | + description: i18n.translate( |
| 101 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxWriteRequestOperationCountDescription', { |
| 102 | + defaultMessage: 'The maximum number of operations per bulk write request executed on the follower.' |
| 103 | + } |
| 104 | + ), |
| 105 | + label: i18n.translate( |
| 106 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxWriteRequestOperationCountLabel', { |
| 107 | + defaultMessage: 'Max write request operation count (optional)' |
| 108 | + } |
| 109 | + ), |
| 110 | + type: 'number', |
| 111 | + }, { |
| 112 | + field: 'maxWriteRequestSize', |
| 113 | + title: i18n.translate( |
| 114 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxWriteRequestSizeTitle', { |
| 115 | + defaultMessage: 'Max write request size' |
| 116 | + } |
| 117 | + ), |
| 118 | + description: i18n.translate( |
| 119 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxWriteRequestSizeDescription', { |
| 120 | + defaultMessage: 'The maximum total bytes of operations per bulk write request executed on the follower.' |
| 121 | + } |
| 122 | + ), |
| 123 | + label: i18n.translate( |
| 124 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxWriteRequestSizeLabel', { |
| 125 | + defaultMessage: 'Max write request size (optional)' |
| 126 | + } |
| 127 | + ), |
| 128 | + helpText: byteUnitsHelpText, |
| 129 | + }, { |
| 130 | + field: 'maxOutstandingWriteRequests', |
| 131 | + title: i18n.translate( |
| 132 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxOutstandingWriteRequestsTitle', { |
| 133 | + defaultMessage: 'Max outstanding write requests' |
| 134 | + } |
| 135 | + ), |
| 136 | + description: i18n.translate( |
| 137 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxOutstandingWriteRequestsDescription', { |
| 138 | + defaultMessage: 'The maximum number of outstanding write requests on the follower.' |
| 139 | + } |
| 140 | + ), |
| 141 | + label: i18n.translate( |
| 142 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxOutstandingWriteRequestsLabel', { |
| 143 | + defaultMessage: 'Max outstanding write requests (optional)' |
| 144 | + } |
| 145 | + ), |
| 146 | + type: 'number', |
| 147 | + }, { |
| 148 | + field: 'maxWriteBufferCount', |
| 149 | + title: i18n.translate( |
| 150 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxWriteBufferCountTitle', { |
| 151 | + defaultMessage: 'Max write buffer count' |
| 152 | + } |
| 153 | + ), |
| 154 | + description: i18n.translate( |
| 155 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxWriteBufferCountDescription', { |
| 156 | + defaultMessage: `The maximum number of operations that can be queued for writing; when this |
| 157 | + limit is reached, reads from the remote cluster will be deferred until the number of queued |
| 158 | + operations goes below the limit.` |
| 159 | + } |
| 160 | + ), |
| 161 | + label: i18n.translate( |
| 162 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxWriteBufferCountLabel', { |
| 163 | + defaultMessage: 'Max write buffer count (optional)' |
| 164 | + } |
| 165 | + ), |
| 166 | + type: 'number', |
| 167 | + }, { |
| 168 | + field: 'maxWriteBufferSize', |
| 169 | + title: i18n.translate( |
| 170 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxWriteBufferSizeTitle', { |
| 171 | + defaultMessage: 'Max write buffer size' |
| 172 | + } |
| 173 | + ), |
| 174 | + description: i18n.translate( |
| 175 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxWriteBufferSizeDescription', { |
| 176 | + defaultMessage: `The maximum total bytes of operations that can be queued for writing; when |
| 177 | + this limit is reached, reads from the remote cluster will be deferred until the total bytes |
| 178 | + of queued operations goes below the limit.` |
| 179 | + } |
| 180 | + ), |
| 181 | + label: i18n.translate( |
| 182 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxWriteBufferSizeLabel', { |
| 183 | + defaultMessage: 'Max write buffer size (optional)' |
| 184 | + } |
| 185 | + ), |
| 186 | + helpText: byteUnitsHelpText, |
| 187 | + }, { |
| 188 | + field: 'maxRetryDelay', |
| 189 | + title: i18n.translate( |
| 190 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxRetryDelayTitle', { |
| 191 | + defaultMessage: 'Max retry delay' |
| 192 | + } |
| 193 | + ), |
| 194 | + description: i18n.translate( |
| 195 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxRetryDelayDescription', { |
| 196 | + defaultMessage: `The maximum time to wait before retrying an operation that failed exceptionally; |
| 197 | + an exponential backoff strategy is employed when retrying.` |
| 198 | + } |
| 199 | + ), |
| 200 | + label: i18n.translate( |
| 201 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.maxRetryDelayLabel', { |
| 202 | + defaultMessage: 'Max retry delay (optional)' |
| 203 | + } |
| 204 | + ), |
| 205 | + helpText: timeUnitsHelpText, |
| 206 | + }, { |
| 207 | + field: 'readPollTimeout', |
| 208 | + title: i18n.translate( |
| 209 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.readPollTimeoutTitle', { |
| 210 | + defaultMessage: 'Read poll timeout' |
| 211 | + } |
| 212 | + ), |
| 213 | + description: i18n.translate( |
| 214 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.readPollTimeoutDescription', { |
| 215 | + defaultMessage: `The maximum time to wait for new operations on the remote cluster when the |
| 216 | + follower index is synchronized with the leader index; when the timeout has elapsed, the |
| 217 | + poll for operations will return to the follower so that it can update some statistics, and |
| 218 | + then the follower will immediately attempt to read from the leader again.` |
| 219 | + } |
| 220 | + ), |
| 221 | + label: i18n.translate( |
| 222 | + 'xpack.crossClusterReplication.followerIndexForm.advancedSettings.readPollTimeoutLabel', { |
| 223 | + defaultMessage: 'Read poll timeout (optional)' |
| 224 | + } |
| 225 | + ), |
| 226 | + helpText: timeUnitsHelpText, |
| 227 | + }, |
| 228 | +]; |
| 229 | + |
| 230 | +export const emptyAdvancedSettings = advancedSettingsFields.reduce((obj, advancedSetting) => { |
| 231 | + return { ...obj, [advancedSetting.field]: '' }; |
| 232 | +}, {}); |
0 commit comments