Skip to content

Commit

Permalink
clang format files under include/ (#10850)
Browse files Browse the repository at this point in the history
Summary:
Run clang-format against files under include/

Pull Request resolved: facebook/rocksdb#10850

Test Plan: Watch existing CI to pass.

Reviewed By: ajkr

Differential Revision: D40646158

fbshipit-source-id: 8ce04b107c837630f4000a478d0c871577090263
  • Loading branch information
siying authored and facebook-github-bot committed Oct 24, 2022
1 parent deb6a24 commit b0d9776
Show file tree
Hide file tree
Showing 22 changed files with 212 additions and 199 deletions.
8 changes: 4 additions & 4 deletions include/rocksdb/advanced_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,10 @@ enum class CacheTier : uint8_t {
kNonVolatileBlockTier = 0x01,
};

enum UpdateStatus { // Return status For inplace update callback
UPDATE_FAILED = 0, // Nothing to update
UPDATED_INPLACE = 1, // Value updated inplace
UPDATED = 2, // No inplace update. Merged value set
enum UpdateStatus { // Return status For inplace update callback
UPDATE_FAILED = 0, // Nothing to update
UPDATED_INPLACE = 1, // Value updated inplace
UPDATED = 2, // No inplace update. Merged value set
};

enum class PrepopulateBlobCache : uint8_t {
Expand Down
333 changes: 166 additions & 167 deletions include/rocksdb/c.h

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions include/rocksdb/compaction_job_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#pragma once
#include <stddef.h>
#include <stdint.h>

#include <string>

#include "rocksdb/rocksdb_namespace.h"
Expand Down
1 change: 0 additions & 1 deletion include/rocksdb/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ class DB {
const std::vector<ColumnFamilyDescriptor>& column_families,
std::vector<ColumnFamilyHandle*>* handles, DB** dbptr);


// Open DB and run the compaction.
// It's a read-only operation, the result won't be installed to the DB, it
// will be output to the `output_directory`. The API should only be used with
Expand Down
24 changes: 12 additions & 12 deletions include/rocksdb/file_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,7 @@ class FileSystem : public Customizable {
// The returned file may be concurrently accessed by multiple threads.
virtual IOStatus NewRandomAccessFile(
const std::string& fname, const FileOptions& file_opts,
std::unique_ptr<FSRandomAccessFile>* result,
IODebugContext* dbg) = 0;
std::unique_ptr<FSRandomAccessFile>* result, IODebugContext* dbg) = 0;
// These values match Linux definition
// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/fcntl.h#n56
enum WriteLifeTimeHint {
Expand Down Expand Up @@ -497,7 +496,8 @@ class FileSystem : public Customizable {
virtual IOStatus Truncate(const std::string& /*fname*/, size_t /*size*/,
const IOOptions& /*options*/,
IODebugContext* /*dbg*/) {
return IOStatus::NotSupported("Truncate is not supported for this FileSystem");
return IOStatus::NotSupported(
"Truncate is not supported for this FileSystem");
}

// Create the specified directory. Returns error if directory exists.
Expand Down Expand Up @@ -534,7 +534,8 @@ class FileSystem : public Customizable {
const std::string& /*target*/,
const IOOptions& /*options*/,
IODebugContext* /*dbg*/) {
return IOStatus::NotSupported("LinkFile is not supported for this FileSystem");
return IOStatus::NotSupported(
"LinkFile is not supported for this FileSystem");
}

virtual IOStatus NumFileLinks(const std::string& /*fname*/,
Expand All @@ -548,7 +549,8 @@ class FileSystem : public Customizable {
const std::string& /*second*/,
const IOOptions& /*options*/, bool* /*res*/,
IODebugContext* /*dbg*/) {
return IOStatus::NotSupported("AreFilesSame is not supported for this FileSystem");
return IOStatus::NotSupported(
"AreFilesSame is not supported for this FileSystem");
}

// Lock the specified file. Used to prevent concurrent access to
Expand Down Expand Up @@ -612,7 +614,7 @@ class FileSystem : public Customizable {
// the FileOptions in the parameters, but is optimized for writing log files.
// Default implementation returns the copy of the same object.
virtual FileOptions OptimizeForLogWrite(const FileOptions& file_options,
const DBOptions& db_options) const;
const DBOptions& db_options) const;

// OptimizeForManifestWrite will create a new FileOptions object that is a
// copy of the FileOptions in the parameters, but is optimized for writing
Expand Down Expand Up @@ -1328,8 +1330,7 @@ class FileSystemWrapper : public FileSystem {
FileSystem* target() const { return target_.get(); }

// The following text is boilerplate that forwards all methods to target()
IOStatus NewSequentialFile(const std::string& f,
const FileOptions& file_opts,
IOStatus NewSequentialFile(const std::string& f, const FileOptions& file_opts,
std::unique_ptr<FSSequentialFile>* r,
IODebugContext* dbg) override {
return target_->NewSequentialFile(f, file_opts, r, dbg);
Expand All @@ -1356,8 +1357,7 @@ class FileSystemWrapper : public FileSystem {
const FileOptions& file_opts,
std::unique_ptr<FSWritableFile>* r,
IODebugContext* dbg) override {
return target_->ReuseWritableFile(fname, old_fname, file_opts, r,
dbg);
return target_->ReuseWritableFile(fname, old_fname, file_opts, r, dbg);
}
IOStatus NewRandomRWFile(const std::string& fname,
const FileOptions& file_opts,
Expand Down Expand Up @@ -1474,15 +1474,15 @@ class FileSystemWrapper : public FileSystem {
}

FileOptions OptimizeForLogRead(
const FileOptions& file_options) const override {
const FileOptions& file_options) const override {
return target_->OptimizeForLogRead(file_options);
}
FileOptions OptimizeForManifestRead(
const FileOptions& file_options) const override {
return target_->OptimizeForManifestRead(file_options);
}
FileOptions OptimizeForLogWrite(const FileOptions& file_options,
const DBOptions& db_options) const override {
const DBOptions& db_options) const override {
return target_->OptimizeForLogWrite(file_options, db_options);
}
FileOptions OptimizeForManifestWrite(
Expand Down
2 changes: 2 additions & 0 deletions include/rocksdb/io_status.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
#pragma once

#include <string>

#include "rocksdb/slice.h"
#ifdef OS_WIN
#include <string.h>
#endif
#include <cstring>

#include "status.h"

namespace ROCKSDB_NAMESPACE {
Expand Down
1 change: 1 addition & 0 deletions include/rocksdb/iostats_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#pragma once

#include <stdint.h>

#include <string>

#include "rocksdb/perf_level.h"
Expand Down
1 change: 1 addition & 0 deletions include/rocksdb/ldb_tool.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#ifndef ROCKSDB_LITE
#include <string>
#include <vector>

#include "rocksdb/db.h"
#include "rocksdb/options.h"

Expand Down
3 changes: 2 additions & 1 deletion include/rocksdb/perf_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#pragma once

#include <stdint.h>

#include <map>
#include <string>

Expand Down Expand Up @@ -68,7 +69,7 @@ struct PerfContext {
uint64_t block_read_count; // total number of block reads (with IO)
uint64_t block_read_byte; // total number of bytes from block reads
uint64_t block_read_time; // total nanos spent on block reads
uint64_t block_cache_index_hit_count; // total number of index block hits
uint64_t block_cache_index_hit_count; // total number of index block hits
// total number of standalone handles lookup from secondary cache
uint64_t block_cache_standalone_handle_count;
// total number of real handles lookup from secondary cache that are inserted
Expand Down
1 change: 1 addition & 0 deletions include/rocksdb/perf_level.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#pragma once

#include <stdint.h>

#include <string>

#include "rocksdb/rocksdb_namespace.h"
Expand Down
1 change: 1 addition & 0 deletions include/rocksdb/persistent_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#pragma once

#include <stdint.h>

#include <memory>
#include <string>

Expand Down
6 changes: 3 additions & 3 deletions include/rocksdb/sst_file_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ struct ExternalSstFileInfo {
std::string largest_range_del_key; // largest range deletion user key in file
std::string file_checksum; // sst file checksum;
std::string file_checksum_func_name; // The name of file checksum function
SequenceNumber sequence_number; // sequence number of all keys in file
uint64_t file_size; // file size in bytes
uint64_t num_entries; // number of entries in file
SequenceNumber sequence_number; // sequence number of all keys in file
uint64_t file_size; // file size in bytes
uint64_t num_entries; // number of entries in file
uint64_t num_range_del_entries; // number of range deletion entries in file
int32_t version; // file version
};
Expand Down
1 change: 1 addition & 0 deletions include/rocksdb/transaction_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <memory>
#include <vector>

#include "rocksdb/status.h"
#include "rocksdb/types.h"
#include "rocksdb/write_batch.h"
Expand Down
1 change: 1 addition & 0 deletions include/rocksdb/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#pragma once

#include <stdint.h>

#include "rocksdb/slice.h"

namespace ROCKSDB_NAMESPACE {
Expand Down
1 change: 1 addition & 0 deletions include/rocksdb/utilities/checkpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <string>
#include <vector>

#include "rocksdb/status.h"

namespace ROCKSDB_NAMESPACE {
Expand Down
1 change: 1 addition & 0 deletions include/rocksdb/utilities/env_mirror.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <algorithm>
#include <iostream>
#include <vector>

#include "rocksdb/env.h"

namespace ROCKSDB_NAMESPACE {
Expand Down
1 change: 1 addition & 0 deletions include/rocksdb/utilities/option_change_migration.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#pragma once

#include <string>

#include "rocksdb/options.h"
#include "rocksdb/status.h"

Expand Down
8 changes: 4 additions & 4 deletions include/rocksdb/utilities/options_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ enum class OptionTypeFlags : uint32_t {
kStringNameOnly = 0x8000, // The option serializes to a name only
};

inline OptionTypeFlags operator|(const OptionTypeFlags &a,
const OptionTypeFlags &b) {
inline OptionTypeFlags operator|(const OptionTypeFlags& a,
const OptionTypeFlags& b) {
return static_cast<OptionTypeFlags>(static_cast<uint32_t>(a) |
static_cast<uint32_t>(b));
}

inline OptionTypeFlags operator&(const OptionTypeFlags &a,
const OptionTypeFlags &b) {
inline OptionTypeFlags operator&(const OptionTypeFlags& a,
const OptionTypeFlags& b) {
return static_cast<OptionTypeFlags>(static_cast<uint32_t>(a) &
static_cast<uint32_t>(b));
}
Expand Down
2 changes: 2 additions & 0 deletions include/rocksdb/utilities/sim_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
#pragma once

#include <stdint.h>

#include <memory>
#include <string>

#include "rocksdb/cache.h"
#include "rocksdb/env.h"
#include "rocksdb/slice.h"
Expand Down
8 changes: 4 additions & 4 deletions include/rocksdb/utilities/stackable_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <map>
#include <memory>
#include <string>

#include "rocksdb/db.h"

#ifdef _WIN32
Expand Down Expand Up @@ -131,8 +132,8 @@ class StackableDB : public DB {
const size_t num_keys, const Slice* keys,
PinnableSlice* values, Status* statuses,
const bool sorted_input = false) override {
return db_->MultiGet(options, column_family, num_keys, keys,
values, statuses, sorted_input);
return db_->MultiGet(options, column_family, num_keys, keys, values,
statuses, sorted_input);
}

using DB::IngestExternalFile;
Expand Down Expand Up @@ -473,8 +474,7 @@ class StackableDB : public DB {
return db_->GetCurrentWalFile(current_log_file);
}

virtual Status GetCreationTimeOfOldestFile(
uint64_t* creation_time) override {
virtual Status GetCreationTimeOfOldestFile(uint64_t* creation_time) override {
return db_->GetCreationTimeOfOldestFile(creation_time);
}

Expand Down
2 changes: 1 addition & 1 deletion include/rocksdb/utilities/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ class Transaction {
PREPARED = 2,
AWAITING_COMMIT = 3,
COMMITTED = 4,
COMMITED = COMMITTED, // old misspelled name
COMMITED = COMMITTED, // old misspelled name
AWAITING_ROLLBACK = 5,
ROLLEDBACK = 6,
LOCKS_STOLEN = 7,
Expand Down
4 changes: 2 additions & 2 deletions include/rocksdb/utilities/transaction_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class TransactionDBMutexFactory;

enum TxnDBWritePolicy {
WRITE_COMMITTED = 0, // write only the committed data
WRITE_PREPARED, // write data after the prepare phase of 2pc
WRITE_UNPREPARED // write data before the prepare phase of 2pc
WRITE_PREPARED, // write data after the prepare phase of 2pc
WRITE_UNPREPARED // write data before the prepare phase of 2pc
};

constexpr uint32_t kInitialMaxDeadlocks = 5;
Expand Down

0 comments on commit b0d9776

Please sign in to comment.