|
static std::unique_ptr
< SessionsStore > | create (const std::string &base_path, size_t n_workers, int idle_session_duration, int max_session_duration, int capacity, DisconnectCallback disconnect_callback) |
|
Definition at line 114 of file SessionsStore.cpp.
CachedSessionStore::CachedSessionStore |
( |
int |
idle_session_duration, |
|
|
int |
max_session_duration, |
|
|
int |
capacity, |
|
|
DisconnectCallback |
disconnect_callback |
|
) |
| |
|
inline |
Definition at line 116 of file SessionsStore.cpp.
122 ,
capacity_(capacity > 0 ? capacity : INT_MAX)
const int max_session_duration_
const int idle_session_duration_
DisconnectCallback disconnect_callback_
CachedSessionStore::~CachedSessionStore |
( |
| ) |
|
|
inlineoverride |
Definition at line 196 of file SessionsStore.cpp.
std::lock_guard< T > lock_guard
std::unordered_map< std::string, SessionInfoPtr > sessions_
heavyai::shared_mutex mtx_
Implements Catalog_Namespace::SessionsStore.
Definition at line 125 of file SessionsStore.cpp.
References cat(), generate_random_string(), Catalog_Namespace::SESSION_ID_LENGTH, and UNREACHABLE.
130 std::vector<SessionInfoPtr> expired_sessions;
133 expired_sessions.push_back(it->second);
136 for (
auto& session_ptr : expired_sessions) {
140 }
catch (
const std::exception& e) {
152 auto session_ptr = std::make_shared<Catalog_Namespace::SessionInfo>(
153 cat, user_meta, device, session_id);
159 throw std::runtime_error(
"Too many active sessions");
std::lock_guard< T > lock_guard
const int max_session_duration_
std::unordered_map< std::string, SessionInfoPtr > sessions_
const int idle_session_duration_
void eraseUnlocked(const std::string &session_id) override
bool isSessionExpired(const SessionInfoPtr &session_ptr, int idle_session_duration, int max_session_duration)
const size_t SESSION_ID_LENGTH
DisconnectCallback disconnect_callback_
heavyai::shared_mutex mtx_
void CachedSessionStore::eraseIf |
( |
std::function< bool(const SessionInfoPtr &)> |
predicate | ) |
|
|
inlineoverridevirtual |
void CachedSessionStore::eraseUnlocked |
( |
const std::string & |
session_id | ) |
|
|
inlineoverrideprotectedvirtual |
SessionInfoPtr CachedSessionStore::get |
( |
const std::string & |
session_id | ) |
|
|
inlineoverridevirtual |
Implements Catalog_Namespace::SessionsStore.
Definition at line 162 of file SessionsStore.cpp.
References Catalog_Namespace::SessionsStore::isSessionExpired().
166 if (SessionsStore::isSessionExpired(
171 }
catch (
const std::exception& e) {
177 session_ptr->update_last_used_time();
std::lock_guard< T > lock_guard
const int max_session_duration_
const int idle_session_duration_
void eraseUnlocked(const std::string &session_id) override
DisconnectCallback disconnect_callback_
SessionInfoPtr getUnlocked(const std::string &session_id) override
heavyai::shared_mutex mtx_
|
inlineoverrideprotectedvirtual |
|
inlineoverrideprotectedvirtual |
Implements Catalog_Namespace::SessionsStore.
Definition at line 219 of file SessionsStore.cpp.
221 std::vector<SessionInfoPtr> out;
225 if (predicate(session)) {
226 out.push_back(session);
std::unordered_map< std::string, SessionInfoPtr > sessions_
std::shared_lock< T > shared_lock
heavyai::shared_mutex & getLock() override
SessionInfoPtr CachedSessionStore::getUnlocked |
( |
const std::string & |
session_id | ) |
|
|
inlineoverrideprotectedvirtual |
bool CachedSessionStore::isSessionInUse |
( |
const SessionInfoPtr & |
session_ptr | ) |
|
|
inlineoverrideprotectedvirtual |
const int CachedSessionStore::capacity_ |
|
private |
const int CachedSessionStore::idle_session_duration_ |
|
private |
const int CachedSessionStore::max_session_duration_ |
|
private |
std::unordered_map<std::string, SessionInfoPtr> CachedSessionStore::sessions_ |
|
private |
The documentation for this class was generated from the following file: