Files
scylladb/vector_search/truststore.hh
Avi Kivity 0ae22a09d4 LICENSE: Update to version 1.1
Updated terms of non-commercial use (must be a never-customer).
2026-04-12 19:46:33 +03:00

48 lines
1.4 KiB
C++

/*
* Copyright (C) 2025-present ScyllaDB
*/
/*
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.1
*/
#pragma once
#include "utils/updateable_value.hh"
#include "utils/log.hh"
#include <seastar/core/future.hh>
#include <seastar/core/sstring.hh>
#include <seastar/net/tls.hh>
#include <seastar/core/shared_ptr.hh>
#include <seastar/core/gate.hh>
#include <unordered_map>
namespace vector_search {
/// Manages the TLS truststore for secure (HTTPS) connections to the vector store service.
class truststore {
public:
using options_type = utils::updateable_value<std::unordered_map<seastar::sstring, seastar::sstring>>;
using invoke_on_others_type = std::function<seastar::future<>(std::function<seastar::future<>(truststore&)>)>;
explicit truststore(logging::logger& logger, options_type options, invoke_on_others_type invoke_on_others);
seastar::future<seastar::shared_ptr<seastar::tls::certificate_credentials>> get();
seastar::future<> stop();
unsigned reload_count() const {
return _reload_count;
}
private:
seastar::future<seastar::tls::credentials_builder> create_builder() const;
logging::logger& _logger;
options_type _options;
seastar::shared_ptr<seastar::tls::certificate_credentials> _credentials;
invoke_on_others_type _invoke_on_others;
seastar::gate _gate;
unsigned _reload_count = 0;
};
} // namespace vector_search