Seismic Drive Client API
HttpContext.h
Go to the documentation of this file.
1 // ============================================================================
2 // Copyright 2017-2024, Schlumberger
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 // ============================================================================
16 
17 #pragma once
18 
19 #include <cstdint>
20 #include <string>
21 
22 namespace seismicdrive
23 {
24  /*******************************************************************************/
31  enum class HttpConnectionLink
32  {
33  ANY,
36  };
37 
38  /*******************************************************************************/
68  {
69 
70  bool enabled{true};
71  uint64_t maxRetry{10};
72  uint64_t maxWaitingTimeMicroSec{32000000};
73  uint64_t initialWaitingTimeMicroSec{500000};
74  };
75 
76  /*******************************************************************************/
85  struct HttpContext
86  {
87 
88  // The maximum time in seconds the access request is supposed to take. Abort access if it takes more than ${timeoutSecs} seconds.
89  // Default value set according to the default timeouts applied to seismic-dms service // max waiting time before aborting the request
90  uint32_t timeoutSecs{300};
91 
92  // Abort the transfer if the transfer speed is slower than ${lowSpeedLimitBytesPerSec} bytes per second for a duration of ${lowSpeedTimeSecs} seconds.
93  // This option is disabled by default (0 value applied).
94  // Do not change these values as the slowness detection is not required on the seismic-dms connection link (request to seismic store service)
95  // It has been demonstrated to be a source of non-controllable retries, It should be tuned correctly, but in this case the ${timeoutSec} is already an acceptable value.
96  // The connection is wanted to be hung for more than ${timeoutSec}
98  uint32_t lowSpeedTimeSecs{0};
99 
100  // # NOTE OF DEPRECATION #
101  // This comment is to delete after the GCSAccessor have been removed from the exported interface of sdapi.
102  // If a client application sets its own context on gcs link only (usage of SDAPI as GCS SDK), consider this setting:
103  // lowSpeedLimitBytesPerSec = 30 AND lowSpeedTimeSecs = 15
104 
105  // Enable re-authorization of credentials on Timeout due to either Access request or low speed limit options.
107  // Enable TCP Keep Alive probing.
108  bool tcpKeepAlive{true};
109  // Waiting time duration in seconds while the TCP connection is idle before sending Keep-Alive probes.
110  uint32_t tcpKeepIdle{60};
111  // Time interval in seconds between sending Keep-Alive probes.
112  uint32_t tcpKeepIntvl{60};
113  };
114 
115 }
Defines the underline http connection parameters.
Definition: HttpContext.h:85
bool tcpKeepAlive
Definition: HttpContext.h:108
uint64_t initialWaitingTimeMicroSec
Definition: HttpContext.h:73
bool reauthorizeOnTimeout
Definition: HttpContext.h:106
uint32_t timeoutSecs
Definition: HttpContext.h:90
uint32_t lowSpeedTimeSecs
Definition: HttpContext.h:98
uint32_t tcpKeepIntvl
Definition: HttpContext.h:112
uint64_t maxRetry
Definition: HttpContext.h:71
bool enabled
Definition: HttpContext.h:70
Defines the exponential retry backoff policy parameters.
Definition: HttpContext.h:67
HttpConnectionLink
Defines the sdapi connection links.
Definition: HttpContext.h:31
uint64_t maxWaitingTimeMicroSec
Definition: HttpContext.h:72
Definition: Constants.h:27
uint32_t tcpKeepIdle
Definition: HttpContext.h:110
uint32_t lowSpeedLimitBytesPerSec
Definition: HttpContext.h:97