mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:arangodb/arangodb into devel
This commit is contained in:
commit
e96fc9c8fd
|
@ -34,6 +34,7 @@ set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
|
|||
|
||||
# ArangoDB needs c++11
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
include (CheckCXX11Features)
|
||||
|
||||
# Need threads
|
||||
find_package(Threads REQUIRED)
|
||||
|
@ -235,6 +236,7 @@ if (USE_RELATIVE)
|
|||
set(TRI_SBINDIR_INSTALL "sbin")
|
||||
set(TRI_SBINDIR "${CMAKE_INSTALL_PREFIX}/sbin")
|
||||
endif ()
|
||||
add_definitions("-D_SYSCONFDIR_=\"${ETCDIR_ESCAPED}\"")
|
||||
else(USE_RELATIVE)
|
||||
# etcd -------------------------------
|
||||
set(ETCDIR "" CACHE path "System configuration directory (defaults to prefix/etc)")
|
||||
|
@ -254,6 +256,7 @@ else(USE_RELATIVE)
|
|||
file(TO_NATIVE_PATH "${ETCDIR_NATIVE}" ETCDIR_NATIVE)
|
||||
STRING(REGEX REPLACE "\\\\" "\\\\\\\\" ETCDIR_ESCAPED "${ETCDIR_NATIVE}")
|
||||
endif()
|
||||
|
||||
add_definitions("-D_SYSCONFDIR_=\"${ETCDIR_ESCAPED}\"")
|
||||
# arango directories -----------------
|
||||
# /var
|
||||
|
@ -517,10 +520,6 @@ endif ()
|
|||
|
||||
add_definitions("-DTRI_LIBEV_VERSION=\"${LIBEV_VERSION}\"")
|
||||
|
||||
# linenoise --------------------------------------------------------------------
|
||||
set(LINENOISE_VERSION "unknown" CACHE string "LINENOISE version")
|
||||
option(USE_LINENOISE "User linenoise for editing command lines and command line histories" ON)
|
||||
|
||||
|
||||
# Boost ------------------------------------------------------------------------
|
||||
find_package(Boost 1.48 COMPONENTS unit_test_framework)
|
||||
|
|
|
@ -347,7 +347,7 @@ describe ArangoDB do
|
|||
it "fetches a create collection action from the follow log" do
|
||||
ArangoDB.drop_collection("UnitTestsReplication")
|
||||
|
||||
sleep 1
|
||||
sleep 5
|
||||
|
||||
cmd = api + "/logger-state"
|
||||
doc = ArangoDB.log_get("#{prefix}-follow-create-collection", cmd, :body => "")
|
||||
|
@ -357,7 +357,8 @@ describe ArangoDB do
|
|||
|
||||
cid = ArangoDB.create_collection("UnitTestsReplication")
|
||||
|
||||
sleep 1
|
||||
sleep 5
|
||||
|
||||
cmd = api + "/logger-follow?from=" + fromTick
|
||||
doc = ArangoDB.log_get("#{prefix}-follow-create-collection", cmd, :body => "", :format => :plain)
|
||||
doc.code.should eq(200)
|
||||
|
@ -408,7 +409,7 @@ describe ArangoDB do
|
|||
it "fetches some collection operations from the follow log" do
|
||||
ArangoDB.drop_collection("UnitTestsReplication")
|
||||
|
||||
sleep 1
|
||||
sleep 5
|
||||
|
||||
cmd = api + "/logger-state"
|
||||
doc = ArangoDB.log_get("#{prefix}-follow-collection", cmd, :body => "")
|
||||
|
@ -435,7 +436,7 @@ describe ArangoDB do
|
|||
doc = ArangoDB.log_delete("#{prefix}-follow-collection", cmd)
|
||||
doc.code.should eq(200)
|
||||
|
||||
sleep 1
|
||||
sleep 5
|
||||
|
||||
cmd = api + "/logger-follow?from=" + fromTick
|
||||
doc = ArangoDB.log_get("#{prefix}-follow-create-collection", cmd, :body => "", :format => :plain)
|
||||
|
|
|
@ -224,11 +224,11 @@ void ApplicationServer::setupLogging(bool threaded, bool daemon,
|
|||
} else {
|
||||
bool regularOut = false;
|
||||
|
||||
for (auto definition : _logOutput) {
|
||||
for (auto const& definition : _logOutput) {
|
||||
regularOut = regularOut || definition == "+" || definition == "-";
|
||||
}
|
||||
|
||||
for (auto definition : outputs) {
|
||||
for (auto const& definition : outputs) {
|
||||
regularOut = regularOut || definition == "+" || definition == "-";
|
||||
}
|
||||
|
||||
|
@ -245,8 +245,10 @@ void ApplicationServer::setupLogging(bool threaded, bool daemon,
|
|||
|
||||
Logger::setLogLevel(levels);
|
||||
|
||||
for (auto definition : outputs) {
|
||||
Logger::addAppender(definition, !ttyLogger, _logContentFilter);
|
||||
std::unordered_set<std::string> filenames;
|
||||
|
||||
for (auto const& definition : outputs) {
|
||||
Logger::addAppender(definition, !ttyLogger, _logContentFilter, filenames);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -346,11 +346,12 @@ void ArangoClient::parse(ProgramOptions& options,
|
|||
Logger::setShowLineNumber(false);
|
||||
Logger::setShowThreadIdentifier(false);
|
||||
|
||||
std::unordered_set<std::string> existingAppenders;
|
||||
if (_logOutput.empty()) {
|
||||
Logger::addAppender("-", true, "");
|
||||
Logger::addAppender("-", true, "", existingAppenders);
|
||||
} else {
|
||||
for (auto& definition : _logOutput) {
|
||||
Logger::addAppender(definition, true, "");
|
||||
Logger::addAppender(definition, true, "", existingAppenders);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
20
configure.ac
20
configure.ac
|
@ -614,28 +614,10 @@ AC_MSG_NOTICE([-----------------------------------------------------------------
|
|||
AC_MSG_NOTICE([CHECKING FOR CONSOLE SUPPORT])
|
||||
AC_MSG_NOTICE([--------------------------------------------------------------------------------])
|
||||
|
||||
CONSOLE_CPPFLAGS=""
|
||||
|
||||
AC_ARG_ENABLE(console,
|
||||
AS_HELP_STRING([--enable-console], [enable console support (default: linenoise)]),
|
||||
tr_CONSOLE="$enableval",
|
||||
tr_CONSOLE="linenoise"
|
||||
)
|
||||
|
||||
if test "$tr_CONSOLE" = "dummy"; then
|
||||
LIB_INFO="$LIB_INFO|CONSOLE: dummy"
|
||||
elif test "$tr_CONSOLE" = "linenoise"; then
|
||||
LIB_INFO="$LIB_INFO|CONSOLE: linenoise"
|
||||
CONSOLE_CPPFLAGS="-I${srcdir}/3rdParty/linenoise-ng/include -I${srcdir}/3rdParty/linenoise-ng/src -DTRI_HAVE_LINENOISE"
|
||||
fi
|
||||
|
||||
LIB_INFO="$LIB_INFO|CONSOLE_CPPFLAGS: ${CONSOLE_CPPFLAGS}"
|
||||
LIB_INFO="$LIB_INFO|."
|
||||
CONSOLE_CPPFLAGS="-I${srcdir}/3rdParty/linenoise-ng/include -I${srcdir}/3rdParty/linenoise-ng/src"
|
||||
|
||||
AC_SUBST(CONSOLE_CPPFLAGS)
|
||||
|
||||
AM_CONDITIONAL(ENABLE_LINENOISE, test "x$tr_CONSOLE" = xlinenoise)
|
||||
|
||||
dnl ----------------------------------------------------------------------------
|
||||
dnl tcmalloc
|
||||
dnl ----------------------------------------------------------------------------
|
||||
|
|
|
@ -190,7 +190,7 @@
|
|||
self.set("name", name);
|
||||
result = true;
|
||||
},
|
||||
error: function(data) {
|
||||
error: function(/*data*/) {
|
||||
try {
|
||||
console.log("error");
|
||||
//var parsed = JSON.parse(data.responseText);
|
||||
|
|
|
@ -548,7 +548,7 @@
|
|||
if (error) {
|
||||
arangoHelper.arangoError("Could not delete index");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$("#indexDeleteModal").modal('hide');
|
||||
this.model.deleteIndex(this.lastId, callback);
|
||||
|
|
|
@ -161,7 +161,7 @@ function ReplicationSuite() {
|
|||
console.log("waiting for slave to catch up");
|
||||
printed = true;
|
||||
}
|
||||
internal.wait(1.0, false);
|
||||
internal.wait(5.0, false);
|
||||
}
|
||||
|
||||
db._flushCache();
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include <boost/lockfree/queue.hpp>
|
||||
|
||||
#include "Basics/ConditionLocker.h"
|
||||
#include "Basics/Exceptions.h"
|
||||
#include "Basics/MutexLocker.h"
|
||||
#include "Basics/StringUtils.h"
|
||||
#include "Basics/Thread.h"
|
||||
|
@ -214,10 +215,8 @@ LogAppenderFile::LogAppenderFile(std::string const& filename, bool fatal2stderr,
|
|||
|
||||
if (fd < 0) {
|
||||
std::cerr << "cannot write to file '" << filename << "'" << std::endl;
|
||||
_filename = "+";
|
||||
_fd.store(STDERR_FILENO);
|
||||
} else {
|
||||
_fd.store(fd);
|
||||
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_CANNOT_WRITE_FILE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -452,6 +451,79 @@ std::string LogAppenderSyslog::details() {
|
|||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief build an appender object
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static LogAppender* buildAppender(std::string const& output, bool fatal2stderr,
|
||||
std::string const& contentFilter,
|
||||
std::unordered_set<std::string>& existingAppenders) {
|
||||
// first handle syslog-logging
|
||||
#ifdef TRI_ENABLE_SYSLOG
|
||||
if (StringUtils::isPrefix(output, "syslog://")) {
|
||||
auto s = StringUtils::split(output.substr(9), '/');
|
||||
|
||||
if (s.size() < 1 || s.size() > 2) {
|
||||
LOG(ERR) << "unknown syslog definition '" << output << "', expecting "
|
||||
<< "'syslog://facility/identifier'";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (s.size() == 1) {
|
||||
return new LogAppenderSyslog(s[0], "", contentFilter);
|
||||
}
|
||||
return new LogAppenderSyslog(s[0], s[1], contentFilter);
|
||||
}
|
||||
#endif
|
||||
|
||||
// everything else must be file-based logging
|
||||
std::string filename;
|
||||
if (output == "-" || output == "+") {
|
||||
filename = output;
|
||||
} else if (StringUtils::isPrefix(output, "file://")) {
|
||||
filename = output.substr(7);
|
||||
} else {
|
||||
LOG(ERR) << "unknown logger output '" << output << "'";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// helper function to prevent duplicate output filenames
|
||||
auto hasAppender = [&existingAppenders](std::string const& filename) {
|
||||
if (existingAppenders.find(filename) != existingAppenders.end()) {
|
||||
return true;
|
||||
}
|
||||
// treat stderr and stdout as one output filename
|
||||
if (filename == "-" &&
|
||||
existingAppenders.find("+") != existingAppenders.end()) {
|
||||
return true;
|
||||
}
|
||||
if (filename == "+" &&
|
||||
existingAppenders.find("-") != existingAppenders.end()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
if (hasAppender(filename)) {
|
||||
// already have an appender for the same output
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
try {
|
||||
std::unique_ptr<LogAppender> appender(new LogAppenderFile(filename, fatal2stderr, contentFilter));
|
||||
existingAppenders.emplace(filename);
|
||||
return appender.release();
|
||||
}
|
||||
catch (...) {
|
||||
// cannot open file for logging
|
||||
// try falling back to stderr instead
|
||||
if (hasAppender("-")) {
|
||||
return nullptr;
|
||||
}
|
||||
return buildAppender("-", fatal2stderr, contentFilter, existingAppenders);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief RingBuffer
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -726,7 +798,8 @@ std::atomic<LogLevel> Logger::_level(LogLevel::INFO);
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Logger::addAppender(std::string const& definition, bool fatal2stderr,
|
||||
std::string const& filter) {
|
||||
std::string const& filter,
|
||||
std::unordered_set<std::string>& existingAppenders) {
|
||||
std::vector<std::string> v = StringUtils::split(definition, '=');
|
||||
std::string topicName;
|
||||
std::string output;
|
||||
|
@ -767,42 +840,19 @@ void Logger::addAppender(std::string const& definition, bool fatal2stderr,
|
|||
|
||||
topic = it->second;
|
||||
}
|
||||
|
||||
std::unique_ptr<LogAppender> appender(buildAppender(output, f2s, contentFilter, existingAppenders));
|
||||
|
||||
std::unique_ptr<LogAppender> appender;
|
||||
|
||||
if (output == "-") {
|
||||
appender.reset(new LogAppenderFile("-", f2s, contentFilter));
|
||||
} else if (output == "+") {
|
||||
appender.reset(new LogAppenderFile("+", f2s, contentFilter));
|
||||
} else if (StringUtils::isPrefix(output, "file://")) {
|
||||
auto filename = output.substr(7);
|
||||
|
||||
appender.reset(new LogAppenderFile(filename, f2s, contentFilter));
|
||||
#ifdef TRI_ENABLE_SYSLOG
|
||||
} else if (StringUtils::isPrefix(output, "syslog://")) {
|
||||
auto s = StringUtils::split(output.substr(9), '/');
|
||||
|
||||
if (s.size() < 1 || s.size() > 2) {
|
||||
LOG(ERR) << "unknown syslog definition '" << output << "', expecting "
|
||||
<< "'syslog://facility/identifier'";
|
||||
return;
|
||||
}
|
||||
|
||||
if (s.size() == 1) {
|
||||
appender.reset(new LogAppenderSyslog(s[0], "", contentFilter));
|
||||
} else {
|
||||
appender.reset(new LogAppenderSyslog(s[0], s[1], contentFilter));
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
LOG(ERR) << "unknown output '" << output << "'";
|
||||
if (appender == nullptr) {
|
||||
// cannot open appender or already have an appender for the channel
|
||||
return;
|
||||
}
|
||||
|
||||
size_t n = topic == nullptr ? MAX_LOG_TOPICS : topic->id();
|
||||
|
||||
MUTEX_LOCKER(guard, AppendersLock);
|
||||
Appenders[n].emplace_back(appender.release());
|
||||
Appenders[n].emplace_back(appender.get());
|
||||
appender.release();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -169,7 +169,9 @@ namespace arangodb {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief LogLevel
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef TRI_UNDEF_ERR
|
||||
#undef ERR
|
||||
#endif
|
||||
enum class LogLevel {
|
||||
DEFAULT = 0,
|
||||
FATAL = 1,
|
||||
|
@ -330,7 +332,7 @@ class Logger {
|
|||
/// @brief creates a new appender
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void addAppender(std::string const&, bool, std::string const&);
|
||||
static void addAppender(std::string const&, bool, std::string const&, std::unordered_set<std::string>&);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief determines the global log level
|
||||
|
@ -445,6 +447,7 @@ class Logger {
|
|||
static void flush();
|
||||
|
||||
private:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief current log level
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1156,17 +1156,15 @@ int TRI_CreateLockFile(char const* filename) {
|
|||
}
|
||||
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, buf);
|
||||
TRI_CLOSE(fd);
|
||||
|
||||
// try to open pid file
|
||||
fd = TRI_OPEN(filename, O_RDONLY | TRI_O_CLOEXEC);
|
||||
|
||||
if (fd < 0) {
|
||||
return TRI_set_errno(TRI_ERROR_SYS_ERROR);
|
||||
}
|
||||
|
||||
struct flock lock;
|
||||
|
||||
lock.l_start = 0;
|
||||
lock.l_len = 0;
|
||||
lock.l_type = F_WRLCK;
|
||||
lock.l_whence = SEEK_SET;
|
||||
// try to lock pid file
|
||||
rv = flock(fd, LOCK_EX);
|
||||
rv = fcntl(fd, F_SETLK, &lock);
|
||||
|
||||
if (rv == -1) {
|
||||
int res = TRI_set_errno(TRI_ERROR_SYS_ERROR);
|
||||
|
@ -1237,19 +1235,20 @@ int TRI_VerifyLockFile(char const* filename) {
|
|||
sizeof(buffer)); // not really necessary, but this shuts up valgrind
|
||||
ssize_t n = TRI_READ(fd, buffer, sizeof(buffer));
|
||||
|
||||
TRI_CLOSE(fd);
|
||||
|
||||
if (n < 0) {
|
||||
TRI_CLOSE(fd);
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
// pid too long
|
||||
if (n == sizeof(buffer)) {
|
||||
TRI_CLOSE(fd);
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
// file empty
|
||||
if (n == 0) {
|
||||
TRI_CLOSE(fd);
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
|
@ -1257,26 +1256,29 @@ int TRI_VerifyLockFile(char const* filename) {
|
|||
int res = TRI_errno();
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
TRI_CLOSE(fd);
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
TRI_pid_t pid = fc;
|
||||
|
||||
if (kill(pid, 0) == -1) {
|
||||
TRI_CLOSE(fd);
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
struct flock lock;
|
||||
|
||||
fd = TRI_OPEN(filename, O_RDONLY | TRI_O_CLOEXEC);
|
||||
lock.l_start = 0;
|
||||
lock.l_len = 0;
|
||||
lock.l_type = F_WRLCK;
|
||||
lock.l_whence = SEEK_SET;
|
||||
// try to lock pid file
|
||||
int canLock = fcntl(fd, F_SETLK, &lock); // Exclusive (write) lock
|
||||
|
||||
if (fd < 0) {
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
int canLock = flock(fd, LOCK_EX | LOCK_NB);
|
||||
|
||||
// file was not yet be locked
|
||||
// file was not yet locken; could be locked
|
||||
if (canLock == 0) {
|
||||
flock(fd, LOCK_UN);
|
||||
lock.l_type = F_UNLCK;
|
||||
fcntl(fd, F_GETLK, &lock);
|
||||
TRI_CLOSE(fd);
|
||||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
@ -1286,7 +1288,7 @@ int TRI_VerifyLockFile(char const* filename) {
|
|||
|
||||
TRI_CLOSE(fd);
|
||||
|
||||
LOG(WARN) << "flock on lockfile '" << filename << "' failed: " << TRI_errno_string(canLock);
|
||||
LOG(WARN) << "fcntl on lockfile '" << filename << "' failed: " << TRI_errno_string(canLock);
|
||||
|
||||
return TRI_ERROR_ARANGO_DATADIR_LOCKED;
|
||||
}
|
||||
|
@ -1337,7 +1339,14 @@ int TRI_DestroyLockFile(char const* filename) {
|
|||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
int res = flock(fd, LOCK_UN);
|
||||
struct flock lock;
|
||||
|
||||
lock.l_start = 0;
|
||||
lock.l_len = 0;
|
||||
lock.l_type = F_UNLCK;
|
||||
lock.l_whence = SEEK_SET;
|
||||
// relesae the lock
|
||||
int res = fcntl(fd, F_GETLK, &lock);
|
||||
TRI_CLOSE(fd);
|
||||
|
||||
if (res == 0) {
|
||||
|
|
|
@ -60,12 +60,6 @@
|
|||
|
||||
#undef TRI_ENABLE_FAILURE_TESTS
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief enable linenoise
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_HAVE_LINENOISE @TRI_HAVE_LINENOISE@
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief enable tcmalloc
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
|
||||
#define TRI_PLATFORM "solaris"
|
||||
|
||||
#define TRI_UNDEF_ERR 1
|
||||
|
||||
#define TRI_HAVE_PSTACK 1
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -685,10 +687,14 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ..............................................................................
|
||||
// Visual Studio 2013 does not support noexcept
|
||||
// Visual Studio 2013 does not support noexcept, higher versions do
|
||||
// ..............................................................................
|
||||
|
||||
// Is noexcept supported?
|
||||
#if defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 180021114
|
||||
#else
|
||||
#define noexcept throw()
|
||||
#endif
|
||||
|
||||
// ..............................................................................
|
||||
// This directive below suppresses warnings about 'inline'
|
||||
|
@ -760,8 +766,6 @@
|
|||
/// @brief available features
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_HAVE_LINENOISE 1
|
||||
|
||||
#define YY_NO_UNISTD_H 1
|
||||
|
||||
#define TRI_WIN32_CONSOLE 1
|
||||
|
|
|
@ -51,10 +51,14 @@ CODE prioritynames[] =
|
|||
CODE facilitynames[] =
|
||||
{
|
||||
{ "auth", LOG_AUTH },
|
||||
#ifdef LOG_AUTHPRIV
|
||||
{ "authpriv", LOG_AUTHPRIV },
|
||||
#endif
|
||||
{ "cron", LOG_CRON },
|
||||
{ "daemon", LOG_DAEMON },
|
||||
#ifdef LOG_FTP
|
||||
{ "ftp", LOG_FTP },
|
||||
#endif
|
||||
{ "kern", LOG_KERN },
|
||||
{ "lpr", LOG_LPR },
|
||||
{ "mail", LOG_MAIL },
|
||||
|
|
|
@ -148,7 +148,6 @@ add_library(
|
|||
Rest/InitializeRest.cpp
|
||||
Rest/SslInterface.cpp
|
||||
Rest/Version.cpp
|
||||
Utilities/DummyShell.cpp
|
||||
Utilities/LineEditor.cpp
|
||||
Utilities/ScriptLoader.cpp
|
||||
Utilities/ShellBase.cpp
|
||||
|
|
|
@ -85,7 +85,6 @@ lib_libarango_a_SOURCES = \
|
|||
lib/Rest/InitializeRest.cpp \
|
||||
lib/Rest/SslInterface.cpp \
|
||||
lib/Rest/Version.cpp \
|
||||
lib/Utilities/DummyShell.cpp \
|
||||
lib/Utilities/LineEditor.cpp \
|
||||
lib/Utilities/ScriptLoader.cpp \
|
||||
lib/Utilities/ShellBase.cpp \
|
||||
|
@ -93,16 +92,12 @@ lib_libarango_a_SOURCES = \
|
|||
lib/Zip/unzip.cpp \
|
||||
lib/Zip/zip.cpp
|
||||
|
||||
if ENABLE_LINENOISE
|
||||
|
||||
lib_libarango_a_SOURCES += \
|
||||
3rdParty/linenoise-ng/src/linenoise.cpp \
|
||||
3rdParty/linenoise-ng/src/ConvertUTF.cpp \
|
||||
3rdParty/linenoise-ng/src/wcwidth.cpp \
|
||||
lib/Utilities/LinenoiseShell.cpp
|
||||
|
||||
endif
|
||||
|
||||
lib_libarango_a_SOURCES += \
|
||||
3rdParty/velocypack/src/AttributeTranslator.cpp \
|
||||
3rdParty/velocypack/src/Builder.cpp \
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// DISCLAIMER
|
||||
///
|
||||
/// Copyright 2014-2016 ArangoDB GmbH, Cologne, Germany
|
||||
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
|
||||
///
|
||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
/// you may not use this file except in compliance with the License.
|
||||
/// You may obtain a copy of the License at
|
||||
///
|
||||
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||
///
|
||||
/// Unless required by applicable law or agreed to in writing, software
|
||||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
/// See the License for the specific language governing permissions and
|
||||
/// limitations under the License.
|
||||
///
|
||||
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
|
||||
///
|
||||
/// @author Dr. Frank Celler
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "DummyShell.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace arangodb;
|
||||
|
||||
DummyShell::DummyShell(std::string const& history, Completer* completer)
|
||||
: ShellBase(history, completer) {}
|
||||
|
||||
DummyShell::~DummyShell() { close(); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief line editor open
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool DummyShell::open(bool) {
|
||||
_state = STATE_OPENED;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DummyShell::close() {
|
||||
_state = STATE_CLOSED;
|
||||
return true;
|
||||
}
|
||||
|
||||
void DummyShell::addHistory(std::string const&) {}
|
||||
|
||||
bool DummyShell::writeHistory() { return true; }
|
||||
|
||||
std::string DummyShell::getLine(std::string const& prompt, bool& eof) {
|
||||
std::cout << prompt << std::flush;
|
||||
|
||||
std::string line;
|
||||
std::getline(std::cin, line);
|
||||
|
||||
if (std::cin.eof()) {
|
||||
eof = true;
|
||||
return "";
|
||||
}
|
||||
|
||||
return line;
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// DISCLAIMER
|
||||
///
|
||||
/// Copyright 2014-2016 ArangoDB GmbH, Cologne, Germany
|
||||
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
|
||||
///
|
||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
/// you may not use this file except in compliance with the License.
|
||||
/// You may obtain a copy of the License at
|
||||
///
|
||||
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||
///
|
||||
/// Unless required by applicable law or agreed to in writing, software
|
||||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
/// See the License for the specific language governing permissions and
|
||||
/// limitations under the License.
|
||||
///
|
||||
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
|
||||
///
|
||||
/// @author Esteban Lombeyda
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef LIB_UTILITIES_DUMMY_SHELL_H
|
||||
#define LIB_UTILITIES_DUMMY_SHELL_H 1
|
||||
|
||||
#include "ShellBase.h"
|
||||
|
||||
namespace arangodb {
|
||||
class Completer;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief DummyShell
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class DummyShell : public ShellBase {
|
||||
public:
|
||||
DummyShell(std::string const& history, Completer*);
|
||||
|
||||
virtual ~DummyShell();
|
||||
|
||||
public:
|
||||
bool open(bool autoComplete) override final;
|
||||
|
||||
bool close() override final;
|
||||
|
||||
void addHistory(std::string const&) override final;
|
||||
|
||||
bool writeHistory() override final;
|
||||
|
||||
std::string getLine(std::string const& prompt, bool& eof) override final;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -26,11 +26,7 @@
|
|||
#include "Basics/StringUtils.h"
|
||||
#include "Basics/files.h"
|
||||
#include "Utilities/Completer.h"
|
||||
#include "Utilities/DummyShell.h"
|
||||
|
||||
#if defined(TRI_HAVE_LINENOISE)
|
||||
#include "Utilities/LinenoiseShell.h"
|
||||
#endif
|
||||
|
||||
using namespace arangodb;
|
||||
using namespace arangodb::basics;
|
||||
|
@ -41,18 +37,7 @@ using namespace arangodb::basics;
|
|||
|
||||
ShellBase* ShellBase::buildShell(std::string const& history,
|
||||
Completer* completer) {
|
||||
// no keyboard input. use low-level shell without fancy color codes
|
||||
// and with proper pipe handling
|
||||
|
||||
if (!isatty(STDIN_FILENO)) {
|
||||
return new DummyShell(history, completer);
|
||||
} else {
|
||||
#if defined(TRI_HAVE_LINENOISE)
|
||||
return new LinenoiseShell(history, completer);
|
||||
#else
|
||||
return new DummyShell(history, completer); // last resort!
|
||||
#endif
|
||||
}
|
||||
return new LinenoiseShell(history, completer);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
#!/bin/bash
|
||||
|
||||
JAVASCRIPT_JSLINT="\
|
||||
`find ./js/actions -name "*.js"` \
|
||||
`find ./js/common/bootstrap -name "*.js"` \
|
||||
`find ./js/client/bootstrap -name "*.js"` \
|
||||
`find ./js/server/bootstrap -name "*.js"` \
|
||||
\
|
||||
`find ./js/common/modules/@arangodb -name "*.js"` \
|
||||
`find ./js/client/modules/@arangodb -name "*.js"` \
|
||||
`find ./js/server/modules/@arangodb -name "*.js"` \
|
||||
`find ./js/server/tests -name "*.js" | grep -v "ranges-combined"` \
|
||||
`find ./js/common/tests -name "*.js"` \
|
||||
`find ./js/client/tests -name "*.js"` \
|
||||
\
|
||||
`find ./js/apps/system/_system/cerberus/APP -name "*.js"` \
|
||||
`find ./js/apps/system/_api/gharial/APP -name "*.js"` \
|
||||
`find ./js/apps/system/_system/sessions/APP -name "*.js"` \
|
||||
`find ./js/apps/system/_system/simple-auth/APP -name "*.js"` \
|
||||
`find ./js/apps/system/_system/users/APP -name "*.js"` \
|
||||
\
|
||||
`find ./js/apps/system/_admin/aardvark/APP/frontend/js/models -name "*.js"` \
|
||||
`find ./js/apps/system/_admin/aardvark/APP/frontend/js/views -name "*.js"` \
|
||||
`find ./js/apps/system/_admin/aardvark/APP/frontend/js/collections -name "*.js"` \
|
||||
`find ./js/apps/system/_admin/aardvark/APP/frontend/js/routers -name "*.js"` \
|
||||
`find ./js/apps/system/_admin/aardvark/APP/frontend/js/arango -name "*.js"` \
|
||||
`find ./js/apps/system/_admin/aardvark/APP/frontend/js/shell -name "*.js"` \
|
||||
`find ./js/apps/system/_admin/aardvark/APP/test/specs -name "*.js"` \
|
||||
`find ./js/apps/system/_admin/aardvark/APP/test/clusterSpecs -name "*.js"` \
|
||||
\
|
||||
`find ./scripts -name "*.js"` \
|
||||
\
|
||||
./js/common/modules/jsunity.js \
|
||||
./js/client/client.js \
|
||||
./js/server/server.js \
|
||||
./js/server/upgrade-database.js \
|
||||
\
|
||||
./js/apps/system/_admin/aardvark/APP/frontend/js/shell/browser.js \
|
||||
"
|
||||
|
||||
FILELIST=""
|
||||
|
||||
for file in ${JAVASCRIPT_JSLINT}; do
|
||||
FILELIST="${FILELIST} --jslint ${file}";
|
||||
done
|
||||
|
||||
exec ./build/bin/arangosh \
|
||||
-c none \
|
||||
--log.level error \
|
||||
--server.password "" \
|
||||
--javascript.startup-directory ./js \
|
||||
${FILELIST}
|
Loading…
Reference in New Issue