退账号开库时注册监听

Signed-off-by: Hollokin <taoyuxin2@huawei.com>
This commit is contained in:
Hollokin 2024-09-02 15:50:24 +08:00
parent 8102be4f68
commit ae24a19294
4 changed files with 9 additions and 4 deletions

View File

@ -27,6 +27,7 @@ public:
FEATURE_INIT = EVT_CLOUD,
GET_SCHEMA,
LOCAL_CHANGE,
CLEAN_DATA,
CLOUD_SYNC,
DATA_CHANGE,
SET_SEARCHABLE,

View File

@ -211,6 +211,11 @@ void CloudServiceImpl::DoClean(int32_t user, const SchemaMeta &schemaMeta, int32
ZLOGE("store null, storeId:%{public}s", meta.GetStoreAlias().c_str());
continue;
}
DistributedData::StoreInfo storeInfo;
storeInfo.bundleName = meta.bundleName;
storeInfo.user = atoi(meta.user.c_str());
storeInfo.storeName = meta.storeId;
EventCenter::GetInstance().PostEvent(std::make_unique<CloudEvent>(CloudEvent::CLEAN_DATA, storeInfo));
auto status = store->Clean({}, action, "");
if (status != E_OK) {
ZLOGW("remove device data status:%{public}d, user:%{public}d, bundleName:%{public}s, "

View File

@ -99,10 +99,7 @@ void KVDBServiceImpl::Init()
auto process = [this](const Event &event) {
const auto &evt = static_cast<const CloudEvent &>(event);
const auto &storeInfo = evt.GetStoreInfo();
StoreMetaData meta;
meta.storeId = storeInfo.storeName;
meta.bundleName = storeInfo.bundleName;
meta.user = std::to_string(storeInfo.user);
StoreMetaData meta(storeInfo);
meta.deviceId = DMAdapter::GetInstance().GetLocalDevice().uuid;
if (!MetaDataManager::GetInstance().LoadMeta(meta.GetKey(), meta, true)) {
if (meta.user == "0") {
@ -132,6 +129,7 @@ void KVDBServiceImpl::Init()
store->RegisterDetailProgressObserver(nullptr);
};
EventCenter::GetInstance().Subscribe(CloudEvent::CLOUD_SYNC, process);
EventCenter::GetInstance().Subscribe(CloudEvent::CLEAN_DATA, process);
}
void KVDBServiceImpl::RegisterKvServiceInfo()

View File

@ -120,6 +120,7 @@ RdbServiceImpl::RdbServiceImpl()
store->RegisterDetailProgressObserver(GetCallbacks(meta.tokenId, storeInfo.storeName));
};
EventCenter::GetInstance().Subscribe(CloudEvent::CLOUD_SYNC, process);
EventCenter::GetInstance().Subscribe(CloudEvent::CLEAN_DATA, process);
EventCenter::GetInstance().Subscribe(CloudEvent::MAKE_QUERY, [](const Event& event) {
auto& evt = static_cast<const MakeQueryEvent&>(event);