Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
Schema.hpp
1//------------------------------------------------------------------------------
2/*
3 This file is part of clio: https://github.com/XRPLF/clio
4 Copyright (c) 2023, the clio developers.
5
6 Permission to use, copy, modify, and distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#pragma once
21
22#include "data/cassandra/Concepts.hpp"
23#include "data/cassandra/Handle.hpp"
24#include "data/cassandra/Types.hpp"
25#include "util/log/Logger.hpp"
26
27#include <fmt/compile.h>
28
29#include <functional>
30#include <memory>
31#include <string>
32#include <string_view>
33#include <vector>
34
35namespace data::cassandra {
36
45template <SomeSettingsProvider SettingsProviderType>
46[[nodiscard]] std::string inline qualifiedTableName(SettingsProviderType const& provider, std::string_view name)
47{
48 return fmt::format("{}.{}{}", provider.getKeyspace(), provider.getTablePrefix().value_or(""), name);
49}
50
54template <SomeSettingsProvider SettingsProviderType>
55class Schema {
56 util::Logger log_{"Backend"};
57 std::reference_wrapper<SettingsProviderType const> settingsProvider_;
58
59public:
65 explicit Schema(SettingsProviderType const& settingsProvider) : settingsProvider_{std::cref(settingsProvider)}
66 {
67 }
68
69 std::string createKeyspace = [this]() {
70 return fmt::format(
71 R"(
72 CREATE KEYSPACE IF NOT EXISTS {}
73 WITH replication = {{
74 'class': 'SimpleStrategy',
75 'replication_factor': '{}'
76 }}
77 AND durable_writes = True
78 )",
79 settingsProvider_.get().getKeyspace(),
80 settingsProvider_.get().getReplicationFactor()
81 );
82 }();
83
84 // =======================
85 // Schema creation queries
86 // =======================
87
88 std::vector<Statement> createSchema = [this]() {
89 std::vector<Statement> statements;
90
91 statements.emplace_back(fmt::format(
92 R"(
93 CREATE TABLE IF NOT EXISTS {}
94 (
95 key blob,
96 sequence bigint,
97 object blob,
98 PRIMARY KEY (key, sequence)
99 )
100 WITH CLUSTERING ORDER BY (sequence DESC)
101 )",
102 qualifiedTableName(settingsProvider_.get(), "objects")
103 ));
104
105 statements.emplace_back(fmt::format(
106 R"(
107 CREATE TABLE IF NOT EXISTS {}
108 (
109 hash blob PRIMARY KEY,
110 ledger_sequence bigint,
111 date bigint,
112 transaction blob,
113 metadata blob
114 )
115 )",
116 qualifiedTableName(settingsProvider_.get(), "transactions")
117 ));
118
119 statements.emplace_back(fmt::format(
120 R"(
121 CREATE TABLE IF NOT EXISTS {}
122 (
123 ledger_sequence bigint,
124 hash blob,
125 PRIMARY KEY (ledger_sequence, hash)
126 )
127 )",
128 qualifiedTableName(settingsProvider_.get(), "ledger_transactions")
129 ));
130
131 statements.emplace_back(fmt::format(
132 R"(
133 CREATE TABLE IF NOT EXISTS {}
134 (
135 key blob,
136 seq bigint,
137 next blob,
138 PRIMARY KEY (key, seq)
139 )
140 )",
141 qualifiedTableName(settingsProvider_.get(), "successor")
142 ));
143
144 statements.emplace_back(fmt::format(
145 R"(
146 CREATE TABLE IF NOT EXISTS {}
147 (
148 seq bigint,
149 key blob,
150 PRIMARY KEY (seq, key)
151 )
152 )",
153 qualifiedTableName(settingsProvider_.get(), "diff")
154 ));
155
156 statements.emplace_back(fmt::format(
157 R"(
158 CREATE TABLE IF NOT EXISTS {}
159 (
160 account blob,
161 seq_idx tuple<bigint, bigint>,
162 hash blob,
163 PRIMARY KEY (account, seq_idx)
164 )
165 WITH CLUSTERING ORDER BY (seq_idx DESC)
166 )",
167 qualifiedTableName(settingsProvider_.get(), "account_tx")
168 ));
169
170 statements.emplace_back(fmt::format(
171 R"(
172 CREATE TABLE IF NOT EXISTS {}
173 (
174 sequence bigint PRIMARY KEY,
175 header blob
176 )
177 )",
178 qualifiedTableName(settingsProvider_.get(), "ledgers")
179 ));
180
181 statements.emplace_back(fmt::format(
182 R"(
183 CREATE TABLE IF NOT EXISTS {}
184 (
185 hash blob PRIMARY KEY,
186 sequence bigint
187 )
188 )",
189 qualifiedTableName(settingsProvider_.get(), "ledger_hashes")
190 ));
191
192 statements.emplace_back(fmt::format(
193 R"(
194 CREATE TABLE IF NOT EXISTS {}
195 (
196 is_latest boolean PRIMARY KEY,
197 sequence bigint
198 )
199 )",
200 qualifiedTableName(settingsProvider_.get(), "ledger_range")
201 ));
202
203 statements.emplace_back(fmt::format(
204 R"(
205 CREATE TABLE IF NOT EXISTS {}
206 (
207 token_id blob,
208 sequence bigint,
209 owner blob,
210 is_burned boolean,
211 PRIMARY KEY (token_id, sequence)
212 )
213 WITH CLUSTERING ORDER BY (sequence DESC)
214 )",
215 qualifiedTableName(settingsProvider_.get(), "nf_tokens")
216 ));
217
218 statements.emplace_back(fmt::format(
219 R"(
220 CREATE TABLE IF NOT EXISTS {}
221 (
222 issuer blob,
223 taxon bigint,
224 token_id blob,
225 PRIMARY KEY (issuer, taxon, token_id)
226 )
227 WITH CLUSTERING ORDER BY (taxon ASC, token_id ASC)
228 )",
229 qualifiedTableName(settingsProvider_.get(), "issuer_nf_tokens_v2")
230 ));
231
232 statements.emplace_back(fmt::format(
233 R"(
234 CREATE TABLE IF NOT EXISTS {}
235 (
236 token_id blob,
237 sequence bigint,
238 uri blob,
239 PRIMARY KEY (token_id, sequence)
240 )
241 WITH CLUSTERING ORDER BY (sequence DESC)
242 )",
243 qualifiedTableName(settingsProvider_.get(), "nf_token_uris")
244 ));
245
246 statements.emplace_back(fmt::format(
247 R"(
248 CREATE TABLE IF NOT EXISTS {}
249 (
250 token_id blob,
251 seq_idx tuple<bigint, bigint>,
252 hash blob,
253 PRIMARY KEY (token_id, seq_idx)
254 )
255 WITH CLUSTERING ORDER BY (seq_idx DESC)
256 )",
257 qualifiedTableName(settingsProvider_.get(), "nf_token_transactions")
258 ));
259
260 statements.emplace_back(fmt::format(
261 R"(
262 CREATE TABLE IF NOT EXISTS {}
263 (
264 mpt_id blob,
265 holder blob,
266 PRIMARY KEY (mpt_id, holder)
267 )
268 WITH CLUSTERING ORDER BY (holder ASC)
269 )",
270 qualifiedTableName(settingsProvider_.get(), "mp_token_holders")
271 ));
272
273 statements.emplace_back(fmt::format(
274 R"(
275 CREATE TABLE IF NOT EXISTS {}
276 (
277 migrator_name TEXT,
278 status TEXT,
279 PRIMARY KEY (migrator_name)
280 )
281 )",
282 qualifiedTableName(settingsProvider_.get(), "migrator_status")
283 ));
284
285 statements.emplace_back(fmt::format(
286 R"(
287 CREATE TABLE IF NOT EXISTS {}
288 (
289 node_id UUID,
290 message TEXT,
291 PRIMARY KEY (node_id)
292 )
293 WITH default_time_to_live = 2
294 )",
295 qualifiedTableName(settingsProvider_.get(), "nodes_chat")
296 ));
297
298 return statements;
299 }();
300
305 std::reference_wrapper<SettingsProviderType const> settingsProvider_;
306 std::reference_wrapper<Handle const> handle_;
307
308 public:
315 Statements(SettingsProviderType const& settingsProvider, Handle const& handle)
316 : settingsProvider_{settingsProvider}, handle_{std::cref(handle)}
317 {
318 }
319
320 //
321 // Insert queries
322 //
323
324 PreparedStatement insertObject = [this]() {
325 return handle_.get().prepare(fmt::format(
326 R"(
327 INSERT INTO {}
328 (key, sequence, object)
329 VALUES (?, ?, ?)
330 )",
331 qualifiedTableName(settingsProvider_.get(), "objects")
332 ));
333 }();
334
335 PreparedStatement insertTransaction = [this]() {
336 return handle_.get().prepare(fmt::format(
337 R"(
338 INSERT INTO {}
339 (hash, ledger_sequence, date, transaction, metadata)
340 VALUES (?, ?, ?, ?, ?)
341 )",
342 qualifiedTableName(settingsProvider_.get(), "transactions")
343 ));
344 }();
345
346 PreparedStatement insertLedgerTransaction = [this]() {
347 return handle_.get().prepare(fmt::format(
348 R"(
349 INSERT INTO {}
350 (ledger_sequence, hash)
351 VALUES (?, ?)
352 )",
353 qualifiedTableName(settingsProvider_.get(), "ledger_transactions")
354 ));
355 }();
356
357 PreparedStatement insertSuccessor = [this]() {
358 return handle_.get().prepare(fmt::format(
359 R"(
360 INSERT INTO {}
361 (key, seq, next)
362 VALUES (?, ?, ?)
363 )",
364 qualifiedTableName(settingsProvider_.get(), "successor")
365 ));
366 }();
367
368 PreparedStatement insertDiff = [this]() {
369 return handle_.get().prepare(fmt::format(
370 R"(
371 INSERT INTO {}
372 (seq, key)
373 VALUES (?, ?)
374 )",
375 qualifiedTableName(settingsProvider_.get(), "diff")
376 ));
377 }();
378
379 PreparedStatement insertAccountTx = [this]() {
380 return handle_.get().prepare(fmt::format(
381 R"(
382 INSERT INTO {}
383 (account, seq_idx, hash)
384 VALUES (?, ?, ?)
385 )",
386 qualifiedTableName(settingsProvider_.get(), "account_tx")
387 ));
388 }();
389
390 PreparedStatement insertNFT = [this]() {
391 return handle_.get().prepare(fmt::format(
392 R"(
393 INSERT INTO {}
394 (token_id, sequence, owner, is_burned)
395 VALUES (?, ?, ?, ?)
396 )",
397 qualifiedTableName(settingsProvider_.get(), "nf_tokens")
398 ));
399 }();
400
401 PreparedStatement insertIssuerNFT = [this]() {
402 return handle_.get().prepare(fmt::format(
403 R"(
404 INSERT INTO {}
405 (issuer, taxon, token_id)
406 VALUES (?, ?, ?)
407 )",
408 qualifiedTableName(settingsProvider_.get(), "issuer_nf_tokens_v2")
409 ));
410 }();
411
412 PreparedStatement insertNFTURI = [this]() {
413 return handle_.get().prepare(fmt::format(
414 R"(
415 INSERT INTO {}
416 (token_id, sequence, uri)
417 VALUES (?, ?, ?)
418 )",
419 qualifiedTableName(settingsProvider_.get(), "nf_token_uris")
420 ));
421 }();
422
423 PreparedStatement insertNFTTx = [this]() {
424 return handle_.get().prepare(fmt::format(
425 R"(
426 INSERT INTO {}
427 (token_id, seq_idx, hash)
428 VALUES (?, ?, ?)
429 )",
430 qualifiedTableName(settingsProvider_.get(), "nf_token_transactions")
431 ));
432 }();
433
434 PreparedStatement insertMPTHolder = [this]() {
435 return handle_.get().prepare(fmt::format(
436 R"(
437 INSERT INTO {}
438 (mpt_id, holder)
439 VALUES (?, ?)
440 )",
441 qualifiedTableName(settingsProvider_.get(), "mp_token_holders")
442 ));
443 }();
444
445 PreparedStatement insertLedgerHeader = [this]() {
446 return handle_.get().prepare(fmt::format(
447 R"(
448 INSERT INTO {}
449 (sequence, header)
450 VALUES (?, ?)
451 )",
452 qualifiedTableName(settingsProvider_.get(), "ledgers")
453 ));
454 }();
455
456 PreparedStatement insertLedgerHash = [this]() {
457 return handle_.get().prepare(fmt::format(
458 R"(
459 INSERT INTO {}
460 (hash, sequence)
461 VALUES (?, ?)
462 )",
463 qualifiedTableName(settingsProvider_.get(), "ledger_hashes")
464 ));
465 }();
466
467 //
468 // Update (and "delete") queries
469 //
470
471 PreparedStatement updateLedgerRange = [this]() {
472 return handle_.get().prepare(fmt::format(
473 R"(
474 UPDATE {}
475 SET sequence = ?
476 WHERE is_latest = ?
477 IF sequence IN (?, null)
478 )",
479 qualifiedTableName(settingsProvider_.get(), "ledger_range")
480 ));
481 }();
482
483 PreparedStatement deleteLedgerRange = [this]() {
484 return handle_.get().prepare(fmt::format(
485 R"(
486 UPDATE {}
487 SET sequence = ?
488 WHERE is_latest = False
489 )",
490 qualifiedTableName(settingsProvider_.get(), "ledger_range")
491 ));
492 }();
493
494 PreparedStatement insertMigratorStatus = [this]() {
495 return handle_.get().prepare(fmt::format(
496 R"(
497 INSERT INTO {}
498 (migrator_name, status)
499 VALUES (?, ?)
500 )",
501 qualifiedTableName(settingsProvider_.get(), "migrator_status")
502 ));
503 }();
504
505 PreparedStatement updateClioNodeMessage = [this]() {
506 return handle_.get().prepare(fmt::format(
507 R"(
508 UPDATE {}
509 SET message = ?
510 WHERE node_id = ?
511 )",
512 qualifiedTableName(settingsProvider_.get(), "nodes_chat")
513 ));
514 }();
515
516 //
517 // Select queries
518 //
519
520 PreparedStatement selectSuccessor = [this]() {
521 return handle_.get().prepare(fmt::format(
522 R"(
523 SELECT next
524 FROM {}
525 WHERE key = ?
526 AND seq <= ?
527 ORDER BY seq DESC
528 LIMIT 1
529 )",
530 qualifiedTableName(settingsProvider_.get(), "successor")
531 ));
532 }();
533
534 PreparedStatement selectDiff = [this]() {
535 return handle_.get().prepare(fmt::format(
536 R"(
537 SELECT key
538 FROM {}
539 WHERE seq = ?
540 )",
541 qualifiedTableName(settingsProvider_.get(), "diff")
542 ));
543 }();
544
545 PreparedStatement selectObject = [this]() {
546 return handle_.get().prepare(fmt::format(
547 R"(
548 SELECT object, sequence
549 FROM {}
550 WHERE key = ?
551 AND sequence <= ?
552 ORDER BY sequence DESC
553 LIMIT 1
554 )",
555 qualifiedTableName(settingsProvider_.get(), "objects")
556 ));
557 }();
558
559 PreparedStatement selectTransaction = [this]() {
560 return handle_.get().prepare(fmt::format(
561 R"(
562 SELECT transaction, metadata, ledger_sequence, date
563 FROM {}
564 WHERE hash = ?
565 )",
566 qualifiedTableName(settingsProvider_.get(), "transactions")
567 ));
568 }();
569
570 PreparedStatement selectAllTransactionHashesInLedger = [this]() {
571 return handle_.get().prepare(fmt::format(
572 R"(
573 SELECT hash
574 FROM {}
575 WHERE ledger_sequence = ?
576 )",
577 qualifiedTableName(settingsProvider_.get(), "ledger_transactions")
578 ));
579 }();
580
581 PreparedStatement selectLedgerPageKeys = [this]() {
582 return handle_.get().prepare(fmt::format(
583 R"(
584 SELECT key
585 FROM {}
586 WHERE TOKEN(key) >= ?
587 AND sequence <= ?
588 PER PARTITION LIMIT 1
589 LIMIT ?
590 ALLOW FILTERING
591 )",
592 qualifiedTableName(settingsProvider_.get(), "objects")
593 ));
594 }();
595
596 PreparedStatement selectLedgerPage = [this]() {
597 return handle_.get().prepare(fmt::format(
598 R"(
599 SELECT object, key
600 FROM {}
601 WHERE TOKEN(key) >= ?
602 AND sequence <= ?
603 PER PARTITION LIMIT 1
604 LIMIT ?
605 ALLOW FILTERING
606 )",
607 qualifiedTableName(settingsProvider_.get(), "objects")
608 ));
609 }();
610
611 PreparedStatement getToken = [this]() {
612 return handle_.get().prepare(fmt::format(
613 R"(
614 SELECT TOKEN(key)
615 FROM {}
616 WHERE key = ?
617 LIMIT 1
618 )",
619 qualifiedTableName(settingsProvider_.get(), "objects")
620 ));
621 }();
622
623 PreparedStatement selectAccountTx = [this]() {
624 return handle_.get().prepare(fmt::format(
625 R"(
626 SELECT hash, seq_idx
627 FROM {}
628 WHERE account = ?
629 AND seq_idx < ?
630 LIMIT ?
631 )",
632 qualifiedTableName(settingsProvider_.get(), "account_tx")
633 ));
634 }();
635
636 PreparedStatement selectAccountFromBegining = [this]() {
637 return handle_.get().prepare(fmt::format(
638 R"(
639 SELECT account
640 FROM {}
641 WHERE token(account) > 0
642 PER PARTITION LIMIT 1
643 LIMIT ?
644 )",
645 qualifiedTableName(settingsProvider_.get(), "account_tx")
646 ));
647 }();
648
649 PreparedStatement selectAccountFromToken = [this]() {
650 return handle_.get().prepare(fmt::format(
651 R"(
652 SELECT account
653 FROM {}
654 WHERE token(account) > token(?)
655 PER PARTITION LIMIT 1
656 LIMIT ?
657 )",
658 qualifiedTableName(settingsProvider_.get(), "account_tx")
659 ));
660 }();
661
662 PreparedStatement selectAccountTxForward = [this]() {
663 return handle_.get().prepare(fmt::format(
664 R"(
665 SELECT hash, seq_idx
666 FROM {}
667 WHERE account = ?
668 AND seq_idx > ?
669 ORDER BY seq_idx ASC
670 LIMIT ?
671 )",
672 qualifiedTableName(settingsProvider_.get(), "account_tx")
673 ));
674 }();
675
676 PreparedStatement selectNFT = [this]() {
677 return handle_.get().prepare(fmt::format(
678 R"(
679 SELECT sequence, owner, is_burned
680 FROM {}
681 WHERE token_id = ?
682 AND sequence <= ?
683 ORDER BY sequence DESC
684 LIMIT 1
685 )",
686 qualifiedTableName(settingsProvider_.get(), "nf_tokens")
687 ));
688 }();
689
690 PreparedStatement selectNFTURI = [this]() {
691 return handle_.get().prepare(fmt::format(
692 R"(
693 SELECT uri
694 FROM {}
695 WHERE token_id = ?
696 AND sequence <= ?
697 ORDER BY sequence DESC
698 LIMIT 1
699 )",
700 qualifiedTableName(settingsProvider_.get(), "nf_token_uris")
701 ));
702 }();
703
704 PreparedStatement selectNFTTx = [this]() {
705 return handle_.get().prepare(fmt::format(
706 R"(
707 SELECT hash, seq_idx
708 FROM {}
709 WHERE token_id = ?
710 AND seq_idx < ?
711 ORDER BY seq_idx DESC
712 LIMIT ?
713 )",
714 qualifiedTableName(settingsProvider_.get(), "nf_token_transactions")
715 ));
716 }();
717
718 PreparedStatement selectNFTTxForward = [this]() {
719 return handle_.get().prepare(fmt::format(
720 R"(
721 SELECT hash, seq_idx
722 FROM {}
723 WHERE token_id = ?
724 AND seq_idx >= ?
725 ORDER BY seq_idx ASC
726 LIMIT ?
727 )",
728 qualifiedTableName(settingsProvider_.get(), "nf_token_transactions")
729 ));
730 }();
731
732 PreparedStatement selectNFTIDsByIssuer = [this]() {
733 return handle_.get().prepare(fmt::format(
734 R"(
735 SELECT token_id
736 FROM {}
737 WHERE issuer = ?
738 AND (taxon, token_id) > ?
739 ORDER BY taxon ASC, token_id ASC
740 LIMIT ?
741 )",
742 qualifiedTableName(settingsProvider_.get(), "issuer_nf_tokens_v2")
743 ));
744 }();
745
746 PreparedStatement selectNFTIDsByIssuerTaxon = [this]() {
747 return handle_.get().prepare(fmt::format(
748 R"(
749 SELECT token_id
750 FROM {}
751 WHERE issuer = ?
752 AND taxon = ?
753 AND token_id > ?
754 ORDER BY taxon ASC, token_id ASC
755 LIMIT ?
756 )",
757 qualifiedTableName(settingsProvider_.get(), "issuer_nf_tokens_v2")
758 ));
759 }();
760
761 PreparedStatement selectMPTHolders = [this]() {
762 return handle_.get().prepare(fmt::format(
763 R"(
764 SELECT holder
765 FROM {}
766 WHERE mpt_id = ?
767 AND holder > ?
768 ORDER BY holder ASC
769 LIMIT ?
770 )",
771 qualifiedTableName(settingsProvider_.get(), "mp_token_holders")
772 ));
773 }();
774
775 PreparedStatement selectLedgerByHash = [this]() {
776 return handle_.get().prepare(fmt::format(
777 R"(
778 SELECT sequence
779 FROM {}
780 WHERE hash = ?
781 LIMIT 1
782 )",
783 qualifiedTableName(settingsProvider_.get(), "ledger_hashes")
784 ));
785 }();
786
787 PreparedStatement selectLedgerBySeq = [this]() {
788 return handle_.get().prepare(fmt::format(
789 R"(
790 SELECT header
791 FROM {}
792 WHERE sequence = ?
793 )",
794 qualifiedTableName(settingsProvider_.get(), "ledgers")
795 ));
796 }();
797
798 PreparedStatement selectLatestLedger = [this]() {
799 return handle_.get().prepare(fmt::format(
800 R"(
801 SELECT sequence
802 FROM {}
803 WHERE is_latest = True
804 )",
805 qualifiedTableName(settingsProvider_.get(), "ledger_range")
806 ));
807 }();
808
809 PreparedStatement selectLedgerRange = [this]() {
810 return handle_.get().prepare(fmt::format(
811 R"(
812 SELECT sequence
813 FROM {}
814 WHERE is_latest in (True, False)
815 )",
816 qualifiedTableName(settingsProvider_.get(), "ledger_range")
817 ));
818 }();
819
820 PreparedStatement selectMigratorStatus = [this]() {
821 return handle_.get().prepare(fmt::format(
822 R"(
823 SELECT status
824 FROM {}
825 WHERE migrator_name = ?
826 )",
827 qualifiedTableName(settingsProvider_.get(), "migrator_status")
828 ));
829 }();
830
831 PreparedStatement selectClioNodesData = [this]() {
832 return handle_.get().prepare(fmt::format(
833 R"(
834 SELECT node_id, message
835 FROM {}
836 )",
837 qualifiedTableName(settingsProvider_.get(), "nodes_chat")
838 ));
839 }();
840 };
841
847 void
849 {
850 LOG(log_.info()) << "Preparing cassandra statements";
851 statements_ = std::make_unique<Statements>(settingsProvider_, handle);
852 LOG(log_.info()) << "Finished preparing statements";
853 }
854
860 std::unique_ptr<Statements> const&
862 {
863 return statements_;
864 }
865
866private:
867 std::unique_ptr<Statements> statements_{nullptr};
868};
869
870} // namespace data::cassandra
Represents a handle to the cassandra database cluster.
Definition Handle.hpp:46
Prepared statements holder.
Definition Schema.hpp:304
Statements(SettingsProviderType const &settingsProvider, Handle const &handle)
Construct a new Statements object.
Definition Schema.hpp:315
Manages the DB schema and provides access to prepared statements.
Definition Schema.hpp:55
Schema(SettingsProviderType const &settingsProvider)
Construct a new Schema object.
Definition Schema.hpp:65
void prepareStatements(Handle const &handle)
Recreates the prepared statements.
Definition Schema.hpp:848
std::unique_ptr< Statements > const & operator->() const
Provides access to statements.
Definition Schema.hpp:861
Represents a prepared statement on the DB side.
Definition Statement.hpp:163
A simple thread-safe logger for the channel specified in the constructor.
Definition Logger.hpp:111
Pump info(SourceLocationType const &loc=CURRENT_SRC_LOCATION) const
Interface for logging at Severity::NFO severity.
Definition Logger.cpp:219
This namespace implements a wrapper for the Cassandra C++ driver.
Definition Concepts.hpp:37
std::string qualifiedTableName(SettingsProviderType const &provider, std::string_view name)
Returns the table name qualified with the keyspace and table prefix.
Definition Schema.hpp:46