summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorHaavard <havardpe@yahoo-inc.com>2017-02-03 18:15:54 +0000
committerHaavard <havardpe@yahoo-inc.com>2017-02-03 18:16:48 +0000
commit604b545f86b7c8dd7ade8d96e785f80701f16c58 (patch)
tree159b4858f855b549769cbdac962e0820eeb7fb64 /config
parent777726e51445f567809c1379d53e7da2bb6fa6db (diff)
use new input/output model in slime
Diffstat (limited to 'config')
-rw-r--r--config/src/vespa/config/common/configvalue.cpp2
-rw-r--r--config/src/vespa/config/common/misc.cpp3
-rw-r--r--config/src/vespa/config/common/payload_converter.cpp2
-rw-r--r--config/src/vespa/config/common/payload_converter.h8
-rw-r--r--config/src/vespa/config/common/trace.h4
-rw-r--r--config/src/vespa/config/configgen/map_inserter.h2
-rw-r--r--config/src/vespa/config/configgen/map_inserter.hpp2
-rw-r--r--config/src/vespa/config/frt/frtconfigresponsev3.cpp2
-rw-r--r--config/src/vespa/config/frt/protocol.h62
-rw-r--r--config/src/vespa/config/print/fileconfigformatter.cpp34
-rw-r--r--config/src/vespa/config/print/jsonconfigformatter.cpp6
-rw-r--r--config/src/vespa/config/retriever/configsnapshot.cpp5
12 files changed, 69 insertions, 63 deletions
diff --git a/config/src/vespa/config/common/configvalue.cpp b/config/src/vespa/config/common/configvalue.cpp
index ce6f0a47cbd..de9f3500d5b 100644
--- a/config/src/vespa/config/common/configvalue.cpp
+++ b/config/src/vespa/config/common/configvalue.cpp
@@ -64,7 +64,7 @@ ConfigValue::serializeV1(vespalib::slime::Cursor & cursor) const
// TODO: Remove v1 when we can bump disk format.
std::vector<vespalib::string> lines(getLegacyFormat());
for (size_t i = 0; i < lines.size(); i++) {
- cursor.addString(vespalib::slime::Memory(lines[i]));
+ cursor.addString(vespalib::Memory(lines[i]));
}
}
diff --git a/config/src/vespa/config/common/misc.cpp b/config/src/vespa/config/common/misc.cpp
index 51a6051e20b..071411f170a 100644
--- a/config/src/vespa/config/common/misc.cpp
+++ b/config/src/vespa/config/common/misc.cpp
@@ -5,8 +5,11 @@
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/data/slime/slime.h>
+#include <vespa/vespalib/data/memory.h>
#include "exceptions.h"
+using vespalib::Memory;
+
namespace config {
vespalib::string
diff --git a/config/src/vespa/config/common/payload_converter.cpp b/config/src/vespa/config/common/payload_converter.cpp
index 2f7feb6a1b0..5dc45c12fa3 100644
--- a/config/src/vespa/config/common/payload_converter.cpp
+++ b/config/src/vespa/config/common/payload_converter.cpp
@@ -1,7 +1,9 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "payload_converter.h"
+#include <vespa/vespalib/data/memory.h>
using namespace vespalib::slime;
+using vespalib::Memory;
namespace config {
diff --git a/config/src/vespa/config/common/payload_converter.h b/config/src/vespa/config/common/payload_converter.h
index e53705fc633..3a9d53f4c77 100644
--- a/config/src/vespa/config/common/payload_converter.h
+++ b/config/src/vespa/config/common/payload_converter.h
@@ -15,14 +15,14 @@ class PayloadConverter : public vespalib::slime::ObjectTraverser, public vespali
public:
PayloadConverter(const vespalib::slime::Inspector & inspector);
const std::vector<vespalib::string> & convert();
- void field(const vespalib::slime::Memory & symbol, const vespalib::slime::Inspector & inspector);
+ void field(const vespalib::Memory & symbol, const vespalib::slime::Inspector & inspector);
void entry(size_t idx, const vespalib::slime::Inspector & inspector);
private:
void printPrefix();
void encode(const vespalib::slime::Inspector & inspector);
- void encode(const vespalib::slime::Memory & symbol, const vespalib::slime::Inspector & inspector);
- void encodeObject(const vespalib::slime::Memory & symbol, const vespalib::slime::Inspector & object);
- void encodeArray(const vespalib::slime::Memory & symbol, const vespalib::slime::Inspector & object);
+ void encode(const vespalib::Memory & symbol, const vespalib::slime::Inspector & inspector);
+ void encodeObject(const vespalib::Memory & symbol, const vespalib::slime::Inspector & object);
+ void encodeArray(const vespalib::Memory & symbol, const vespalib::slime::Inspector & object);
void encodeValue(const vespalib::slime::Inspector & value);
void encodeString(const vespalib::string & value);
void encodeQuotedString(const vespalib::string & value);
diff --git a/config/src/vespa/config/common/trace.h b/config/src/vespa/config/common/trace.h
index 268d46d0de6..abbd8c3838a 100644
--- a/config/src/vespa/config/common/trace.h
+++ b/config/src/vespa/config/common/trace.h
@@ -39,8 +39,8 @@ public:
private:
void serializeTraceLog(vespalib::slime::Cursor & array) const;
void deserializeTraceLog(const vespalib::slime::Inspector & inspector);
- static const vespalib::slime::Memory TRACELOG;
- static const vespalib::slime::Memory TRACELEVEL;
+ static const vespalib::Memory TRACELOG;
+ static const vespalib::Memory TRACELEVEL;
vespalib::TraceNode _root;
uint32_t _traceLevel;
const Clock & _clock;
diff --git a/config/src/vespa/config/configgen/map_inserter.h b/config/src/vespa/config/configgen/map_inserter.h
index d03cf4eb6cd..75238df912a 100644
--- a/config/src/vespa/config/configgen/map_inserter.h
+++ b/config/src/vespa/config/configgen/map_inserter.h
@@ -15,7 +15,7 @@ template<typename T, typename Converter = config::internal::ValueConverter<T> >
class MapInserter : public ::vespalib::slime::ObjectTraverser {
public:
MapInserter(std::map<vespalib::string, T> & map);
- void field(const ::vespalib::slime::Memory & symbol, const ::vespalib::slime::Inspector & inspector);
+ void field(const ::vespalib::Memory & symbol, const ::vespalib::slime::Inspector & inspector);
private:
std::map<vespalib::string, T> & _map;
};
diff --git a/config/src/vespa/config/configgen/map_inserter.hpp b/config/src/vespa/config/configgen/map_inserter.hpp
index cf1f7150041..543ae3d7b45 100644
--- a/config/src/vespa/config/configgen/map_inserter.hpp
+++ b/config/src/vespa/config/configgen/map_inserter.hpp
@@ -10,7 +10,7 @@ MapInserter<T, Converter>::MapInserter(std::map<vespalib::string, T> & map)
template<typename T, typename Converter>
void
-MapInserter<T, Converter>::field(const ::vespalib::slime::Memory & symbol, const ::vespalib::slime::Inspector & inspector)
+MapInserter<T, Converter>::field(const ::vespalib::Memory & symbol, const ::vespalib::slime::Inspector & inspector)
{
Converter converter;
_map[symbol.make_string()] = converter(inspector);
diff --git a/config/src/vespa/config/frt/frtconfigresponsev3.cpp b/config/src/vespa/config/frt/frtconfigresponsev3.cpp
index b9550ba0ec4..191b1932bf0 100644
--- a/config/src/vespa/config/frt/frtconfigresponsev3.cpp
+++ b/config/src/vespa/config/frt/frtconfigresponsev3.cpp
@@ -17,7 +17,7 @@ using namespace config::protocol::v3;
namespace config {
std::string make_json(const Slime &slime, bool compact) {
- vespalib::slime::SimpleBuffer buf;
+ vespalib::SimpleBuffer buf;
vespalib::slime::JsonFormat::encode(slime, buf, compact);
return buf.get().make_string();
}
diff --git a/config/src/vespa/config/frt/protocol.h b/config/src/vespa/config/frt/protocol.h
index 6334d78ceea..45d8e15b77f 100644
--- a/config/src/vespa/config/frt/protocol.h
+++ b/config/src/vespa/config/frt/protocol.h
@@ -1,7 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/vespalib/data/slime/memory.h>
+#include <vespa/vespalib/data/memory.h>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/config/common/compressiontype.h>
#include <vespa/vespalib/util/alloc.h>
@@ -29,30 +29,30 @@ struct Payload {
namespace v2 {
-extern const vespalib::slime::Memory REQUEST_VERSION;
-extern const vespalib::slime::Memory REQUEST_DEF_NAME;
-extern const vespalib::slime::Memory REQUEST_DEF_NAMESPACE;
-extern const vespalib::slime::Memory REQUEST_DEF_MD5;
-extern const vespalib::slime::Memory REQUEST_DEF_CONTENT;
-extern const vespalib::slime::Memory REQUEST_CLIENT_CONFIGID;
-extern const vespalib::slime::Memory REQUEST_CLIENT_HOSTNAME;
-extern const vespalib::slime::Memory REQUEST_CONFIG_MD5;
-extern const vespalib::slime::Memory REQUEST_CURRENT_GENERATION;
-extern const vespalib::slime::Memory REQUEST_WANTED_GENERATION;
-extern const vespalib::slime::Memory REQUEST_TIMEOUT;
-extern const vespalib::slime::Memory REQUEST_TRACE;
-extern const vespalib::slime::Memory REQUEST_VESPA_VERSION;
-
-extern const vespalib::slime::Memory RESPONSE_VERSION;
-extern const vespalib::slime::Memory RESPONSE_DEF_NAME;
-extern const vespalib::slime::Memory RESPONSE_DEF_NAMESPACE;
-extern const vespalib::slime::Memory RESPONSE_DEF_MD5;
-extern const vespalib::slime::Memory RESPONSE_CONFIGID;
-extern const vespalib::slime::Memory RESPONSE_CLIENT_HOSTNAME;
-extern const vespalib::slime::Memory RESPONSE_CONFIG_MD5;
-extern const vespalib::slime::Memory RESPONSE_CONFIG_GENERATION;
-extern const vespalib::slime::Memory RESPONSE_PAYLOAD;
-extern const vespalib::slime::Memory RESPONSE_TRACE;
+extern const vespalib::Memory REQUEST_VERSION;
+extern const vespalib::Memory REQUEST_DEF_NAME;
+extern const vespalib::Memory REQUEST_DEF_NAMESPACE;
+extern const vespalib::Memory REQUEST_DEF_MD5;
+extern const vespalib::Memory REQUEST_DEF_CONTENT;
+extern const vespalib::Memory REQUEST_CLIENT_CONFIGID;
+extern const vespalib::Memory REQUEST_CLIENT_HOSTNAME;
+extern const vespalib::Memory REQUEST_CONFIG_MD5;
+extern const vespalib::Memory REQUEST_CURRENT_GENERATION;
+extern const vespalib::Memory REQUEST_WANTED_GENERATION;
+extern const vespalib::Memory REQUEST_TIMEOUT;
+extern const vespalib::Memory REQUEST_TRACE;
+extern const vespalib::Memory REQUEST_VESPA_VERSION;
+
+extern const vespalib::Memory RESPONSE_VERSION;
+extern const vespalib::Memory RESPONSE_DEF_NAME;
+extern const vespalib::Memory RESPONSE_DEF_NAMESPACE;
+extern const vespalib::Memory RESPONSE_DEF_MD5;
+extern const vespalib::Memory RESPONSE_CONFIGID;
+extern const vespalib::Memory RESPONSE_CLIENT_HOSTNAME;
+extern const vespalib::Memory RESPONSE_CONFIG_MD5;
+extern const vespalib::Memory RESPONSE_CONFIG_GENERATION;
+extern const vespalib::Memory RESPONSE_PAYLOAD;
+extern const vespalib::Memory RESPONSE_TRACE;
const vespalib::slime::Inspector & extractPayload(const vespalib::Slime & data);
@@ -60,10 +60,10 @@ const vespalib::slime::Inspector & extractPayload(const vespalib::Slime & data);
namespace v3 {
-extern const vespalib::slime::Memory REQUEST_COMPRESSION_TYPE;
-extern const vespalib::slime::Memory RESPONSE_COMPRESSION_INFO;
-extern const vespalib::slime::Memory RESPONSE_COMPRESSION_INFO_TYPE;
-extern const vespalib::slime::Memory RESPONSE_COMPRESSION_INFO_UNCOMPRESSED_SIZE;
+extern const vespalib::Memory REQUEST_COMPRESSION_TYPE;
+extern const vespalib::Memory RESPONSE_COMPRESSION_INFO;
+extern const vespalib::Memory RESPONSE_COMPRESSION_INFO_TYPE;
+extern const vespalib::Memory RESPONSE_COMPRESSION_INFO_UNCOMPRESSED_SIZE;
struct DecompressedData {
DecompressedData(vespalib::alloc::Alloc mem, uint32_t sz)
@@ -71,14 +71,14 @@ struct DecompressedData {
memRef(static_cast<const char *>(memory.get()), sz),
size(sz)
{ }
- DecompressedData(const vespalib::slime::Memory & mem, uint32_t sz)
+ DecompressedData(const vespalib::Memory & mem, uint32_t sz)
: memory(),
memRef(mem),
size(sz)
{}
vespalib::alloc::Alloc memory;
- vespalib::slime::Memory memRef;
+ vespalib::Memory memRef;
uint32_t size;
};
diff --git a/config/src/vespa/config/print/fileconfigformatter.cpp b/config/src/vespa/config/print/fileconfigformatter.cpp
index 64421e2bbc8..c983572e04a 100644
--- a/config/src/vespa/config/print/fileconfigformatter.cpp
+++ b/config/src/vespa/config/print/fileconfigformatter.cpp
@@ -11,9 +11,9 @@ using namespace vespalib::slime::convenience;
using vespalib::slime::ArrayTraverser;
using vespalib::slime::ObjectTraverser;
-using vespalib::slime::BufferedOutput;
-using vespalib::slime::SimpleBuffer;
-using vespalib::slime::Output;
+using vespalib::OutputWriter;
+using vespalib::SimpleBuffer;
+using vespalib::Output;
namespace config {
void doEncode(ConfigDataBuffer & buffer, Output & output);
@@ -24,12 +24,12 @@ namespace {
struct ConfigEncoder : public ArrayTraverser,
public ObjectTraverser
{
- BufferedOutput &out;
+ OutputWriter &out;
int level;
bool head;
std::vector<std::string> prefixList;
- ConfigEncoder(BufferedOutput &out_in)
+ ConfigEncoder(OutputWriter &out_in)
: out(out_in), level(0), head(true) {}
void printPrefix() {
@@ -80,9 +80,9 @@ struct ConfigEncoder : public ArrayTraverser,
out.commit(len);
}
void encodeSTRING(const Memory &memory) {
- out.writeByte('\"');
+ out.write('\"');
encodeSTRINGNOQUOTE(memory);
- out.writeByte('\"');
+ out.write('\"');
}
void encodeARRAY(const Inspector &inspector) {
ArrayTraverser &array_traverser = *this;
@@ -107,10 +107,10 @@ struct ConfigEncoder : public ArrayTraverser,
prefixList.pop_back();
} else {
printPrefix();
- out.writeByte(' ');
+ out.write(' ');
if (type.compare("enum") == 0) encodeSTRINGNOQUOTE(inspector["value"].asString());
else encodeValue(inspector["value"]);
- out.writeByte('\n');
+ out.write('\n');
}
}
}
@@ -133,7 +133,7 @@ struct ConfigEncoder : public ArrayTraverser,
virtual void entry(size_t idx, const Inspector &inspector);
virtual void field(const Memory &symbol_name, const Inspector &inspector);
- static void encode(Inspector & root, BufferedOutput &out) {
+ static void encode(Inspector & root, OutputWriter &out) {
ConfigEncoder encoder(out);
encoder.encodeValue(root);
}
@@ -158,14 +158,14 @@ ConfigEncoder::entry(size_t index, const Inspector &inspector)
prefixList.pop_back();
} else {
printPrefix();
- out.writeByte('[');
+ out.write('[');
encodeLONG(index);
- out.writeByte(']');
- out.writeByte(' ');
+ out.write(']');
+ out.write(' ');
if (type.compare("enum") == 0) encodeSTRINGNOQUOTE(inspector["value"].asString());
else encodeValue(inspector["value"]);
- out.writeByte('\n');
+ out.write('\n');
}
}
}
@@ -196,11 +196,11 @@ ConfigEncoder::field(const Memory &symbol_name, const Inspector &inspector)
} else {
printPrefix();
encodeSTRINGNOQUOTE(symbol_name);
- out.writeByte(' ');
+ out.write(' ');
if (type.compare("enum") == 0) encodeSTRINGNOQUOTE(inspector["value"].asString());
else encodeValue(inspector["value"]);
- out.writeByte('\n');
+ out.write('\n');
}
}
}
@@ -212,7 +212,7 @@ namespace config {
void
doEncode(ConfigDataBuffer & buffer, Output & output)
{
- BufferedOutput out(output);
+ OutputWriter out(output, 8000);
ConfigEncoder::encode(buffer.slimeObject().get()["configPayload"], out);
}
diff --git a/config/src/vespa/config/print/jsonconfigformatter.cpp b/config/src/vespa/config/print/jsonconfigformatter.cpp
index ad6e41be756..9ca35b42f35 100644
--- a/config/src/vespa/config/print/jsonconfigformatter.cpp
+++ b/config/src/vespa/config/print/jsonconfigformatter.cpp
@@ -3,10 +3,10 @@
#include "jsonconfigformatter.h"
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/data/slime/json_format.h>
-#include <vespa/vespalib/data/slime/simple_buffer.h>
+#include <vespa/vespalib/data/simple_buffer.h>
-using vespalib::slime::SimpleBuffer;
-using vespalib::slime::Output;
+using vespalib::SimpleBuffer;
+using vespalib::Output;
using vespalib::slime::JsonFormat;
namespace config {
diff --git a/config/src/vespa/config/retriever/configsnapshot.cpp b/config/src/vespa/config/retriever/configsnapshot.cpp
index 02331671245..b46b3f34898 100644
--- a/config/src/vespa/config/retriever/configsnapshot.cpp
+++ b/config/src/vespa/config/retriever/configsnapshot.cpp
@@ -4,11 +4,12 @@
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/config/common/misc.h>
#include <vespa/vespalib/data/slime/slime.h>
+#include <vespa/vespalib/data/memory.h>
using vespalib::Slime;
using vespalib::slime::Cursor;
using vespalib::slime::Inspector;
-using vespalib::slime::Memory;
+using vespalib::Memory;
namespace config {
@@ -134,7 +135,7 @@ ConfigSnapshot::serializeKeyV1(Cursor & cursor, const ConfigKey & key) const
Cursor & defSchema(cursor.setArray("defSchema"));
const SchemaVector & vec(key.getDefSchema());
for (SchemaVector::const_iterator it(vec.begin()), mt(vec.end()); it != mt; it++) {
- defSchema.addString(vespalib::slime::Memory(*it));
+ defSchema.addString(vespalib::Memory(*it));
}
}