Remove extern from function declarations.

External linkage is the default for function declarations in C++.

This also fixes ClangTidy errors generated by removing the "extern"
keyword as described above.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=188730416
This commit is contained in:
costan 2018-03-12 09:14:44 -07:00 committed by Victor Costan
parent ddab751002
commit aece2068d7
20 changed files with 103 additions and 110 deletions

View File

@ -22,7 +22,7 @@ class VersionEdit;
// *meta will be filled with metadata about the generated table. // *meta will be filled with metadata about the generated table.
// If no data is present in *iter, meta->file_size will be set to // If no data is present in *iter, meta->file_size will be set to
// zero, and no Table file will be produced. // zero, and no Table file will be produced.
extern Status BuildTable(const std::string& dbname, Status BuildTable(const std::string& dbname,
Env* env, Env* env,
const Options& options, const Options& options,
TableCache* table_cache, TableCache* table_cache,

View File

@ -201,7 +201,7 @@ class DBImpl : public DB {
// Sanitize db options. The caller should delete result.info_log if // Sanitize db options. The caller should delete result.info_log if
// it is not equal to src.info_log. // it is not equal to src.info_log.
extern Options SanitizeOptions(const std::string& db, Options SanitizeOptions(const std::string& db,
const InternalKeyComparator* icmp, const InternalKeyComparator* icmp,
const InternalFilterPolicy* ipolicy, const InternalFilterPolicy* ipolicy,
const Options& src); const Options& src);

View File

@ -16,8 +16,7 @@ class DBImpl;
// Return a new iterator that converts internal keys (yielded by // Return a new iterator that converts internal keys (yielded by
// "*internal_iter") that were live at the specified "sequence" number // "*internal_iter") that were live at the specified "sequence" number
// into appropriate user keys. // into appropriate user keys.
extern Iterator* NewDBIterator( Iterator* NewDBIterator(DBImpl* db,
DBImpl* db,
const Comparator* user_key_comparator, const Comparator* user_key_comparator,
Iterator* internal_iter, Iterator* internal_iter,
SequenceNumber sequence, SequenceNumber sequence,

View File

@ -84,15 +84,13 @@ inline size_t InternalKeyEncodingLength(const ParsedInternalKey& key) {
} }
// Append the serialization of "key" to *result. // Append the serialization of "key" to *result.
extern void AppendInternalKey(std::string* result, void AppendInternalKey(std::string* result, const ParsedInternalKey& key);
const ParsedInternalKey& key);
// Attempt to parse an internal key from "internal_key". On success, // Attempt to parse an internal key from "internal_key". On success,
// stores the parsed data in "*result", and returns true. // stores the parsed data in "*result", and returns true.
// //
// On error, returns false, leaves "*result" in an undefined state. // On error, returns false, leaves "*result" in an undefined state.
extern bool ParseInternalKey(const Slice& internal_key, bool ParseInternalKey(const Slice& internal_key, ParsedInternalKey* result);
ParsedInternalKey* result);
// Returns the user key portion of an internal key. // Returns the user key portion of an internal key.
inline Slice ExtractUserKey(const Slice& internal_key) { inline Slice ExtractUserKey(const Slice& internal_key) {

View File

@ -12,31 +12,31 @@
namespace leveldb { namespace leveldb {
// A utility routine: write "data" to the named file and Sync() it. // A utility routine: write "data" to the named file and Sync() it.
extern Status WriteStringToFileSync(Env* env, const Slice& data, Status WriteStringToFileSync(Env* env, const Slice& data,
const std::string& fname); const std::string& fname);
static std::string MakeFileName(const std::string& name, uint64_t number, static std::string MakeFileName(const std::string& dbname, uint64_t number,
const char* suffix) { const char* suffix) {
char buf[100]; char buf[100];
snprintf(buf, sizeof(buf), "/%06llu.%s", snprintf(buf, sizeof(buf), "/%06llu.%s",
static_cast<unsigned long long>(number), static_cast<unsigned long long>(number),
suffix); suffix);
return name + buf; return dbname + buf;
} }
std::string LogFileName(const std::string& name, uint64_t number) { std::string LogFileName(const std::string& dbname, uint64_t number) {
assert(number > 0); assert(number > 0);
return MakeFileName(name, number, "log"); return MakeFileName(dbname, number, "log");
} }
std::string TableFileName(const std::string& name, uint64_t number) { std::string TableFileName(const std::string& dbname, uint64_t number) {
assert(number > 0); assert(number > 0);
return MakeFileName(name, number, "ldb"); return MakeFileName(dbname, number, "ldb");
} }
std::string SSTTableFileName(const std::string& name, uint64_t number) { std::string SSTTableFileName(const std::string& dbname, uint64_t number) {
assert(number > 0); assert(number > 0);
return MakeFileName(name, number, "sst"); return MakeFileName(dbname, number, "sst");
} }
std::string DescriptorFileName(const std::string& dbname, uint64_t number) { std::string DescriptorFileName(const std::string& dbname, uint64_t number) {
@ -77,10 +77,10 @@ std::string OldInfoLogFileName(const std::string& dbname) {
// dbname/LOG.old // dbname/LOG.old
// dbname/MANIFEST-[0-9]+ // dbname/MANIFEST-[0-9]+
// dbname/[0-9]+.(log|sst|ldb) // dbname/[0-9]+.(log|sst|ldb)
bool ParseFileName(const std::string& fname, bool ParseFileName(const std::string& filename,
uint64_t* number, uint64_t* number,
FileType* type) { FileType* type) {
Slice rest(fname); Slice rest(filename);
if (rest == "CURRENT") { if (rest == "CURRENT") {
*number = 0; *number = 0;
*type = kCurrentFile; *type = kCurrentFile;

View File

@ -30,56 +30,54 @@ enum FileType {
// Return the name of the log file with the specified number // Return the name of the log file with the specified number
// in the db named by "dbname". The result will be prefixed with // in the db named by "dbname". The result will be prefixed with
// "dbname". // "dbname".
extern std::string LogFileName(const std::string& dbname, uint64_t number); std::string LogFileName(const std::string& dbname, uint64_t number);
// Return the name of the sstable with the specified number // Return the name of the sstable with the specified number
// in the db named by "dbname". The result will be prefixed with // in the db named by "dbname". The result will be prefixed with
// "dbname". // "dbname".
extern std::string TableFileName(const std::string& dbname, uint64_t number); std::string TableFileName(const std::string& dbname, uint64_t number);
// Return the legacy file name for an sstable with the specified number // Return the legacy file name for an sstable with the specified number
// in the db named by "dbname". The result will be prefixed with // in the db named by "dbname". The result will be prefixed with
// "dbname". // "dbname".
extern std::string SSTTableFileName(const std::string& dbname, uint64_t number); std::string SSTTableFileName(const std::string& dbname, uint64_t number);
// Return the name of the descriptor file for the db named by // Return the name of the descriptor file for the db named by
// "dbname" and the specified incarnation number. The result will be // "dbname" and the specified incarnation number. The result will be
// prefixed with "dbname". // prefixed with "dbname".
extern std::string DescriptorFileName(const std::string& dbname, std::string DescriptorFileName(const std::string& dbname, uint64_t number);
uint64_t number);
// Return the name of the current file. This file contains the name // Return the name of the current file. This file contains the name
// of the current manifest file. The result will be prefixed with // of the current manifest file. The result will be prefixed with
// "dbname". // "dbname".
extern std::string CurrentFileName(const std::string& dbname); std::string CurrentFileName(const std::string& dbname);
// Return the name of the lock file for the db named by // Return the name of the lock file for the db named by
// "dbname". The result will be prefixed with "dbname". // "dbname". The result will be prefixed with "dbname".
extern std::string LockFileName(const std::string& dbname); std::string LockFileName(const std::string& dbname);
// Return the name of a temporary file owned by the db named "dbname". // Return the name of a temporary file owned by the db named "dbname".
// The result will be prefixed with "dbname". // The result will be prefixed with "dbname".
extern std::string TempFileName(const std::string& dbname, uint64_t number); std::string TempFileName(const std::string& dbname, uint64_t number);
// Return the name of the info log file for "dbname". // Return the name of the info log file for "dbname".
extern std::string InfoLogFileName(const std::string& dbname); std::string InfoLogFileName(const std::string& dbname);
// Return the name of the old info log file for "dbname". // Return the name of the old info log file for "dbname".
extern std::string OldInfoLogFileName(const std::string& dbname); std::string OldInfoLogFileName(const std::string& dbname);
// If filename is a leveldb file, store the type of the file in *type. // If filename is a leveldb file, store the type of the file in *type.
// The number encoded in the filename is stored in *number. If the // The number encoded in the filename is stored in *number. If the
// filename was successfully parsed, returns true. Else return false. // filename was successfully parsed, returns true. Else return false.
extern bool ParseFileName(const std::string& filename, bool ParseFileName(const std::string& filename,
uint64_t* number, uint64_t* number,
FileType* type); FileType* type);
// Make the CURRENT file point to the descriptor file with the // Make the CURRENT file point to the descriptor file with the
// specified number. // specified number.
extern Status SetCurrentFile(Env* env, const std::string& dbname, Status SetCurrentFile(Env* env, const std::string& dbname,
uint64_t descriptor_number); uint64_t descriptor_number);
} // namespace leveldb } // namespace leveldb
#endif // STORAGE_LEVELDB_DB_FILENAME_H_ #endif // STORAGE_LEVELDB_DB_FILENAME_H_

View File

@ -39,7 +39,7 @@ class WritableFile;
// Return the smallest index i such that files[i]->largest >= key. // Return the smallest index i such that files[i]->largest >= key.
// Return files.size() if there is no such file. // Return files.size() if there is no such file.
// REQUIRES: "files" contains a sorted list of non-overlapping files. // REQUIRES: "files" contains a sorted list of non-overlapping files.
extern int FindFile(const InternalKeyComparator& icmp, int FindFile(const InternalKeyComparator& icmp,
const std::vector<FileMetaData*>& files, const std::vector<FileMetaData*>& files,
const Slice& key); const Slice& key);
@ -49,8 +49,7 @@ extern int FindFile(const InternalKeyComparator& icmp,
// largest==NULL represents a key largest than all keys in the DB. // largest==NULL represents a key largest than all keys in the DB.
// REQUIRES: If disjoint_sorted_files, files[] contains disjoint ranges // REQUIRES: If disjoint_sorted_files, files[] contains disjoint ranges
// in sorted order. // in sorted order.
extern bool SomeFileOverlapsRange( bool SomeFileOverlapsRange(const InternalKeyComparator& icmp,
const InternalKeyComparator& icmp,
bool disjoint_sorted_files, bool disjoint_sorted_files,
const std::vector<FileMetaData*>& files, const std::vector<FileMetaData*>& files,
const Slice* smallest_user_key, const Slice* smallest_user_key,

View File

@ -271,7 +271,7 @@ class LEVELDB_EXPORT FileLock {
}; };
// Log the specified data to *info_log if info_log is non-NULL. // Log the specified data to *info_log if info_log is non-NULL.
extern void Log(Logger* info_log, const char* format, ...) void Log(Logger* info_log, const char* format, ...)
# if defined(__GNUC__) || defined(__clang__) # if defined(__GNUC__) || defined(__clang__)
__attribute__((__format__ (__printf__, 2, 3))) __attribute__((__format__ (__printf__, 2, 3)))
# endif # endif

View File

@ -70,7 +70,7 @@ class CondVar {
// port::InitOnce(&init_control, &Initializer); // port::InitOnce(&init_control, &Initializer);
typedef intptr_t OnceType; typedef intptr_t OnceType;
#define LEVELDB_ONCE_INIT 0 #define LEVELDB_ONCE_INIT 0
extern void InitOnce(port::OnceType*, void (*initializer)()); void InitOnce(port::OnceType*, void (*initializer)());
// A type that holds a pointer that can be read or written atomically // A type that holds a pointer that can be read or written atomically
// (i.e., without word-tearing.) // (i.e., without word-tearing.)
@ -105,13 +105,13 @@ class AtomicPointer {
// Store the snappy compression of "input[0,input_length-1]" in *output. // Store the snappy compression of "input[0,input_length-1]" in *output.
// Returns false if snappy is not supported by this port. // Returns false if snappy is not supported by this port.
extern bool Snappy_Compress(const char* input, size_t input_length, bool Snappy_Compress(const char* input, size_t input_length,
std::string* output); std::string* output);
// If input[0,input_length-1] looks like a valid snappy compressed // If input[0,input_length-1] looks like a valid snappy compressed
// buffer, store the size of the uncompressed data in *result and // buffer, store the size of the uncompressed data in *result and
// return true. Else return false. // return true. Else return false.
extern bool Snappy_GetUncompressedLength(const char* input, size_t length, bool Snappy_GetUncompressedLength(const char* input, size_t length,
size_t* result); size_t* result);
// Attempt to snappy uncompress input[0,input_length-1] into *output. // Attempt to snappy uncompress input[0,input_length-1] into *output.
@ -121,7 +121,7 @@ extern bool Snappy_GetUncompressedLength(const char* input, size_t length,
// REQUIRES: at least the first "n" bytes of output[] must be writable // REQUIRES: at least the first "n" bytes of output[] must be writable
// where "n" is the result of a successful call to // where "n" is the result of a successful call to
// Snappy_GetUncompressedLength. // Snappy_GetUncompressedLength.
extern bool Snappy_Uncompress(const char* input_data, size_t input_length, bool Snappy_Uncompress(const char* input_data, size_t input_length,
char* output); char* output);
// ------------------ Miscellaneous ------------------- // ------------------ Miscellaneous -------------------
@ -129,7 +129,7 @@ extern bool Snappy_Uncompress(const char* input_data, size_t input_length,
// If heap profiling is not supported, returns false. // If heap profiling is not supported, returns false.
// Else repeatedly calls (*func)(arg, data, n) and then returns true. // Else repeatedly calls (*func)(arg, data, n) and then returns true.
// The concatenation of all "data[0,n-1]" fragments is the heap profile. // The concatenation of all "data[0,n-1]" fragments is the heap profile.
extern bool GetHeapProfile(void (*func)(void*, const char*, int), void* arg); bool GetHeapProfile(void (*func)(void*, const char*, int), void* arg);
// Extend the CRC to include the first n bytes of buf. // Extend the CRC to include the first n bytes of buf.
// //

View File

@ -106,7 +106,7 @@ class CondVar {
typedef pthread_once_t OnceType; typedef pthread_once_t OnceType;
#define LEVELDB_ONCE_INIT PTHREAD_ONCE_INIT #define LEVELDB_ONCE_INIT PTHREAD_ONCE_INIT
extern void InitOnce(OnceType* once, void (*initializer)()); void InitOnce(OnceType* once, void (*initializer)());
inline bool Snappy_Compress(const char* input, size_t length, inline bool Snappy_Compress(const char* input, size_t length,
::std::string* output) { ::std::string* output) {

View File

@ -91,7 +91,7 @@ struct BlockContents {
// Read the block identified by "handle" from "file". On failure // Read the block identified by "handle" from "file". On failure
// return non-OK. On success fill *result and return OK. // return non-OK. On success fill *result and return OK.
extern Status ReadBlock(RandomAccessFile* file, Status ReadBlock(RandomAccessFile* file,
const ReadOptions& options, const ReadOptions& options,
const BlockHandle& handle, const BlockHandle& handle,
BlockContents* result); BlockContents* result);

View File

@ -18,7 +18,7 @@ class Iterator;
// key is present in K child iterators, it will be yielded K times. // key is present in K child iterators, it will be yielded K times.
// //
// REQUIRES: n >= 0 // REQUIRES: n >= 0
extern Iterator* NewMergingIterator( Iterator* NewMergingIterator(
const Comparator* comparator, Iterator** children, int n); const Comparator* comparator, Iterator** children, int n);
} // namespace leveldb } // namespace leveldb

View File

@ -20,7 +20,7 @@ struct ReadOptions;
// //
// Uses a supplied function to convert an index_iter value into // Uses a supplied function to convert an index_iter value into
// an iterator over the contents of the corresponding block. // an iterator over the contents of the corresponding block.
extern Iterator* NewTwoLevelIterator( Iterator* NewTwoLevelIterator(
Iterator* index_iter, Iterator* index_iter,
Iterator* (*block_function)( Iterator* (*block_function)(
void* arg, void* arg,

View File

@ -19,38 +19,38 @@
namespace leveldb { namespace leveldb {
// Standard Put... routines append to a string // Standard Put... routines append to a string
extern void PutFixed32(std::string* dst, uint32_t value); void PutFixed32(std::string* dst, uint32_t value);
extern void PutFixed64(std::string* dst, uint64_t value); void PutFixed64(std::string* dst, uint64_t value);
extern void PutVarint32(std::string* dst, uint32_t value); void PutVarint32(std::string* dst, uint32_t value);
extern void PutVarint64(std::string* dst, uint64_t value); void PutVarint64(std::string* dst, uint64_t value);
extern void PutLengthPrefixedSlice(std::string* dst, const Slice& value); void PutLengthPrefixedSlice(std::string* dst, const Slice& value);
// Standard Get... routines parse a value from the beginning of a Slice // Standard Get... routines parse a value from the beginning of a Slice
// and advance the slice past the parsed value. // and advance the slice past the parsed value.
extern bool GetVarint32(Slice* input, uint32_t* value); bool GetVarint32(Slice* input, uint32_t* value);
extern bool GetVarint64(Slice* input, uint64_t* value); bool GetVarint64(Slice* input, uint64_t* value);
extern bool GetLengthPrefixedSlice(Slice* input, Slice* result); bool GetLengthPrefixedSlice(Slice* input, Slice* result);
// Pointer-based variants of GetVarint... These either store a value // Pointer-based variants of GetVarint... These either store a value
// in *v and return a pointer just past the parsed value, or return // in *v and return a pointer just past the parsed value, or return
// NULL on error. These routines only look at bytes in the range // NULL on error. These routines only look at bytes in the range
// [p..limit-1] // [p..limit-1]
extern const char* GetVarint32Ptr(const char* p,const char* limit, uint32_t* v); const char* GetVarint32Ptr(const char* p,const char* limit, uint32_t* v);
extern const char* GetVarint64Ptr(const char* p,const char* limit, uint64_t* v); const char* GetVarint64Ptr(const char* p,const char* limit, uint64_t* v);
// Returns the length of the varint32 or varint64 encoding of "v" // Returns the length of the varint32 or varint64 encoding of "v"
extern int VarintLength(uint64_t v); int VarintLength(uint64_t v);
// Lower-level versions of Put... that write directly into a character buffer // Lower-level versions of Put... that write directly into a character buffer
// REQUIRES: dst has enough space for the value being written // REQUIRES: dst has enough space for the value being written
extern void EncodeFixed32(char* dst, uint32_t value); void EncodeFixed32(char* dst, uint32_t value);
extern void EncodeFixed64(char* dst, uint64_t value); void EncodeFixed64(char* dst, uint64_t value);
// Lower-level versions of Put... that write directly into a character buffer // Lower-level versions of Put... that write directly into a character buffer
// and return a pointer just past the last byte written. // and return a pointer just past the last byte written.
// REQUIRES: dst has enough space for the value being written // REQUIRES: dst has enough space for the value being written
extern char* EncodeVarint32(char* dst, uint32_t value); char* EncodeVarint32(char* dst, uint32_t value);
extern char* EncodeVarint64(char* dst, uint64_t value); char* EncodeVarint64(char* dst, uint64_t value);
// Lower-level versions of Get... that read directly from a character buffer // Lower-level versions of Get... that read directly from a character buffer
// without any bounds checking. // without any bounds checking.
@ -83,7 +83,7 @@ inline uint64_t DecodeFixed64(const char* ptr) {
} }
// Internal routine for use by fallback path of GetVarint32Ptr // Internal routine for use by fallback path of GetVarint32Ptr
extern const char* GetVarint32PtrFallback(const char* p, const char* GetVarint32PtrFallback(const char* p,
const char* limit, const char* limit,
uint32_t* value); uint32_t* value);
inline const char* GetVarint32Ptr(const char* p, inline const char* GetVarint32Ptr(const char* p,

View File

@ -14,7 +14,7 @@ namespace crc32c {
// Return the crc32c of concat(A, data[0,n-1]) where init_crc is the // Return the crc32c of concat(A, data[0,n-1]) where init_crc is the
// crc32c of some string A. Extend() is often used to maintain the // crc32c of some string A. Extend() is often used to maintain the
// crc32c of a stream of data. // crc32c of a stream of data.
extern uint32_t Extend(uint32_t init_crc, const char* data, size_t n); uint32_t Extend(uint32_t init_crc, const char* data, size_t n);
// Return the crc32c of data[0,n-1] // Return the crc32c of data[0,n-1]
inline uint32_t Value(const char* data, size_t n) { inline uint32_t Value(const char* data, size_t n) {

View File

@ -12,8 +12,8 @@
namespace leveldb { namespace leveldb {
extern uint32_t Hash(const char* data, size_t n, uint32_t seed); uint32_t Hash(const char* data, size_t n, uint32_t seed);
} } // namespace leveldb
#endif // STORAGE_LEVELDB_UTIL_HASH_H_ #endif // STORAGE_LEVELDB_UTIL_HASH_H_

View File

@ -19,24 +19,24 @@ class Slice;
class WritableFile; class WritableFile;
// Append a human-readable printout of "num" to *str // Append a human-readable printout of "num" to *str
extern void AppendNumberTo(std::string* str, uint64_t num); void AppendNumberTo(std::string* str, uint64_t num);
// Append a human-readable printout of "value" to *str. // Append a human-readable printout of "value" to *str.
// Escapes any non-printable characters found in "value". // Escapes any non-printable characters found in "value".
extern void AppendEscapedStringTo(std::string* str, const Slice& value); void AppendEscapedStringTo(std::string* str, const Slice& value);
// Return a human-readable printout of "num" // Return a human-readable printout of "num"
extern std::string NumberToString(uint64_t num); std::string NumberToString(uint64_t num);
// Return a human-readable version of "value". // Return a human-readable version of "value".
// Escapes any non-printable characters found in "value". // Escapes any non-printable characters found in "value".
extern std::string EscapeString(const Slice& value); std::string EscapeString(const Slice& value);
// Parse a human-readable number from "*in" into *value. On success, // Parse a human-readable number from "*in" into *value. On success,
// advances "*in" past the consumed number and sets "*val" to the // advances "*in" past the consumed number and sets "*val" to the
// numeric value. Otherwise, returns false and leaves *in in an // numeric value. Otherwise, returns false and leaves *in in an
// unspecified state. // unspecified state.
extern bool ConsumeDecimalNumber(Slice* in, uint64_t* val); bool ConsumeDecimalNumber(Slice* in, uint64_t* val);
} // namespace leveldb } // namespace leveldb

View File

@ -27,15 +27,15 @@ namespace test {
// //
// Returns 0 if all tests pass. // Returns 0 if all tests pass.
// Dies or returns a non-zero value if some test fails. // Dies or returns a non-zero value if some test fails.
extern int RunAllTests(); int RunAllTests();
// Return the directory to use for temporary storage. // Return the directory to use for temporary storage.
extern std::string TmpDir(); std::string TmpDir();
// Return a randomization seed for this run. Typically returns the // Return a randomization seed for this run. Typically returns the
// same number on repeated invocations of this binary, but automated // same number on repeated invocations of this binary, but automated
// runs may be able to vary the seed. // runs may be able to vary the seed.
extern int RandomSeed(); int RandomSeed();
// An instance of Tester is allocated to hold temporary state during // An instance of Tester is allocated to hold temporary state during
// the execution of an assertion. // the execution of an assertion.
@ -129,8 +129,7 @@ void TCONCAT(_Test_,name)::_Run()
// Register the specified test. Typically not used directly, but // Register the specified test. Typically not used directly, but
// invoked via the macro expansion of TEST. // invoked via the macro expansion of TEST.
extern bool RegisterTest(const char* base, const char* name, void (*func)()); bool RegisterTest(const char* base, const char* name, void (*func)());
} // namespace test } // namespace test
} // namespace leveldb } // namespace leveldb

View File

@ -31,7 +31,7 @@ std::string RandomKey(Random* rnd, int len) {
} }
extern Slice CompressibleString(Random* rnd, double compressed_fraction, Slice CompressibleString(Random* rnd, double compressed_fraction,
size_t len, std::string* dst) { size_t len, std::string* dst) {
int raw = static_cast<int>(len * compressed_fraction); int raw = static_cast<int>(len * compressed_fraction);
if (raw < 1) raw = 1; if (raw < 1) raw = 1;

View File

@ -14,16 +14,16 @@ namespace test {
// Store in *dst a random string of length "len" and return a Slice that // Store in *dst a random string of length "len" and return a Slice that
// references the generated data. // references the generated data.
extern Slice RandomString(Random* rnd, int len, std::string* dst); Slice RandomString(Random* rnd, int len, std::string* dst);
// Return a random key with the specified length that may contain interesting // Return a random key with the specified length that may contain interesting
// characters (e.g. \x00, \xff, etc.). // characters (e.g. \x00, \xff, etc.).
extern std::string RandomKey(Random* rnd, int len); std::string RandomKey(Random* rnd, int len);
// Store in *dst a string of length "len" that will compress to // Store in *dst a string of length "len" that will compress to
// "N*compressed_fraction" bytes and return a Slice that references // "N*compressed_fraction" bytes and return a Slice that references
// the generated data. // the generated data.
extern Slice CompressibleString(Random* rnd, double compressed_fraction, Slice CompressibleString(Random* rnd, double compressed_fraction,
size_t len, std::string* dst); size_t len, std::string* dst);
// A wrapper that allows injection of errors. // A wrapper that allows injection of errors.