mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-30 04:41:49 +00:00
1e63fc9925
Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/11823 Similarly to https://github.com/facebook/rocksdb/pull/11813, the patch is a small refactoring that eliminates some copy-paste around sorting the columns of entities by column name. Reviewed By: jaykorean Differential Revision: D49195504 fbshipit-source-id: d48c9f290e3203f838cc5949856c469ecf730008
36 lines
1 KiB
C++
36 lines
1 KiB
C++
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
// (found in the LICENSE.Apache file in the root directory).
|
|
|
|
#pragma once
|
|
#include <ostream>
|
|
#include <string>
|
|
|
|
#include "rocksdb/rocksdb_namespace.h"
|
|
#include "rocksdb/wide_columns.h"
|
|
|
|
namespace ROCKSDB_NAMESPACE {
|
|
|
|
class WideColumnsHelper {
|
|
public:
|
|
static void DumpWideColumns(const WideColumns& columns, std::ostream& os,
|
|
bool hex);
|
|
|
|
static Status DumpSliceAsWideColumns(const Slice& value, std::ostream& os,
|
|
bool hex);
|
|
|
|
static bool HasDefaultColumn(const WideColumns& columns) {
|
|
return !columns.empty() && columns.front().name() == kDefaultWideColumnName;
|
|
}
|
|
|
|
static const Slice& GetDefaultColumn(const WideColumns& columns) {
|
|
assert(HasDefaultColumn(columns));
|
|
return columns.front().value();
|
|
}
|
|
|
|
static void SortColumns(WideColumns& columns);
|
|
};
|
|
|
|
} // namespace ROCKSDB_NAMESPACE
|