Files
scylla/gms/i_endpoint_state_change_subscriber.hh
Yaniv Kaul c658bdb150 Typos: fix typos in comments
Fixes some typos as found by codespell run on the code.
In this commit, I was hoping to fix only comments, not user-visible alerts, output, etc.
Follow-up commits will take care of them.

Refs: https://github.com/scylladb/scylladb/issues/16255
Signed-off-by: Yaniv Kaul <yaniv.kaul@scylladb.com>
2023-12-02 22:37:22 +02:00

67 lines
2.6 KiB
C++

/*
*
* Modified by ScyllaDB
* Copyright (C) 2015-present ScyllaDB
*/
/*
* SPDX-License-Identifier: (AGPL-3.0-or-later and Apache-2.0)
*/
#pragma once
#include "gms/inet_address.hh"
#include "gms/endpoint_state.hh"
#include "gms/application_state.hh"
#include "gms/versioned_value.hh"
namespace gms {
/**
* This is called by the gossiper to notify
* interested parties about changes in the the state associated with any endpoint.
* For instance if node A figures there is a changes in state for an endpoint B
* it notifies all interested parties of this change. It is upto to the registered
* instance to decide what he does with this change. Not all modules maybe interested
* in all state changes.
*
* All notifications that accept a permit_id are guaranteed to be called
* under the respective endpoint lock. The permit_id must be provided
* by the subscriber if it calls back gossiper functions that modify the same endpoint's
* state, and therefore may acquire the same endpoint_lock - to prevent deadlock on the nested
* call path. Calls from other code paths or for other endpoints should pass a
* null_permit_id to indicate that no endpoint lock is held for them.
*/
class i_endpoint_state_change_subscriber {
public:
virtual ~i_endpoint_state_change_subscriber() {}
/**
* Use to inform interested parties about the change in the state
* for specified endpoint
*
* @param endpoint endpoint for which the state change occurred.
* @param epState state that actually changed for the above endpoint.
*/
virtual future<> on_join(inet_address endpoint, endpoint_state_ptr ep_state, permit_id) = 0;
virtual future<> before_change(inet_address endpoint, endpoint_state_ptr current_state, application_state new_statekey, const versioned_value& newvalue) = 0;
virtual future<> on_change(inet_address endpoint, application_state state, const versioned_value& value, permit_id) = 0;
virtual future<> on_alive(inet_address endpoint, endpoint_state_ptr state, permit_id) = 0;
virtual future<> on_dead(inet_address endpoint, endpoint_state_ptr state, permit_id) = 0;
virtual future<> on_remove(inet_address endpoint, permit_id) = 0;
/**
* Called whenever a node is restarted.
* Note that there is no guarantee when that happens that the node was
* previously marked down. It will have only if {@code state.isAlive() == false}
* as {@code state} is from before the restarted node is marked up.
*/
virtual future<> on_restart(inet_address endpoint, endpoint_state_ptr state, permit_id) = 0;
};
} // namespace gms