Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frozen features #15610

Merged
merged 90 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
be36dc9
initial commit
gnusi Jan 22, 2022
8e7581f
wip
gnusi Jan 23, 2022
2759bad
wip
gnusi Jan 23, 2022
f38bc68
wip
gnusi Jan 23, 2022
81caa1f
wip
gnusi Jan 23, 2022
de9be3f
wip
gnusi Jan 23, 2022
1b9c99c
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 24, 2022
4ac869e
wip
gnusi Jan 24, 2022
44d4347
wip
gnusi Jan 24, 2022
81f4ddd
wip
gnusi Jan 24, 2022
ada8804
wip
gnusi Jan 24, 2022
01a7ba2
wip
gnusi Jan 24, 2022
e729dbe
wip
gnusi Jan 24, 2022
dab8961
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 24, 2022
0a18808
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 24, 2022
e74d1ac
wip
gnusi Jan 24, 2022
5a0702d
wip
gnusi Jan 25, 2022
485dc2f
wip
gnusi Jan 25, 2022
e228b3d
wip
gnusi Jan 25, 2022
cbf4f17
wip
gnusi Jan 25, 2022
0e82ce6
wip
gnusi Jan 25, 2022
9230c96
wip
gnusi Jan 25, 2022
c02365f
wip
gnusi Jan 25, 2022
9d212ed
wip
gnusi Jan 25, 2022
2a9e9e9
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 25, 2022
e9e7c99
wip
gnusi Jan 25, 2022
0d2da9c
wip
gnusi Jan 26, 2022
1d97e72
wip
gnusi Jan 26, 2022
cc22221
wip
gnusi Jan 26, 2022
f4d4a1d
wip
gnusi Jan 26, 2022
dbb946c
wip
gnusi Jan 26, 2022
ce0a551
wip
gnusi Jan 26, 2022
482ef8f
wip
gnusi Jan 26, 2022
1db5cbf
wip
gnusi Jan 26, 2022
280a2f3
wip
gnusi Jan 26, 2022
5e1bd02
wip
gnusi Jan 26, 2022
871d34b
wip
gnusi Jan 26, 2022
21f15fb
wip
gnusi Jan 26, 2022
bc8b310
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 26, 2022
1f19438
wip
gnusi Jan 26, 2022
f255f99
wip
gnusi Jan 26, 2022
9a1129b
wip
gnusi Jan 26, 2022
6e88128
get rid of virtual inheritance
gnusi Jan 26, 2022
7752ecf
wip
gnusi Jan 26, 2022
7d97ca8
wip
gnusi Jan 26, 2022
0ccbe4c
wip
gnusi Jan 26, 2022
5405acb
wup
gnusi Jan 27, 2022
5b687e9
wip
gnusi Jan 27, 2022
3da6cd8
wip
gnusi Jan 27, 2022
c544aea
wip
gnusi Jan 27, 2022
08e0796
wip
gnusi Jan 27, 2022
c270e77
wip
gnusi Jan 27, 2022
534937f
wip
gnusi Jan 27, 2022
5e57f80
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 27, 2022
b0980e9
wip
gnusi Jan 27, 2022
a9849b1
wip
gnusi Jan 27, 2022
ad9eb7f
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 28, 2022
9e04236
wip
gnusi Jan 28, 2022
23e648c
wip
gnusi Jan 28, 2022
5fb19ff
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 28, 2022
4fc9103
finally made it to compile
gnusi Jan 28, 2022
2056192
wip
gnusi Jan 28, 2022
9494b11
wip
gnusi Jan 28, 2022
c05e8b0
wip
gnusi Jan 29, 2022
27af8bc
wip
gnusi Jan 29, 2022
f88645b
wip
gnusi Jan 29, 2022
f2db307
wip
gnusi Jan 29, 2022
f501bf9
wip
gnusi Jan 29, 2022
ff9127f
fix tests
gnusi Jan 29, 2022
7ed0620
wip
gnusi Jan 29, 2022
c2e1618
fix compilation
gnusi Jan 29, 2022
638c5e4
fix msvc build
gnusi Jan 29, 2022
6f87d04
remove unused code
gnusi Jan 30, 2022
5ee88e2
wip
gnusi Jan 30, 2022
404aeba
wip
gnusi Jan 30, 2022
e5b992e
wip
gnusi Jan 30, 2022
ae94da2
address review comments
gnusi Jan 30, 2022
00ddb31
wip
gnusi Jan 30, 2022
c4bcb4c
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 30, 2022
fd95726
wip
gnusi Jan 30, 2022
79e73d8
wip
gnusi Jan 30, 2022
fc8a867
wip
gnusi Jan 30, 2022
7fee8ce
wip
gnusi Jan 31, 2022
0b0aa28
wip
gnusi Jan 31, 2022
db51706
wip
gnusi Jan 31, 2022
068bcf6
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 31, 2022
a9d6128
wip
gnusi Jan 31, 2022
8f60724
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
gnusi Jan 31, 2022
199f11b
wip
gnusi Jan 31, 2022
92ee15b
wip
gnusi Jan 31, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wip
  • Loading branch information
gnusi committed Jan 27, 2022
commit 08e079624ccf8c697ebc0134f6a8f792598d77cd
17 changes: 6 additions & 11 deletions client-tools/Backup/BackupFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@

namespace {

/// @brief name of the feature to report to application server
constexpr auto FeatureName = "Backup";

constexpr auto OperationCreate = "create";
constexpr auto OperationDelete = "delete";
constexpr auto OperationList = "list";
Expand Down Expand Up @@ -156,7 +153,7 @@ arangodb::Result waitForRestart(arangodb::ClientManager& clientManager,
auto now = std::chrono::high_resolution_clock::now();
auto duration = now - start;
return (static_cast<double>(duration.count()) /
decltype(duration)::period::den* decltype(duration)::period::num);
decltype(duration)::period::den * decltype(duration)::period::num);
};

LOG_TOPIC("0dfda", INFO, arangodb::Logger::BACKUP)
Expand Down Expand Up @@ -686,18 +683,16 @@ arangodb::Result executeTransfer(

namespace arangodb {

BackupFeature::BackupFeature(application_features::ApplicationServer& server,
int& exitCode)
: ApplicationFeature(server, BackupFeature::featureName()),
_clientManager{server, Logger::BACKUP},
BackupFeature::BackupFeature(Server& server, int& exitCode)
: ArangoBackupFeature{server, *this},
_clientManager{server.getFeature<HttpEndpointProvider, ClientFeature>(),
Logger::BACKUP},
_exitCode{exitCode} {
requiresElevatedPrivileges(false);
setOptional(false);
startsAfter<ClientFeature>();
startsAfter<HttpEndpointProvider>();
}

std::string BackupFeature::featureName() { return ::FeatureName; }

std::string BackupFeature::operationList(std::string const& separator) {
TRI_ASSERT(::Operations.size() > 0);

Expand Down
7 changes: 5 additions & 2 deletions client-tools/Backup/BackupFeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#pragma once

#include "Backup/arangobackup.h"
#include "ApplicationFeatures/ApplicationFeature.h"

#include "Basics/Mutex.h"
Expand All @@ -33,9 +34,11 @@ namespace httpclient {
class SimpleHttpResult;
}

class BackupFeature : public application_features::ApplicationFeature {
class BackupFeature : public ArangoBackupFeature {
public:
BackupFeature(application_features::ApplicationServer& server, int& exitCode);
static constexpr std::string_view name() noexcept { return "Backup"; }

BackupFeature(Server& server, int& exitCode);

// for documentation of virtual methods, see `ApplicationFeature`
virtual void collectOptions(
Expand Down
24 changes: 20 additions & 4 deletions client-tools/Backup/arangobackup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,28 @@
using namespace arangodb;
using namespace arangodb::application_features;

struct ArangoBackupInitializer
: public ArangoClientInitializer<ArangoBackupServer> {
struct ArangoBackupInitializer {
public:
ArangoBackupInitializer(int* ret, char const* binaryName,
ArangoBackupServer& client)
: ArangoClientInitializer{binaryName, client}, _ret{ret} {}
: _ret{ret}, _binaryName{binaryName}, _client{client} {}

using ArangoClientInitializer::operator();
template<typename T>
void operator()(TypeTag<T>) {
_client.addFeature<T>();
}

void operator()(TypeTag<GreetingsFeaturePhase>) {
_client.addFeature<GreetingsFeaturePhase>(std::true_type{});
}

void operator()(TypeTag<ConfigFeature>) {
_client.addFeature<ConfigFeature>(_binaryName);
}

void operator()(TypeTag<LoggerFeature>) {
_client.addFeature<LoggerFeature>(false);
}

void operator()(TypeTag<HttpEndpointProvider>) {
_client.addFeature<HttpEndpointProvider, ClientFeature>(false);
Expand All @@ -73,6 +87,8 @@ struct ArangoBackupInitializer

private:
int* _ret;
char const* _binaryName;
ArangoBackupServer& _client;
};

int main(int argc, char* argv[]) {
Expand Down
3 changes: 2 additions & 1 deletion client-tools/Backup/arangobackup.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ namespace arangodb {

class BackupFeature;

using ArangoBackupFeatures = ArangoClientFeatures<BackupFeature>;
using ArangoBackupFeatures =
ArangoClientFeatures<BasicFeaturePhaseClient, BackupFeature>;
using ArangoBackupServer = ApplicationServerT<ArangoBackupFeatures>;
using ArangoBackupFeature = ApplicationFeatureT<ArangoBackupServer>;

Expand Down
25 changes: 19 additions & 6 deletions client-tools/Benchmark/arangobench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,33 @@ using namespace arangodb;
using namespace arangodb::application_features;
using namespace arangodb::basics;

struct ArangoBenchInitializer
: public ArangoClientInitializer<ArangoBenchServer> {
class ArangoBenchInitializer {
public:
ArangoBenchInitializer(int* ret, char const* binaryName,
ArangoBenchServer& client)
: ArangoClientInitializer{binaryName, client}, _ret{ret} {}
: _ret{ret}, _binaryName{binaryName}, _client{client} {}

using ArangoClientInitializer::operator();
template<typename T>
void operator()(TypeTag<T>) {
_client.addFeature<T>();
}

void operator()(TypeTag<GreetingsFeaturePhase>) {
_client.addFeature<GreetingsFeaturePhase>(std::true_type{});
}

void operator()(TypeTag<ConfigFeature>) {
_client.addFeature<ConfigFeature>(_binaryName);
}

void operator()(TypeTag<HttpEndpointProvider>) {
// provide max number of endpoints
_client.addFeature<HttpEndpointProvider, ClientFeature>(
false, std::numeric_limits<size_t>::max());
}

void operator()(TypeTag<BenchFeature>) {
_client.addFeature<BenchFeature>(*_ret);
_client.addFeature<BenchFeature>(_ret);
}

void operator()(TypeTag<ShutdownFeature>) {
Expand All @@ -80,11 +91,13 @@ struct ArangoBenchInitializer
}

void operator()(TypeTag<TempFeature>) {
_client.template addFeature<TempFeature>(_binaryName);
_client.addFeature<TempFeature>(_binaryName);
}

private:
int* _ret;
char const* _binaryName;
ArangoBenchServer& _client;
};

int main(int argc, char* argv[]) {
Expand Down
24 changes: 20 additions & 4 deletions client-tools/Dump/arangodump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,28 @@
using namespace arangodb;
using namespace arangodb::application_features;

struct ArangoDumpInitializer
: public ArangoClientInitializer<ArangoDumpServer> {
class ArangoDumpInitializer {
gnusi marked this conversation as resolved.
Show resolved Hide resolved
public:
ArangoDumpInitializer(int* ret, char const* binaryName,
ArangoDumpServer& client)
: ArangoClientInitializer{binaryName, client}, _ret{ret} {}
: _ret{ret}, _binaryName{binaryName}, _client{client} {}

using ArangoClientInitializer::operator();
template<typename T>
void operator()(TypeTag<T>) {
_client.addFeature<T>();
}

void operator()(TypeTag<GreetingsFeaturePhase>) {
_client.addFeature<GreetingsFeaturePhase>(std::true_type{});
}

void operator()(TypeTag<ConfigFeature>) {
_client.addFeature<ConfigFeature>(_binaryName);
}

void operator()(TypeTag<LoggerFeature>) {
_client.addFeature<LoggerFeature>(false);
}

void operator()(TypeTag<HttpEndpointProvider>) {
_client.addFeature<HttpEndpointProvider, ClientFeature>(
Expand All @@ -78,6 +92,8 @@ struct ArangoDumpInitializer

private:
int* _ret;
char const* _binaryName;
ArangoDumpServer& _client;
};

int main(int argc, char* argv[]) {
Expand Down
2 changes: 1 addition & 1 deletion client-tools/Dump/arangodump.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ using ArangoDumpFeatures = ArangoClientFeatures<
#ifdef USE_ENTERPRISE
EncryptionFeature,
#endif
DumpFeature>;
BasicFeaturePhaseClient, DumpFeature>;

using ArangoDumpServer = ApplicationServerT<ArangoDumpFeatures>;
using ArangoDumpFeature = ApplicationFeatureT<ArangoDumpServer>;
Expand Down
6 changes: 5 additions & 1 deletion client-tools/Export/ExportFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,11 @@ void ExportFeature::validateOptions(
}

void ExportFeature::prepare() {
_directory = std::make_unique<ManagedDirectory>(server(), _outputDirectory,
auto* encryption = server().hasFeature<EncryptionFeature>()
? &server().getFeature<EncryptionFeature>()
: nullptr;

_directory = std::make_unique<ManagedDirectory>(encryption, _outputDirectory,
!_overwrite, true, _useGzip);
if (_directory->status().fail()) {
switch (static_cast<int>(_directory->status().errorNumber())) {
Expand Down
28 changes: 22 additions & 6 deletions client-tools/Export/arangoexport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,35 @@
using namespace arangodb;
using namespace arangodb::application_features;

struct ArangoExportInitializer
: public ArangoClientInitializer<ArangoExportServer> {
class ArangoExportInitializer {
public:
ArangoExportInitializer(int* ret, char const* binaryName,
ArangoExportServer& client)
: ArangoClientInitializer{binaryName, client}, _ret{ret} {}
: _ret{ret}, _binaryName{binaryName}, _client{client} {}

using ArangoClientInitializer::operator();
template<typename T>
void operator()(TypeTag<T>) {
_client.addFeature<T>();
}

void operator()(TypeTag<GreetingsFeaturePhase>) {
_client.addFeature<GreetingsFeaturePhase>(std::true_type{});
}

void operator()(TypeTag<ConfigFeature>) {
_client.addFeature<ConfigFeature>(_binaryName);
}

void operator()(TypeTag<LoggerFeature>) {
_client.addFeature<LoggerFeature>(false);
}

void operator()(TypeTag<HttpEndpointProvider>) {
_client.addFeature<HttpEndpointProvider, ClientFeature>(false);
}

void operator()(TypeTag<ExportFeature>) {
_client.addFeature<ExportFeature>(*_ret);
_client.addFeature<ExportFeature>(_ret);
}

void operator()(TypeTag<ShutdownFeature>) {
Expand All @@ -77,11 +91,13 @@ struct ArangoExportInitializer
}

void operator()(TypeTag<TempFeature>) {
_client.template addFeature<TempFeature>(_binaryName);
_client.addFeature<TempFeature>(_binaryName);
}

private:
int* _ret;
char const* _binaryName;
ArangoExportServer& _client;
};

int main(int argc, char* argv[]) {
Expand Down
2 changes: 1 addition & 1 deletion client-tools/Export/arangoexport.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ using ArangoExportFeatures = ArangoClientFeatures<
#ifdef USE_ENTERPRISE
EncryptionFeature,
#endif
TempFeature, ExportFeature>;
BasicFeaturePhaseClient, TempFeature, ExportFeature>;

using ArangoExportServer = ApplicationServerT<ArangoExportFeatures>;
using ArangoExportFeature = ApplicationFeatureT<ArangoExportServer>;
Expand Down
9 changes: 7 additions & 2 deletions client-tools/Import/ImportFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,14 @@ void ImportFeature::start() {

_httpClient->disconnect(); // we do not reuse this anymore

auto* encryption = server().hasFeature<EncryptionFeature>()
? &server().getFeature<EncryptionFeature>()
: nullptr;

SimpleHttpClientParams params = _httpClient->params();
arangodb::import::ImportHelper ih(client, client.endpoint(), params,
_chunkSize, _threadCount, _autoChunkSize);
arangodb::import::ImportHelper ih(encryption, client, client.endpoint(),
params, _chunkSize, _threadCount,
_autoChunkSize);

// create colletion
if (_createCollection) {
Expand Down
19 changes: 8 additions & 11 deletions client-tools/Import/ImportHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,13 @@ unsigned const ImportHelper::MaxBatchSize = 768 * 1024 * 1024;
/// constructor and destructor
////////////////////////////////////////////////////////////////////////////////

ImportHelper::ImportHelper(ClientFeature const& client,
ImportHelper::ImportHelper(EncryptionFeature* encryption,
ClientFeature const& client,
std::string const& endpoint,
httpclient::SimpleHttpClientParams const& params,
uint64_t maxUploadSize, uint32_t threadCount,
bool autoUploadSize)
: _clientFeature(client),
: _encryption{encryption},
_httpClient(client.createHttpClient(endpoint, params)),
_maxUploadSize(maxUploadSize),
_periodByteCount(0),
Expand Down Expand Up @@ -239,8 +240,8 @@ bool ImportHelper::readHeadersFile(std::string const& headersFile,
TRI_ASSERT(!headersFile.empty());
TRI_ASSERT(!_headersSeen);

ManagedDirectory directory(_clientFeature.server(), TRI_Dirname(headersFile),
false, false, false);
ManagedDirectory directory(_encryption, TRI_Dirname(headersFile), false,
false, false);
if (directory.status().fail()) {
_errorMessages.emplace_back(directory.status().errorMessage());
return false;
Expand Down Expand Up @@ -331,11 +332,7 @@ bool ImportHelper::importDelimited(std::string const& collectionName,
std::string const& pathName,
std::string const& headersFile,
DelimitedImportType typeImport) {
auto* encryption = _server.hasFeature<EncryptionFeature>()
? &_server.getFeature<EncryptionFeature>()
: nullptr;

ManagedDirectory directory(encryption, TRI_Dirname(pathName), false, false,
ManagedDirectory directory(_encryption, TRI_Dirname(pathName), false, false,
true);
if (directory.status().fail()) {
_errorMessages.emplace_back(directory.status().errorMessage());
Expand Down Expand Up @@ -458,8 +455,8 @@ bool ImportHelper::importDelimited(std::string const& collectionName,
bool ImportHelper::importJson(std::string const& collectionName,
std::string const& pathName,
bool assumeLinewise) {
ManagedDirectory directory(_clientFeature.server(), TRI_Dirname(pathName),
false, false, true);
ManagedDirectory directory(_encryption, TRI_Dirname(pathName), false, false,
true);
std::string fileName(TRI_Basename(pathName.c_str()));
_collectionName = collectionName;
_firstLine = "";
Expand Down
Loading