Files
scylladb/protocol_server.hh
Avi Kivity fcb8d040e8 treewide: use Software Package Data Exchange (SPDX) license identifiers
Instead of lengthy blurbs, switch to single-line, machine-readable
standardized (https://spdx.dev) license identifiers. The Linux kernel
switched long ago, so there is strong precedent.

Three cases are handled: AGPL-only, Apache-only, and dual licensed.
For the latter case, I chose (AGPL-3.0-or-later and Apache-2.0),
reasoning that our changes are extensive enough to apply our license.

The changes we applied mechanically with a script, except to
licenses/README.md.

Closes #9937
2022-01-18 12:15:18 +01:00

39 lines
1.4 KiB
C++

/*
* Copyright (C) 2021-present ScyllaDB
*/
/*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#pragma once
#include "seastarx.hh"
#include <seastar/core/future.hh>
#include <vector>
// Abstraction for a server serving some kind of user-facing protocol.
class protocol_server {
public:
virtual ~protocol_server() = default;
/// Name of the server, can be different or the same as than the protocol it serves.
virtual sstring name() const = 0;
/// Name of the protocol served.
virtual sstring protocol() const = 0;
/// Version of the protocol served (if any -- not all protocols are versioned).
virtual sstring protocol_version() const = 0;
/// Addresses the server is listening on, shall be empty when server is not running.
virtual std::vector<socket_address> listen_addresses() const = 0;
/// Start the server.
/// Can be called multiple times, in any state of the server.
virtual future<> start_server() = 0;
/// Stop the server.
/// Can be called multiple times, in any state of the server.
/// This variant is used on shutdown and therefore it must succeed.
virtual future<> stop_server() = 0;
/// Stop the server. Weaker variant of \ref stop_server().
/// Can be called multiple times, in any state of the server.
/// This variant is used by the REST API so failure is acceptable.
virtual future<> request_stop_server() = 0;
};