mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into devel
This commit is contained in:
commit
347e668ceb
|
@ -31,6 +31,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "velocypack/velocypack-common.h"
|
#include "velocypack/velocypack-common.h"
|
||||||
|
#include "velocypack/Exception.h"
|
||||||
|
|
||||||
namespace arangodb {
|
namespace arangodb {
|
||||||
namespace velocypack {
|
namespace velocypack {
|
||||||
|
@ -154,6 +155,28 @@ class Buffer {
|
||||||
initWithNone();
|
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) {
|
inline void push_back(char c) {
|
||||||
reserve(1);
|
reserve(1);
|
||||||
|
@ -171,6 +194,14 @@ class Buffer {
|
||||||
memcpy(_buffer + _pos, p, checkOverflow(len));
|
memcpy(_buffer + _pos, p, checkOverflow(len));
|
||||||
_pos += 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) {
|
void reserve(ValueLength len) {
|
||||||
if (_pos + len < _alloc) {
|
if (_pos + len < _alloc) {
|
||||||
|
|
|
@ -422,12 +422,12 @@ function agencyTestSuite () {
|
||||||
assertEqual(readAndCheck([["a/z"]]), [{"a":{"z":12}}]);
|
assertEqual(readAndCheck([["a/z"]]), [{"a":{"z":12}}]);
|
||||||
writeAndCheck([[{"a/y":{"op":"set","new":12, "ttl": 1}}]]);
|
writeAndCheck([[{"a/y":{"op":"set","new":12, "ttl": 1}}]]);
|
||||||
assertEqual(readAndCheck([["a/y"]]), [{"a":{"y":12}}]);
|
assertEqual(readAndCheck([["a/y"]]), [{"a":{"y":12}}]);
|
||||||
wait(2.0);
|
wait(3.0);
|
||||||
assertEqual(readAndCheck([["a/y"]]), [{a:{}}]);
|
assertEqual(readAndCheck([["a/y"]]), [{a:{}}]);
|
||||||
writeAndCheck([[{"a/y":{"op":"set","new":12, "ttl": 1}}]]);
|
writeAndCheck([[{"a/y":{"op":"set","new":12, "ttl": 1}}]]);
|
||||||
writeAndCheck([[{"a/y":{"op":"set","new":12}}]]);
|
writeAndCheck([[{"a/y":{"op":"set","new":12}}]]);
|
||||||
assertEqual(readAndCheck([["a/y"]]), [{"a":{"y":12}}]);
|
assertEqual(readAndCheck([["a/y"]]), [{"a":{"y":12}}]);
|
||||||
wait(2.0);
|
wait(3.0);
|
||||||
assertEqual(readAndCheck([["a/y"]]), [{"a":{"y":12}}]);
|
assertEqual(readAndCheck([["a/y"]]), [{"a":{"y":12}}]);
|
||||||
writeAndCheck([[{"foo/bar":{"op":"set","new":{"baz":12}}}]]);
|
writeAndCheck([[{"foo/bar":{"op":"set","new":{"baz":12}}}]]);
|
||||||
assertEqual(readAndCheck([["/foo/bar/baz"]]),
|
assertEqual(readAndCheck([["/foo/bar/baz"]]),
|
||||||
|
@ -435,7 +435,7 @@ function agencyTestSuite () {
|
||||||
assertEqual(readAndCheck([["/foo/bar"]]), [{"foo":{"bar":{"baz":12}}}]);
|
assertEqual(readAndCheck([["/foo/bar"]]), [{"foo":{"bar":{"baz":12}}}]);
|
||||||
assertEqual(readAndCheck([["/foo"]]), [{"foo":{"bar":{"baz":12}}}]);
|
assertEqual(readAndCheck([["/foo"]]), [{"foo":{"bar":{"baz":12}}}]);
|
||||||
writeAndCheck([[{"foo/bar":{"op":"set","new":{"baz":12},"ttl":1}}]]);
|
writeAndCheck([[{"foo/bar":{"op":"set","new":{"baz":12},"ttl":1}}]]);
|
||||||
wait(2.0);
|
wait(3.0);
|
||||||
assertEqual(readAndCheck([["/foo"]]), [{"foo":{}}]);
|
assertEqual(readAndCheck([["/foo"]]), [{"foo":{}}]);
|
||||||
assertEqual(readAndCheck([["/foo/bar"]]), [{"foo":{}}]);
|
assertEqual(readAndCheck([["/foo/bar"]]), [{"foo":{}}]);
|
||||||
assertEqual(readAndCheck([["/foo/bar/baz"]]), [{"foo":{}}]);
|
assertEqual(readAndCheck([["/foo/bar/baz"]]), [{"foo":{}}]);
|
||||||
|
|
|
@ -219,6 +219,10 @@ void Logger::log(char const* function, char const* file, long int line,
|
||||||
if (ArangoGlobalContext::CONTEXT != nullptr && ArangoGlobalContext::CONTEXT->useEventLog()) {
|
if (ArangoGlobalContext::CONTEXT != nullptr && ArangoGlobalContext::CONTEXT->useEventLog()) {
|
||||||
TRI_LogWindowsEventlog(function, file, line, message);
|
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
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue