write_batch_util.cc 748 B

12345678910111213141516171819202122232425
  1. // Copyright (c) Meta Platforms, Inc. and affiliates.
  2. //
  3. // This source code is licensed under both the GPLv2 (found in the
  4. // COPYING file in the root directory) and Apache 2.0 License
  5. // (found in the LICENSE.Apache file in the root directory).
  6. #include "util/write_batch_util.h"
  7. namespace ROCKSDB_NAMESPACE {
  8. Status CollectColumnFamilyIdsFromWriteBatch(
  9. const WriteBatch& batch, std::vector<uint32_t>* column_family_ids) {
  10. assert(column_family_ids != nullptr);
  11. column_family_ids->clear();
  12. ColumnFamilyCollector handler;
  13. Status s = batch.Iterate(&handler);
  14. if (s.ok()) {
  15. for (const auto& cf : handler.column_families()) {
  16. column_family_ids->push_back(cf);
  17. }
  18. }
  19. return s;
  20. }
  21. } // namespace ROCKSDB_NAMESPACE