1
0
Fork 0

Merge branch 'devel' of https://github.com/arangodb/arangodb into devel

This commit is contained in:
Kaveh Vahedipour 2017-01-18 11:07:39 +01:00
commit 347e668ceb
3 changed files with 38 additions and 3 deletions

View File

@ -31,6 +31,7 @@
#include <string>
#include "velocypack/velocypack-common.h"
#include "velocypack/Exception.h"
namespace arangodb {
namespace velocypack {
@ -154,6 +155,28 @@ class Buffer {
initWithNone();
}
}
inline T& operator[](size_t position) noexcept {
return _buffer[position];
}
inline T const& operator[](size_t position) const noexcept {
return _buffer[position];
}
inline T& at(size_t position) {
if (position >= _pos) {
throw Exception(Exception::IndexOutOfBounds);
}
return operator[](position);
}
inline T const& at(size_t position) const {
if (position >= _pos) {
throw Exception(Exception::IndexOutOfBounds);
}
return operator[](position);
}
inline void push_back(char c) {
reserve(1);
@ -171,6 +194,14 @@ class Buffer {
memcpy(_buffer + _pos, p, checkOverflow(len));
_pos += len;
}
void append(std::string const& value) {
return append(value.c_str(), value.size());
}
void append(Buffer<T> const& value) {
return append(value.data(), value.size());
}
void reserve(ValueLength len) {
if (_pos + len < _alloc) {

View File

@ -422,12 +422,12 @@ function agencyTestSuite () {
assertEqual(readAndCheck([["a/z"]]), [{"a":{"z":12}}]);
writeAndCheck([[{"a/y":{"op":"set","new":12, "ttl": 1}}]]);
assertEqual(readAndCheck([["a/y"]]), [{"a":{"y":12}}]);
wait(2.0);
wait(3.0);
assertEqual(readAndCheck([["a/y"]]), [{a:{}}]);
writeAndCheck([[{"a/y":{"op":"set","new":12, "ttl": 1}}]]);
writeAndCheck([[{"a/y":{"op":"set","new":12}}]]);
assertEqual(readAndCheck([["a/y"]]), [{"a":{"y":12}}]);
wait(2.0);
wait(3.0);
assertEqual(readAndCheck([["a/y"]]), [{"a":{"y":12}}]);
writeAndCheck([[{"foo/bar":{"op":"set","new":{"baz":12}}}]]);
assertEqual(readAndCheck([["/foo/bar/baz"]]),
@ -435,7 +435,7 @@ function agencyTestSuite () {
assertEqual(readAndCheck([["/foo/bar"]]), [{"foo":{"bar":{"baz":12}}}]);
assertEqual(readAndCheck([["/foo"]]), [{"foo":{"bar":{"baz":12}}}]);
writeAndCheck([[{"foo/bar":{"op":"set","new":{"baz":12},"ttl":1}}]]);
wait(2.0);
wait(3.0);
assertEqual(readAndCheck([["/foo"]]), [{"foo":{}}]);
assertEqual(readAndCheck([["/foo/bar"]]), [{"foo":{}}]);
assertEqual(readAndCheck([["/foo/bar/baz"]]), [{"foo":{}}]);

View File

@ -219,6 +219,10 @@ void Logger::log(char const* function, char const* file, long int line,
if (ArangoGlobalContext::CONTEXT != nullptr && ArangoGlobalContext::CONTEXT->useEventLog()) {
TRI_LogWindowsEventlog(function, file, line, message);
}
// additionally log these errors to the debug output window in MSVC so
// we can see them during development
OutputDebugString(message.c_str());
}
#endif