turn true; }
private:
bool verbose_;
bool json_;
std::string path_;
static const std::string ARG_VERBOSE;
static const std::string ARG_JSON;
static const std::string ARG_PATH;
};
class
#include <vector>
#include "rocksdb/slice.h"
// We use JSONDocument for DocumentDB API
// Implementation inspired by folly::dynamic, rapidjson and fbson
namespace fbson {
class FbsonValue;
clas
// NOTE: none of this is thread-safe
class JSONDocument {
public:
// return nullptr on parse failure
static JSONDocument* ParseJSON(const char* json);
enum Type {
kNull,
kArray,
/* implicit */ JSONDocument(); // null
/* implicit */ JSONDocument(bool b);
/* implicit */ JSONDocument(double d);
/* implicit */ JSONDocument(int8_t i);
/* implicit */ JSONDocument(int16_t
o>
#include "rocksdb/env.h"
#include "util/log_buffer.h"
namespace rocksdb {
class JSONWriter {
public:
JSONWriter() : state_(kExpectKey), first_element_(true), in_array_(false) {
stream_ <<
tream_.str(); }
JSONWriter& operator<<(const char* val) {
if (state_ == kExpectKey) {
AddKey(val);
} else {
AddValue(val);
}
return *this;
}
JSONWriter& operator<<(
}
template <typename T>
JSONWriter& operator<<(const T& val) {
assert(state_ != kExpectKey);
AddValue(val);
return *this;
}
private:
enum JSONWriterState {
kExpectKey,
gger.h"
namespace rocksdb {
class EventHelpers {
public:
static void AppendCurrentTime(JSONWriter* json_writer);
#ifndef ROCKSDB_LITE
static void NotifyTableFileCreationStarted(
const std
/*
* FbsonToJson converts an FbsonValue object to a JSON string.
*/
class FbsonToJson {
public:
FbsonToJson() : os_(buffer_, OUT_BUF_SIZE) {}
// get json string
const char* json(const FbsonV
0);
if (pval) {
intern_json(pval);
}
os_.put(0);
return os_.getBuffer();
}
private:
// recursively convert FbsonValue
void intern_json(const FbsonValue* val) {
swit
}
case FbsonType::T_Object: {
object_to_json((ObjectVal*)val);
break;
}
case FbsonType::T_Array: {
array_to_json((ArrayVal*)val);
break;
}
default:
tring>
#include <vector>
#include "rocksdb/utilities/stackable_db.h"
#include "rocksdb/utilities/json_document.h"
#include "rocksdb/db.h"
namespace rocksdb {
// IMPORTANT: DocumentDB is a work in p
p of RocksDB that provides a very simple JSON API.
// When creating a DB, you specify a list of indexes you want to keep on your
// data. You can insert a JSON document to the DB, which is automatical
d and is an unique primary key. All other indexes are
// non-unique.
// NOTE: field names in the JSON are NOT allowed to start with '$' or
// contain '.'. We don't currently enforce that rule, but wi
* This file defines FbsonJsonParserT (template) and FbsonJsonParser.
*
* FbsonJsonParserT is a template class which implements a JSON parser.
* FbsonJsonParserT parses JSON text, and serialize it t
o FBSON binary format
* by using FbsonWriterT object. By default, FbsonJsonParserT creates a new
* FbsonWriterT object with an output stream object. However, you can also
* pass in your FbsonWrite
h).
*
* FbsonJsonParser specializes FbsonJsonParserT with FbsonOutStream type (see
* FbsonStream.h). So unless you want to provide own a different output stream
* type, use FbsonJsonParser object.
ptions, std::string& manifestFileName,
bool verbose, bool hex = false, bool json = false);
#endif // ROCKSDB_LITE
// Return the current manifest file number
uint64_t manif