Files
IM/MessageSystem/storage/Storage.cpp

32 lines
802 B
C++

//
// Created by dongl on 23-5-29.
//
#include "Storage.h"
MSG::Storage::Storage(TimeLine<MSGFormat::Storage *> *timeLine, db_base* db) : m_timeLine(timeLine), m_db(db) {}
MSG::Storage::Storage() {
m_timeLine = new TimeLine<MSGFormat::Storage*>();
m_db = new db_base();
}
// 储存库 push
void MSG::Storage::push(MSGFormat::Storage* msg) {
// 添加至信箱
m_timeLine->push(msg);
auto coll = m_db->hit_db_coll("im_session", "chat");
coll.find_one(make_document(kvp("count", 1)));
}
void MSG::Storage::pull() {
// m_timeLine->pull();
auto coll = m_db->hit_db_coll("im_session", "chat");
auto temp = coll.find_one(make_document(kvp("count", 1)));
// if (temp) {
// std::cout << temp->find("_id")->get_oid().value.to_string() << std::endl;
// }
}