SessionStore::Session* SessionStore::get_session_data(const std::string& call_id, const role_of_node_t role, const node_functionality_t function, SAS::TrailId trail) { std::string key = create_key(call_id, role, function); LOG_DEBUG("Retrieving session data for %s", key.c_str()); Session* rc = NULL; std::string data; uint64_t cas; Store::Status status = _store->get_data("session", key, data, cas, trail); if (status == Store::Status::OK && !data.empty()) { rc = deserialize_session(data); rc->_cas = cas; LOG_DEBUG("Retrieved record, CAS = %ld", rc->_cas); } return rc; }
SessionStore::Session* SessionStore::get_session_data(const std::string& call_id, const role_of_node_t role, const node_functionality_t function, SAS::TrailId trail) { std::string key = create_key(call_id, role, function); TRC_DEBUG("Retrieving session data for %s", key.c_str()); Session* session = NULL; std::string data; uint64_t cas; Store::Status status = _store->get_data("session", key, data, cas, trail); if (status == Store::Status::OK && !data.empty()) { // Retrieved the data, so deserialize it. TRC_DEBUG("Retrieved record, CAS = %ld", cas); session = deserialize_session(data); if (session != NULL) { session->_cas = cas; } else { // Could not deserialize the record. Treat it as not found. TRC_INFO("Failed to deserialize record"); SAS::Event event(trail, SASEvent::SESSION_DESERIALIZATION_FAILED, 0); event.add_var_param(call_id); event.add_var_param(data); SAS::report_event(event); } } return session; }