1
0
mirror of https://github.com/ohwgiles/laminar.git synced 2026-09-24 21:06:21 +00:00

Minor modernizations

resolves #235
This commit is contained in:
Oliver Giles
2026-05-28 19:44:38 +12:00
parent 3392b899b2
commit b1ae75e259
16 changed files with 41 additions and 72 deletions

View File

@@ -1,5 +1,5 @@
///
/// Copyright 2015 Oliver Giles
/// Copyright 2015-2026 Oliver Giles
///
/// This file is part of Laminar
///
@@ -16,8 +16,7 @@
/// You should have received a copy of the GNU General Public License
/// along with Laminar. If not, see <http://www.gnu.org/licenses/>
///
#ifndef LAMINAR_CONF_H_
#define LAMINAR_CONF_H_
#pragma once
#include <string>
#include <unordered_map>
@@ -41,5 +40,3 @@ int StringMap::convert(std::string e);
// beginning with '#'
StringMap parseConfFile(const char* path);
#endif // LAMINAR_CONF_H_

View File

@@ -1,5 +1,5 @@
///
/// Copyright 2015-2020 Oliver Giles
/// Copyright 2015-2026 Oliver Giles
///
/// This file is part of Laminar
///
@@ -16,8 +16,7 @@
/// You should have received a copy of the GNU General Public License
/// along with Laminar. If not, see <http://www.gnu.org/licenses/>
///
#ifndef LAMINAR_CONTEXT_H_
#define LAMINAR_CONTEXT_H_
#pragma once
#include <string>
#include <set>
@@ -36,5 +35,3 @@ public:
std::set<std::string> jobPatterns;
};
#endif // LAMINAR_CONTEXT_H_

View File

@@ -1,5 +1,5 @@
///
/// Copyright 2015-2018 Oliver Giles
/// Copyright 2015-2026 Oliver Giles
///
/// This file is part of Laminar
///
@@ -16,8 +16,7 @@
/// You should have received a copy of the GNU General Public License
/// along with Laminar. If not, see <http://www.gnu.org/licenses/>
///
#ifndef LAMINAR_DATABASE_H_
#define LAMINAR_DATABASE_H_
#pragma once
#include <string>
#include <functional>
@@ -157,4 +156,3 @@ template<> long Database::Statement::fetchColumn(int col);
template<> ulong Database::Statement::fetchColumn(int col);
template<> double Database::Statement::fetchColumn(int col);
#endif // LAMINAR_DATABASE_H_

View File

@@ -1,5 +1,5 @@
///
/// Copyright 2019-2020 Oliver Giles
/// Copyright 2019-2026 Oliver Giles
///
/// This file is part of Laminar
///
@@ -16,8 +16,7 @@
/// You should have received a copy of the GNU General Public License
/// along with Laminar. If not, see <http://www.gnu.org/licenses/>
///
#ifndef LAMINAR_HTTP_H_
#define LAMINAR_HTTP_H_
#pragma once
#include <kj/memory.h>
#include <kj/compat/http.h>
@@ -66,4 +65,3 @@ private:
kj::HttpHeaderId ACCEPT;
};
#endif //LAMINAR_HTTP_H_

View File

@@ -1,5 +1,5 @@
///
/// Copyright 2015-2022 Oliver Giles
/// Copyright 2015-2026 Oliver Giles
///
/// This file is part of Laminar
///
@@ -16,14 +16,14 @@
/// You should have received a copy of the GNU General Public License
/// along with Laminar. If not, see <http://www.gnu.org/licenses/>
///
#ifndef LAMINAR_LAMINAR_H_
#define LAMINAR_LAMINAR_H_
#pragma once
#include "run.h"
#include "monitorscope.h"
#include "context.h"
#include "database.h"
#include <list>
#include <unordered_map>
#include <kj/filesystem.h>
#include <kj/async-io.h>
@@ -134,4 +134,3 @@ private:
kj::Own<Rpc> rpc;
};
#endif // LAMINAR_LAMINAR_H_

View File

@@ -1,5 +1,5 @@
///
/// Copyright 2019 Oliver Giles
/// Copyright 2019-2026 Oliver Giles
///
/// This file is part of Laminar
///
@@ -16,8 +16,7 @@
/// You should have received a copy of the GNU General Public License
/// along with Laminar. If not, see <http://www.gnu.org/licenses/>
///
#ifndef LAMINAR_LEADER_H_
#define LAMINAR_LEADER_H_
#pragma once
// Main function for the leader process which is responsible for
// executing all the scripts which make up a Run. Separating this
@@ -33,4 +32,3 @@
int leader_main(void);
#endif // LAMINAR_LEADER_H_

View File

@@ -1,5 +1,5 @@
///
/// Copyright 2015-2020 Oliver Giles
/// Copyright 2015-2026 Oliver Giles
///
/// This file is part of Laminar
///
@@ -16,8 +16,7 @@
/// You should have received a copy of the GNU General Public License
/// along with Laminar. If not, see <http://www.gnu.org/licenses/>
///
#ifndef LAMINAR_LOG_H_
#define LAMINAR_LOG_H_
#pragma once
#include <kj/debug.h>
#include <utility>
@@ -69,5 +68,3 @@ namespace _ {
const char* laminar_version();
#endif // LAMINAR_LOG_H_

View File

@@ -1,5 +1,5 @@
///
/// Copyright 2015-2019 Oliver Giles
/// Copyright 2015-2026 Oliver Giles
///
/// This file is part of Laminar
///
@@ -16,8 +16,7 @@
/// You should have received a copy of the GNU General Public License
/// along with Laminar. If not, see <http://www.gnu.org/licenses/>
///
#ifndef LAMINAR_MONITORSCOPE_H_
#define LAMINAR_MONITORSCOPE_H_
#pragma once
#include <string>
@@ -59,5 +58,3 @@ struct MonitorScope {
bool order_desc;
};
#endif // LAMINAR_MONITORSCOPE_H_

View File

@@ -1,5 +1,5 @@
///
/// Copyright 2015-2019 Oliver Giles
/// Copyright 2015-2026 Oliver Giles
///
/// This file is part of Laminar
///
@@ -16,8 +16,7 @@
/// You should have received a copy of the GNU General Public License
/// along with Laminar. If not, see <http://www.gnu.org/licenses/>
///
#ifndef LAMINAR_RESOURCES_H_
#define LAMINAR_RESOURCES_H_
#pragma once
#include <unordered_map>
#include <utility>
@@ -47,4 +46,3 @@ private:
std::string index_html;
};
#endif // LAMINAR_RESOURCES_H_

View File

@@ -1,5 +1,5 @@
///
/// Copyright 2019-2020 Oliver Giles
/// Copyright 2019-2026 Oliver Giles
///
/// This file is part of Laminar
///
@@ -16,8 +16,7 @@
/// You should have received a copy of the GNU General Public License
/// along with Laminar. If not, see <http://www.gnu.org/licenses/>
///
#ifndef LAMINAR_RPC_H_
#define LAMINAR_RPC_H_
#pragma once
#include <capnp/ez-rpc.h>
#include <capnp/rpc-twoparty.h>
@@ -33,4 +32,3 @@ public:
capnp::Capability::Client rpcInterface;
};
#endif //LAMINAR_RPC_H_

View File

@@ -1,5 +1,5 @@
///
/// Copyright 2015-2018 Oliver Giles
/// Copyright 2015-2026 Oliver Giles
///
/// This file is part of Laminar
///
@@ -16,14 +16,10 @@
/// You should have received a copy of the GNU General Public License
/// along with Laminar. If not, see <http://www.gnu.org/licenses/>
///
#ifndef LAMINAR_RUN_H_
#define LAMINAR_RUN_H_
#pragma once
#include <string>
#include <queue>
#include <list>
#include <functional>
#include <ostream>
#include <unordered_map>
#include <memory>
#include <kj/async.h>
@@ -109,6 +105,7 @@ private:
// be executing thousands of builds at the same time
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/indexed_by.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/composite_key.hpp>
#include <boost/multi_index/global_fun.hpp>
@@ -125,7 +122,7 @@ struct _run_same {
};
// A single Run can be fetched by...
struct _run_index : bmi::indexed_by<
typedef bmi::indexed_by<
bmi::hashed_unique<bmi::composite_key<
std::shared_ptr<Run>,
// a combination of their job name and build number
@@ -138,8 +135,7 @@ struct _run_index : bmi::indexed_by<
bmi::ordered_non_unique<bmi::member<Run, time_t, &Run::startedAt>>,
// or by their job name
bmi::ordered_non_unique<bmi::member<Run, std::string, &Run::name>>
>
{};
> _run_index;
struct RunSet: public boost::multi_index_container<
std::shared_ptr<Run>,
@@ -158,4 +154,3 @@ struct RunSet: public boost::multi_index_container<
typename bmi::nth_index<RunSet, 3>::type const& byJobName() const { return get<3>(); }
};
#endif // LAMINAR_RUN_H_

View File

@@ -1,5 +1,5 @@
///
/// Copyright 2015-2021 Oliver Giles
/// Copyright 2015-2026 Oliver Giles
///
/// This file is part of Laminar
///
@@ -26,7 +26,6 @@
#include <kj/async-unix.h>
#include <kj/threadlocal.h>
#include <signal.h>
#include <sys/eventfd.h>
#include <sys/stat.h>
#include <sys/inotify.h>
@@ -149,11 +148,10 @@ void Server::listenHttp(Http &http, kj::StringPtr httpBindAddress)
kj::Promise<void> Server::acceptRpcClient(Rpc& rpc, kj::Own<kj::ConnectionReceiver>&& listener) {
kj::ConnectionReceiver& cr = *listener.get();
return cr.accept().then(kj::mvCapture(kj::mv(listener),
[this, &rpc](kj::Own<kj::ConnectionReceiver>&& listener, kj::Own<kj::AsyncIoStream>&& connection) {
return cr.accept().then([this, &rpc, l = kj::mv(listener)](kj::Own<kj::AsyncIoStream>&& connection) mutable {
addTask(rpc.accept(kj::mv(connection)));
return acceptRpcClient(rpc, kj::mv(listener));
}));
return acceptRpcClient(rpc, kj::mv(l));
});
}
// returns a promise which will read a chunk of data from the file descriptor

View File

@@ -1,5 +1,5 @@
///
/// Copyright 2015-2020 Oliver Giles
/// Copyright 2015-2026 Oliver Giles
///
/// This file is part of Laminar
///
@@ -16,8 +16,7 @@
/// You should have received a copy of the GNU General Public License
/// along with Laminar. If not, see <http://www.gnu.org/licenses/>
///
#ifndef LAMINAR_SERVER_H_
#define LAMINAR_SERVER_H_
#pragma once
#include <kj/async-io.h>
#include <kj/compat/http.h>
@@ -72,4 +71,3 @@ private:
kj::Maybe<kj::Promise<void>> reapWatch;
};
#endif // LAMINAR_SERVER_H_