Skip to content

Commit 6a03e01

Browse files
authored
VER: Release 0.53.0
2 parents 696eb6a + 6ad5d28 commit 6a03e01

File tree

15 files changed

+473
-62
lines changed

15 files changed

+473
-62
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 0.53.0 - 2026-04-08
4+
5+
### Enhancements
6+
- Added `TryNextRecord` and `FillBuffer` to `LiveBlocking` for more fine-grained
7+
control around I/O
8+
- Added `TimeoutConf` struct and `SetTimeoutConf()` builder method for configuring connect
9+
and auth timeouts on the Live client (defaults to 10s and 30s)
10+
- Added `SessionId()` and `Timeouts()` getters to `LiveBlocking` and `LiveThreaded`
11+
312
## 0.52.0 - 2026-03-31
413

514
### Enhancements

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.24..4.2)
66

77
project(
88
databento
9-
VERSION 0.52.0
9+
VERSION 0.53.0
1010
LANGUAGES CXX
1111
DESCRIPTION "Official Databento client library"
1212
)

include/databento/detail/live_connection.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ class LiveConnection : IWritable {
2525
public:
2626
LiveConnection(ILogReceiver* log_receiver, const std::string& gateway,
2727
std::uint16_t port);
28+
LiveConnection(ILogReceiver* log_receiver, const std::string& gateway,
29+
std::uint16_t port, TcpClient::RetryConf retry_conf);
2830

2931
void WriteAll(std::string_view str);
3032
void WriteAll(const std::byte* buffer, std::size_t size);

include/databento/detail/tcp_client.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class TcpClient {
2020
struct RetryConf {
2121
std::uint32_t max_attempts{1};
2222
std::chrono::seconds max_wait{std::chrono::minutes{1}};
23+
std::chrono::seconds connect_timeout{std::chrono::seconds{10}};
2324
};
2425

2526
TcpClient(ILogReceiver* log_receiver, const std::string& gateway, std::uint16_t port);

include/databento/live.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ class LiveBuilder {
5757
LiveBuilder& SetCompression(Compression compression);
5858
// Sets the behavior of the gateway when the client falls behind real time.
5959
LiveBuilder& SetSlowReaderBehavior(SlowReaderBehavior slow_reader_behavior);
60+
// Sets the timeouts for connecting and authenticating with the gateway.
61+
// Defaults to 10 seconds for connect and 30 seconds for auth.
62+
LiveBuilder& SetTimeoutConf(TimeoutConf timeout_conf);
6063

6164
/*
6265
* Build a live client instance
@@ -85,5 +88,6 @@ class LiveBuilder {
8588
std::string user_agent_ext_;
8689
Compression compression_{Compression::None};
8790
std::optional<SlowReaderBehavior> slow_reader_behavior_{};
91+
TimeoutConf timeout_conf_{};
8892
};
8993
} // namespace databento

include/databento/live_blocking.hpp

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ namespace databento {
2121
// Forward declaration
2222
class ILogReceiver;
2323
class LiveBuilder;
24+
25+
// Timeouts for the Live client's connection and authentication phases.
26+
struct TimeoutConf {
27+
std::chrono::seconds connect{10};
28+
std::chrono::seconds auth{30};
29+
};
30+
2431
class LiveThreaded;
2532

2633
// A client for interfacing with Databento's real-time and intraday replay
@@ -48,6 +55,8 @@ class LiveBlocking {
4855
std::optional<databento::SlowReaderBehavior> SlowReaderBehavior() const {
4956
return slow_reader_behavior_;
5057
}
58+
const databento::TimeoutConf& TimeoutConf() const { return timeout_conf_; }
59+
std::uint64_t SessionId() const { return session_id_; }
5160
const std::vector<LiveSubscription>& Subscriptions() const { return subscriptions_; }
5261
std::vector<LiveSubscription>& Subscriptions() { return subscriptions_; }
5362

@@ -81,6 +90,26 @@ class LiveBlocking {
8190
//
8291
// This method should only be called after `Start`.
8392
const Record* NextRecord(std::chrono::milliseconds timeout);
93+
// Returns the next record from the internal buffer without performing any
94+
// I/O. Returns `nullptr` if no complete record is buffered. The returned
95+
// pointer is valid until the next call to `TryNextRecord`, `NextRecord`,
96+
// or `FillBuffer`.
97+
//
98+
// This method should only be called after `Start`.
99+
const Record* TryNextRecord();
100+
// Reads available data from the connection into the internal buffer using
101+
// the heartbeat timeout. Returns the number of bytes read and the status.
102+
// A `read_size` of 0 with `Status::Closed` indicates the connection was
103+
// closed by the gateway.
104+
//
105+
// This method should only be called after `Start`.
106+
IReadable::Result FillBuffer();
107+
// Reads available data from the connection into the internal buffer.
108+
// Returns the number of bytes read and the status. A `read_size` of 0 with
109+
// `Status::Closed` indicates the connection was closed by the gateway.
110+
//
111+
// This method should only be called after `Start`.
112+
IReadable::Result FillBuffer(std::chrono::milliseconds timeout);
84113
// Stops the session with the gateway. Once stopped, the session cannot be
85114
// restarted.
86115
void Stop();
@@ -99,25 +128,27 @@ class LiveBlocking {
99128
std::optional<std::chrono::seconds> heartbeat_interval,
100129
std::size_t buffer_size, std::string user_agent_ext,
101130
databento::Compression compression,
102-
std::optional<databento::SlowReaderBehavior> slow_reader_behavior);
131+
std::optional<databento::SlowReaderBehavior> slow_reader_behavior,
132+
databento::TimeoutConf timeout_conf);
103133
LiveBlocking(ILogReceiver* log_receiver, std::string key, std::string dataset,
104134
std::string gateway, std::uint16_t port, bool send_ts_out,
105135
VersionUpgradePolicy upgrade_policy,
106136
std::optional<std::chrono::seconds> heartbeat_interval,
107137
std::size_t buffer_size, std::string user_agent_ext,
108138
databento::Compression compression,
109-
std::optional<databento::SlowReaderBehavior> slow_reader_behavior);
139+
std::optional<databento::SlowReaderBehavior> slow_reader_behavior,
140+
databento::TimeoutConf timeout_conf);
110141

111142
std::string DetermineGateway() const;
112143
std::uint64_t Authenticate();
113-
std::string DecodeChallenge();
144+
std::string DecodeChallenge(std::chrono::milliseconds timeout);
114145
std::string GenerateCramReply(std::string_view challenge_key);
115146
std::string EncodeAuthReq(std::string_view auth);
116-
std::uint64_t DecodeAuthResp();
147+
std::uint64_t DecodeAuthResp(std::chrono::milliseconds timeout);
117148
void IncrementSubCounter();
118149
void Subscribe(std::string_view sub_msg, const std::vector<std::string>& symbols,
119150
bool use_snapshot);
120-
IReadable::Result FillBuffer(std::chrono::milliseconds timeout);
151+
const Record* ConsumeBufferedRecord();
121152
RecordHeader* BufferRecordHeader();
122153
std::chrono::milliseconds HeartbeatTimeout() const;
123154
void CheckHeartbeatTimeout() const;
@@ -136,6 +167,7 @@ class LiveBlocking {
136167
const std::optional<std::chrono::seconds> heartbeat_interval_;
137168
const databento::Compression compression_;
138169
const std::optional<databento::SlowReaderBehavior> slow_reader_behavior_;
170+
const databento::TimeoutConf timeout_conf_;
139171
detail::LiveConnection connection_;
140172
std::uint32_t sub_counter_{};
141173
std::vector<LiveSubscription> subscriptions_;

include/databento/live_threaded.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "databento/datetime.hpp" // UnixNanos
1313
#include "databento/detail/scoped_thread.hpp" // ScopedThread
1414
#include "databento/enums.hpp" // Schema, SType
15+
#include "databento/live_blocking.hpp" // TimeoutConf
1516
#include "databento/live_subscription.hpp"
1617
#include "databento/timeseries.hpp" // MetadataCallback, RecordCallback
1718

@@ -56,6 +57,8 @@ class LiveThreaded {
5657
std::optional<std::chrono::seconds> HeartbeatInterval() const;
5758
databento::Compression Compression() const;
5859
std::optional<databento::SlowReaderBehavior> SlowReaderBehavior() const;
60+
const databento::TimeoutConf& TimeoutConf() const;
61+
std::uint64_t SessionId() const;
5962
const std::vector<LiveSubscription>& Subscriptions() const;
6063
std::vector<LiveSubscription>& Subscriptions();
6164

@@ -111,14 +114,16 @@ class LiveThreaded {
111114
std::optional<std::chrono::seconds> heartbeat_interval,
112115
std::size_t buffer_size, std::string user_agent_ext,
113116
databento::Compression compression,
114-
std::optional<databento::SlowReaderBehavior> slow_reader_behavior);
117+
std::optional<databento::SlowReaderBehavior> slow_reader_behavior,
118+
databento::TimeoutConf timeout_conf);
115119
LiveThreaded(ILogReceiver* log_receiver, std::string key, std::string dataset,
116120
std::string gateway, std::uint16_t port, bool send_ts_out,
117121
VersionUpgradePolicy upgrade_policy,
118122
std::optional<std::chrono::seconds> heartbeat_interval,
119123
std::size_t buffer_size, std::string user_agent_ext,
120124
databento::Compression compression,
121-
std::optional<databento::SlowReaderBehavior> slow_reader_behavior);
125+
std::optional<databento::SlowReaderBehavior> slow_reader_behavior,
126+
databento::TimeoutConf timeout_conf);
122127

123128
// unique_ptr to be movable
124129
std::unique_ptr<Impl> impl_;

include/databento/publishers.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ enum class Dataset : std::uint16_t {
145145
XcisBbo = 13,
146146
// NYSE National Trades
147147
XcisTrades = 14,
148-
// MEMX Memoir Depth
148+
// MEMX MEMOIR Depth
149149
MemxMemoir = 15,
150150
// MIAX Pearl Depth
151151
EprlDom = 16,
@@ -195,7 +195,7 @@ enum class Dataset : std::uint16_t {
195195
XeurEobi = 38,
196196
// European Energy Exchange EOBI
197197
XeeeEobi = 39,
198-
// Cboe Futures Exchange PITCH
198+
// CFE Depth
199199
XcbfPitch = 40,
200200
// Blue Ocean ATS MEMOIR Depth
201201
OceaMemoir = 41,
@@ -231,7 +231,7 @@ enum class Publisher : std::uint16_t {
231231
XcisBboXcis = 13,
232232
// NYSE National Trades
233233
XcisTradesXcis = 14,
234-
// MEMX Memoir Depth
234+
// MEMX MEMOIR Depth
235235
MemxMemoirMemx = 15,
236236
// MIAX Pearl Depth
237237
EprlDomEprl = 16,
@@ -411,9 +411,9 @@ enum class Publisher : std::uint16_t {
411411
XeurEobiXoff = 103,
412412
// European Energy Exchange EOBI - Off-Market Trades
413413
XeeeEobiXoff = 104,
414-
// Cboe Futures Exchange
414+
// Cboe Futures Exchange (CFE)
415415
XcbfPitchXcbf = 105,
416-
// Cboe Futures Exchange - Off-Market Trades
416+
// Cboe Futures Exchange (CFE) - Off-Market Trades
417417
XcbfPitchXoff = 106,
418418
// Blue Ocean ATS MEMOIR
419419
OceaMemoirOcea = 107,

pkg/PKGBUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Maintainer: Databento <support@databento.com>
22
_pkgname=databento-cpp
33
pkgname=databento-cpp-git
4-
pkgver=0.52.0
4+
pkgver=0.53.0
55
pkgrel=1
66
pkgdesc="Official C++ client for Databento"
77
arch=('any')

src/detail/live_connection.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ LiveConnection::LiveConnection(ILogReceiver* log_receiver, const std::string& ga
1010
std::uint16_t port)
1111
: client_{log_receiver, gateway, port} {}
1212

13+
LiveConnection::LiveConnection(ILogReceiver* log_receiver, const std::string& gateway,
14+
std::uint16_t port, TcpClient::RetryConf retry_conf)
15+
: client_{log_receiver, gateway, port, retry_conf} {}
16+
1317
void LiveConnection::WriteAll(std::string_view str) { client_.WriteAll(str); }
1418

1519
void LiveConnection::WriteAll(const std::byte* buffer, std::size_t size) {

0 commit comments

Comments
 (0)