mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
updated submodules, bugfixes
- added new fift/func code for validator complaint creation - bugfixes in validator - updates in tonlib - new versions of rocksdb/abseil - hardfork support
This commit is contained in:
parent
16a4566091
commit
9f008b129f
129 changed files with 8438 additions and 879 deletions
|
@ -78,7 +78,18 @@ Result<RocksDb> RocksDb::open(std::string path) {
|
|||
options.bytes_per_sync = 1 << 20;
|
||||
options.writable_file_max_buffer_size = 2 << 14;
|
||||
options.statistics = statistics;
|
||||
TRY_STATUS(from_rocksdb(rocksdb::OptimisticTransactionDB::Open(options, std::move(path), &db)));
|
||||
rocksdb::OptimisticTransactionDBOptions occ_options;
|
||||
occ_options.validate_policy = rocksdb::OccValidationPolicy::kValidateSerial;
|
||||
rocksdb::ColumnFamilyOptions cf_options(options);
|
||||
std::vector<rocksdb::ColumnFamilyDescriptor> column_families;
|
||||
column_families.push_back(rocksdb::ColumnFamilyDescriptor(rocksdb::kDefaultColumnFamilyName, cf_options));
|
||||
std::vector<rocksdb::ColumnFamilyHandle *> handles;
|
||||
TRY_STATUS(from_rocksdb(
|
||||
rocksdb::OptimisticTransactionDB::Open(options, occ_options, std::move(path), column_families, &handles, &db)));
|
||||
CHECK(handles.size() == 1);
|
||||
// i can delete the handle since DBImpl is always holding a reference to
|
||||
// default column family
|
||||
delete handles[0];
|
||||
}
|
||||
return RocksDb(std::shared_ptr<rocksdb::OptimisticTransactionDB>(db), std::move(statistics));
|
||||
}
|
||||
|
@ -161,31 +172,41 @@ Result<size_t> RocksDb::count(Slice prefix) {
|
|||
return res;
|
||||
}
|
||||
|
||||
Status RocksDb::begin_write_batch() {
|
||||
CHECK(!transaction_);
|
||||
write_batch_ = std::make_unique<rocksdb::WriteBatch>();
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
Status RocksDb::begin_transaction() {
|
||||
//write_batch_ = std::make_unique<rocksdb::WriteBatch>();
|
||||
CHECK(!write_batch_);
|
||||
rocksdb::WriteOptions options;
|
||||
options.sync = true;
|
||||
transaction_.reset(db_->BeginTransaction(options, {}));
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
Status RocksDb::commit_transaction() {
|
||||
//CHECK(write_batch_);
|
||||
//auto write_batch = std::move(write_batch_);
|
||||
//rocksdb::WriteOptions options;
|
||||
//options.sync = true;
|
||||
//TRY_STATUS(from_rocksdb(db_->Write(options, write_batch.get())));
|
||||
//return Status::OK();
|
||||
Status RocksDb::commit_write_batch() {
|
||||
CHECK(write_batch_);
|
||||
auto write_batch = std::move(write_batch_);
|
||||
rocksdb::WriteOptions options;
|
||||
options.sync = true;
|
||||
return from_rocksdb(db_->Write(options, write_batch.get()));
|
||||
}
|
||||
|
||||
Status RocksDb::commit_transaction() {
|
||||
CHECK(transaction_);
|
||||
auto res = from_rocksdb(transaction_->Commit());
|
||||
transaction_.reset();
|
||||
return res;
|
||||
auto transaction = std::move(transaction_);
|
||||
return from_rocksdb(transaction->Commit());
|
||||
}
|
||||
|
||||
Status RocksDb::abort_write_batch() {
|
||||
CHECK(write_batch_);
|
||||
write_batch_.reset();
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
Status RocksDb::abort_transaction() {
|
||||
//CHECK(write_batch_);
|
||||
//write_batch_.reset();
|
||||
CHECK(transaction_);
|
||||
transaction_.reset();
|
||||
return Status::OK();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue