Skip to content

Commit e678de3

Browse files
committed
REF: Rename Bento to DBNStore
1 parent cf9749c commit e678de3

File tree

9 files changed

+54
-53
lines changed

9 files changed

+54
-53
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 0.5.0 - TBD
44
- Added `Historical::MetadataGetDatasetRange`
55
- Changed `MetadataGetDatasetCondition` to return `vector<DatasetConditionDetail>`
6+
- Renamed `FileBento` to `DbnFileStore`
67

78
## 0.4.0 - 2023-03-02
89
- Renamed DBZ to DBN

cmake/SourcesAndHeaders.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set(headers
44
include/databento/datetime.hpp
55
include/databento/dbn.hpp
66
include/databento/dbn_decoder.hpp
7-
include/databento/file_bento.hpp
7+
include/databento/dbn_file_store.hpp
88
include/databento/enums.hpp
99
include/databento/exceptions.hpp
1010
include/databento/flag_set.hpp
@@ -34,7 +34,7 @@ set(sources
3434
src/dbn_decoder.cpp
3535
src/enums.cpp
3636
src/exceptions.cpp
37-
src/file_bento.cpp
37+
src/dbn_file_store.cpp
3838
src/historical.cpp
3939
src/live.cpp
4040
src/live_blocking.cpp

example/historical/timeseries_get_range_to_file.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55

66
#include "databento/constants.hpp"
77
#include "databento/datetime.hpp"
8+
#include "databento/dbn_file_store.hpp"
89
#include "databento/enums.hpp"
9-
#include "databento/file_bento.hpp"
1010
#include "databento/historical.hpp"
1111
#include "databento/record.hpp"
1212

1313
int main() {
1414
auto client = databento::HistoricalBuilder{}.SetKeyFromEnv().Build();
1515
const auto limit = 1000;
16-
databento::FileBento file_bento = client.TimeseriesGetRangeToFile(
16+
databento::DbnFileStore dbn_file_store = client.TimeseriesGetRangeToFile(
1717
databento::dataset::kGlbxMdp3, "2022-10-03T00:00", "2022-10-04T00:00",
1818
{"ESZ2"}, databento::Schema::Ohlcv1M, databento::SType::Native,
1919
databento::SType::ProductId, limit,
2020
"ESZ2-ohlcv1m-20201003-20201004.dbn.zst");
21-
file_bento.Replay([](const databento::Record record) {
21+
dbn_file_store.Replay([](const databento::Record record) {
2222
const auto& ohlcv_bar = record.Get<databento::OhlcvMsg>();
2323
std::cout << ohlcv_bar << '\n';
2424
return databento::KeepGoing::Continue;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
namespace databento {
1111
// A reader for DBN files.
12-
class FileBento {
12+
class DbnFileStore {
1313
public:
14-
explicit FileBento(const std::string& file_path);
14+
explicit DbnFileStore(const std::string& file_path);
1515

1616
void Replay(const MetadataCallback& metadata_callback,
1717
const RecordCallback& record_callback);

include/databento/historical.hpp

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
#include <string>
77
#include <vector>
88

9-
#include "databento/batch.hpp" // BatchJob
10-
#include "databento/datetime.hpp" // UnixNanos
9+
#include "databento/batch.hpp" // BatchJob
10+
#include "databento/datetime.hpp" // UnixNanos
11+
#include "databento/dbn_file_store.hpp"
1112
#include "databento/detail/http_client.hpp" // HttpClient
1213
#include "databento/enums.hpp" // BatchState, Delivery, DurationInterval, Packaging, Schema, SType
13-
#include "databento/file_bento.hpp"
1414
#include "databento/metadata.hpp" // DatasetConditionDetail, DatasetRange, FieldsByDatasetEncodingAndSchema, PriceByFeedMode, PriceByFeedModeAndSchema, PriceBySchema
1515
#include "databento/symbology.hpp" // SymbologyResolution
1616
#include "databento/timeseries.hpp" // KeepGoing, MetadataCallback, RecordCallback
@@ -210,34 +210,34 @@ class Historical {
210210
std::size_t limit,
211211
const MetadataCallback& metadata_callback,
212212
const RecordCallback& record_callback);
213-
// Stream historical market data to a file at `path`. Returns a `FileBento`
213+
// Stream historical market data to a file at `path`. Returns a `DbnFileStore`
214214
// object for replaying the data in `file_path`.
215215
//
216216
// If a file at `file_path` already exists, it will be overwritten.
217-
FileBento TimeseriesGetRangeToFile(const std::string& dataset,
218-
UnixNanos start, UnixNanos end,
219-
const std::vector<std::string>& symbols,
220-
Schema schema,
221-
const std::string& file_path);
222-
FileBento TimeseriesGetRangeToFile(const std::string& dataset,
223-
const std::string& start,
224-
const std::string& end,
225-
const std::vector<std::string>& symbols,
226-
Schema schema,
227-
const std::string& file_path);
228-
FileBento TimeseriesGetRangeToFile(const std::string& dataset,
229-
UnixNanos start, UnixNanos end,
230-
const std::vector<std::string>& symbols,
231-
Schema schema, SType stype_in,
232-
SType stype_out, std::size_t limit,
233-
const std::string& file_path);
234-
FileBento TimeseriesGetRangeToFile(const std::string& dataset,
235-
const std::string& start,
236-
const std::string& end,
237-
const std::vector<std::string>& symbols,
238-
Schema schema, SType stype_in,
239-
SType stype_out, std::size_t limit,
240-
const std::string& file_path);
217+
DbnFileStore TimeseriesGetRangeToFile(const std::string& dataset,
218+
UnixNanos start, UnixNanos end,
219+
const std::vector<std::string>& symbols,
220+
Schema schema,
221+
const std::string& file_path);
222+
DbnFileStore TimeseriesGetRangeToFile(const std::string& dataset,
223+
const std::string& start,
224+
const std::string& end,
225+
const std::vector<std::string>& symbols,
226+
Schema schema,
227+
const std::string& file_path);
228+
DbnFileStore TimeseriesGetRangeToFile(const std::string& dataset,
229+
UnixNanos start, UnixNanos end,
230+
const std::vector<std::string>& symbols,
231+
Schema schema, SType stype_in,
232+
SType stype_out, std::size_t limit,
233+
const std::string& file_path);
234+
DbnFileStore TimeseriesGetRangeToFile(const std::string& dataset,
235+
const std::string& start,
236+
const std::string& end,
237+
const std::vector<std::string>& symbols,
238+
Schema schema, SType stype_in,
239+
SType stype_out, std::size_t limit,
240+
const std::string& file_path);
241241

242242
private:
243243
using HttplibParams = std::multimap<std::string, std::string>;
@@ -255,8 +255,8 @@ class Historical {
255255
void TimeseriesGetRange(const HttplibParams& params,
256256
const MetadataCallback& metadata_callback,
257257
const RecordCallback& record_callback);
258-
FileBento TimeseriesGetRangeToFile(const HttplibParams& params,
259-
const std::string& file_path);
258+
DbnFileStore TimeseriesGetRangeToFile(const HttplibParams& params,
259+
const std::string& file_path);
260260

261261
const std::string key_;
262262
const std::string gateway_;
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
#include "databento/file_bento.hpp"
1+
#include "databento/dbn_file_store.hpp"
22

33
#include <utility> // move
44

55
#include "databento/detail/file_stream.hpp"
66

7-
using databento::FileBento;
7+
using databento::DbnFileStore;
88

9-
FileBento::FileBento(const std::string& file_path)
9+
DbnFileStore::DbnFileStore(const std::string& file_path)
1010
: parser_{detail::FileStream{file_path}} {}
1111

12-
void FileBento::Replay(const MetadataCallback& metadata_callback,
13-
const RecordCallback& record_callback) {
12+
void DbnFileStore::Replay(const MetadataCallback& metadata_callback,
13+
const RecordCallback& record_callback) {
1414
auto metadata = parser_.DecodeMetadata();
1515
const auto record_count = metadata.record_count;
1616
if (metadata_callback) {
@@ -24,6 +24,6 @@ void FileBento::Replay(const MetadataCallback& metadata_callback,
2424
}
2525
}
2626

27-
void FileBento::Replay(const RecordCallback& record_callback) {
27+
void DbnFileStore::Replay(const RecordCallback& record_callback) {
2828
Replay({}, record_callback);
2929
}

src/detail/file_stream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ using databento::detail::FileStream;
88

99
FileStream::FileStream(const std::string& file_path) : stream_{file_path} {
1010
if (stream_.fail()) {
11-
throw InvalidArgumentError{"FileBento", "file_path",
11+
throw InvalidArgumentError{"DbnFileStore", "file_path",
1212
"Non-existent or invalid file"};
1313
}
1414
}

src/historical.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
#include "databento/constants.hpp"
1818
#include "databento/datetime.hpp"
1919
#include "databento/dbn_decoder.hpp"
20+
#include "databento/dbn_file_store.hpp"
2021
#include "databento/detail/scoped_thread.hpp"
2122
#include "databento/detail/shared_channel.hpp"
2223
#include "databento/enums.hpp"
2324
#include "databento/exceptions.hpp" // Exception, JsonResponseError
24-
#include "databento/file_bento.hpp"
2525
#include "databento/metadata.hpp"
2626
#include "databento/timeseries.hpp"
2727

@@ -1142,23 +1142,23 @@ void Historical::TimeseriesGetRange(const HttplibParams& params,
11421142
static const std::string kTimeseriesGetRangeToFileEndpoint =
11431143
"Historical::TimeseriesGetRangeToFile";
11441144

1145-
databento::FileBento Historical::TimeseriesGetRangeToFile(
1145+
databento::DbnFileStore Historical::TimeseriesGetRangeToFile(
11461146
const std::string& dataset, UnixNanos start, UnixNanos end,
11471147
const std::vector<std::string>& symbols, Schema schema,
11481148
const std::string& file_path) {
11491149
return this->TimeseriesGetRangeToFile(dataset, start, end, symbols, schema,
11501150
kDefaultSTypeIn, kDefaultSTypeOut, {},
11511151
file_path);
11521152
}
1153-
databento::FileBento Historical::TimeseriesGetRangeToFile(
1153+
databento::DbnFileStore Historical::TimeseriesGetRangeToFile(
11541154
const std::string& dataset, const std::string& start,
11551155
const std::string& end, const std::vector<std::string>& symbols,
11561156
Schema schema, const std::string& file_path) {
11571157
return this->TimeseriesGetRangeToFile(dataset, start, end, symbols, schema,
11581158
kDefaultSTypeIn, kDefaultSTypeOut, {},
11591159
file_path);
11601160
}
1161-
databento::FileBento Historical::TimeseriesGetRangeToFile(
1161+
databento::DbnFileStore Historical::TimeseriesGetRangeToFile(
11621162
const std::string& dataset, UnixNanos start, UnixNanos end,
11631163
const std::vector<std::string>& symbols, Schema schema, SType stype_in,
11641164
SType stype_out, std::size_t limit, const std::string& file_path) {
@@ -1175,7 +1175,7 @@ databento::FileBento Historical::TimeseriesGetRangeToFile(
11751175
::SetIfPositive(&params, "limit", limit);
11761176
return this->TimeseriesGetRangeToFile(params, file_path);
11771177
}
1178-
databento::FileBento Historical::TimeseriesGetRangeToFile(
1178+
databento::DbnFileStore Historical::TimeseriesGetRangeToFile(
11791179
const std::string& dataset, const std::string& start,
11801180
const std::string& end, const std::vector<std::string>& symbols,
11811181
Schema schema, SType stype_in, SType stype_out, std::size_t limit,
@@ -1193,7 +1193,7 @@ databento::FileBento Historical::TimeseriesGetRangeToFile(
11931193
::SetIfPositive(&params, "limit", limit);
11941194
return this->TimeseriesGetRangeToFile(params, file_path);
11951195
}
1196-
databento::FileBento Historical::TimeseriesGetRangeToFile(
1196+
databento::DbnFileStore Historical::TimeseriesGetRangeToFile(
11971197
const HttplibParams& params, const std::string& file_path) {
11981198
{
11991199
std::ofstream out_file{file_path, std::ios::binary};
@@ -1208,7 +1208,7 @@ databento::FileBento Historical::TimeseriesGetRangeToFile(
12081208
return true;
12091209
});
12101210
} // close out_file
1211-
return FileBento{file_path};
1211+
return DbnFileStore{file_path};
12121212
}
12131213

12141214
using databento::HistoricalBuilder;

test/src/historical_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
#include "databento/constants.hpp"
1313
#include "databento/datetime.hpp"
1414
#include "databento/dbn.hpp"
15+
#include "databento/dbn_file_store.hpp"
1516
#include "databento/enums.hpp"
1617
#include "databento/exceptions.hpp" // Exception
17-
#include "databento/file_bento.hpp"
1818
#include "databento/historical.hpp"
1919
#include "databento/metadata.hpp"
2020
#include "databento/record.hpp"
@@ -819,7 +819,7 @@ TEST_F(HistoricalTests, TestTimeseriesGetRangeToFile) {
819819
"2022-10-21T20:00", {"CYZ2"}, Schema::Tbbo,
820820
temp_file.Path());
821821
// running it a second time should overwrite previous data
822-
FileBento bento = target.TimeseriesGetRangeToFile(
822+
DbnFileStore bento = target.TimeseriesGetRangeToFile(
823823
dataset::kGlbxMdp3, "2022-10-21T13:30", "2022-10-21T20:00", {"CYZ2"},
824824
Schema::Tbbo, temp_file.Path());
825825
std::size_t counter{};

0 commit comments

Comments
 (0)