20 #ifndef MPD_NFS_MANAGER_HXX
21 #define MPD_NFS_MANAGER_HXX
28 #include <boost/intrusive/set.hpp>
29 #include <boost/intrusive/slist.hpp>
38 const char *export_name;
41 class ManagedConnection final
43 public boost::intrusive::slist_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>>,
44 public boost::intrusive::set_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>> {
50 const char *_export_name)
56 void OnNfsConnectionError(std::exception_ptr &&
e)
override;
61 bool operator()(
const LookupKey a,
62 const ManagedConnection &b)
const noexcept;
65 bool operator()(
const ManagedConnection &a,
66 const LookupKey b)
const noexcept;
69 bool operator()(
const ManagedConnection &a,
70 const ManagedConnection &b)
const noexcept;
76 typedef boost::intrusive::set<ManagedConnection,
77 boost::intrusive::compare<Compare>,
78 boost::intrusive::constant_time_size<false>> Map;
82 typedef boost::intrusive::slist<ManagedConnection> List;
102 const char *export_name) noexcept;
105 void ScheduleDelete(ManagedConnection &c) {
106 connections.erase(connections.iterator_to(c));
107 garbage.push_front(c);
114 void CollectGarbage();
117 void OnIdle()
override;
~NfsManager()
Must be run from EventLoop's thread.
An event that runs when the EventLoop has become idle, before waiting for more events.
An event loop that polls for events on file/socket descriptors.
NfsManager(EventLoop &_loop)
A manager for NFS connections.
An asynchronous connection to a NFS server.
gcc_pure NfsConnection & GetConnection(const char *server, const char *export_name) noexcept