mirror of
https://gitee.com/openharmony/distributeddatamgr_datamgr_service
synced 2024-12-02 20:30:36 +00:00
commit
2817719346
@ -49,14 +49,14 @@ void RadarReporter::Report(const RadarParam ¶m, const char *funcName, int32_
|
||||
BIZ_SCENE_LABEL, param.scene_, BIZ_STAGE_LABEL, param.stage_, BIZ_STATE_LABEL, state, STAGE_RES_LABEL, res,
|
||||
ERROR_CODE_LABEL, param.errCode_, HOST_PKG, param.bundleName_, LOCAL_UUID_LABEL,
|
||||
AnonymousUuid(DmAdapter::GetInstance().GetLocalDevice().uuid), CONCURRENT_ID,
|
||||
std::to_string(param.syncId_));
|
||||
std::to_string(param.syncId_), TRIGGER_MODE, param.triggerMode_, WATER_VERSION, param.dataChange_);
|
||||
} else {
|
||||
HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_DATAMGR, eventName,
|
||||
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, ORG_PKG_LABEL, ORG_PKG, FUNC_LABEL, funcName,
|
||||
BIZ_SCENE_LABEL, param.scene_, BIZ_STAGE_LABEL, param.stage_, STAGE_RES_LABEL, res, ERROR_CODE_LABEL,
|
||||
param.errCode_, HOST_PKG, param.bundleName_, LOCAL_UUID_LABEL,
|
||||
AnonymousUuid(DmAdapter::GetInstance().GetLocalDevice().uuid), CONCURRENT_ID,
|
||||
std::to_string(param.syncId_));
|
||||
std::to_string(param.syncId_), TRIGGER_MODE, param.triggerMode_, WATER_VERSION, param.dataChange_);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -70,6 +70,8 @@ struct RadarParam {
|
||||
int32_t scene_ = CLOUD_SYNC;
|
||||
int32_t stage_ = GENERAL_STAGE;
|
||||
uint64_t syncId_ = 0;
|
||||
int32_t triggerMode_ = 0;
|
||||
bool dataChange_ = false;
|
||||
int32_t errCode_ = 0;
|
||||
int32_t res_ = RES_SUCCESS;
|
||||
};
|
||||
@ -102,6 +104,8 @@ private:
|
||||
static constexpr const char *REPLACE_CHAIN = "**";
|
||||
static constexpr const char *DEFAULT_ANONYMOUS = "************";
|
||||
static constexpr const char *CONCURRENT_ID = "CONCURRENT_ID";
|
||||
static constexpr const char *TRIGGER_MODE = "TRIGGER_MODE";
|
||||
static constexpr const char *WATER_VERSION = "WATER_VERSION";
|
||||
static constexpr const int32_t NO_ERROR = 0;
|
||||
static constexpr const int32_t HEAD_SIZE = 5;
|
||||
static constexpr const int32_t END_SIZE = 5;
|
||||
|
@ -22,7 +22,7 @@ SyncEvent::EventInfo::EventInfo(int32_t mode, int32_t wait, bool retry, std::sha
|
||||
}
|
||||
SyncEvent::EventInfo::EventInfo(const SyncParam &syncParam, bool retry, std::shared_ptr<GenQuery> query, GenAsync async)
|
||||
: retry_(retry), mode_(syncParam.mode), wait_(syncParam.wait), query_(std::move(query)),
|
||||
asyncDetail_(std::move(async)), isCompensation_(syncParam.isCompensation)
|
||||
asyncDetail_(std::move(async)), isCompensation_(syncParam.isCompensation), triggerMode_(syncParam.triggerMode)
|
||||
{
|
||||
}
|
||||
|
||||
@ -42,6 +42,7 @@ SyncEvent::EventInfo &SyncEvent::EventInfo::operator=(SyncEvent::EventInfo &&inf
|
||||
query_ = std::move(info.query_);
|
||||
asyncDetail_ = std::move(info.asyncDetail_);
|
||||
isCompensation_ = info.isCompensation_;
|
||||
triggerMode_ = info.triggerMode_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -84,4 +85,9 @@ bool SyncEvent::IsCompensation() const
|
||||
{
|
||||
return info_.isCompensation_;
|
||||
}
|
||||
|
||||
int32_t SyncEvent::GetTriggerMode() const
|
||||
{
|
||||
return info_.triggerMode_;
|
||||
}
|
||||
} // namespace OHOS::DistributedData
|
@ -37,6 +37,7 @@ public:
|
||||
std::shared_ptr<GenQuery> query_;
|
||||
GenAsync asyncDetail_;
|
||||
bool isCompensation_ = false;
|
||||
int32_t triggerMode_ = MODE_DEFAULT;
|
||||
};
|
||||
SyncEvent(StoreInfo storeInfo, EventInfo info);
|
||||
~SyncEvent() override = default;
|
||||
@ -46,7 +47,7 @@ public:
|
||||
std::shared_ptr<GenQuery> GetQuery() const;
|
||||
GenAsync GetAsyncDetail() const;
|
||||
bool IsCompensation() const;
|
||||
|
||||
int32_t GetTriggerMode() const;
|
||||
protected:
|
||||
SyncEvent(int32_t evtId, StoreInfo storeInfo, EventInfo info);
|
||||
|
||||
|
@ -31,6 +31,14 @@ enum GenProgress {
|
||||
SYNC_FINISH,
|
||||
};
|
||||
|
||||
enum SyncTriggerMode {
|
||||
MODE_DEFAULT = 0,
|
||||
MODE_PUSH,
|
||||
MODE_ONLINE,
|
||||
MODE_UNLOCK,
|
||||
MODE_BROADCASTER,
|
||||
};
|
||||
|
||||
struct GenStatistic {
|
||||
uint32_t total;
|
||||
uint32_t success;
|
||||
@ -47,6 +55,7 @@ struct GenProgressDetail {
|
||||
int32_t progress;
|
||||
int32_t code;
|
||||
int32_t dbCode;
|
||||
bool dataChange = false;
|
||||
std::map<std::string, GenTableDetail> details;
|
||||
};
|
||||
|
||||
@ -86,6 +95,7 @@ struct SyncParam {
|
||||
int32_t mode;
|
||||
int32_t wait;
|
||||
bool isCompensation = false;
|
||||
int32_t triggerMode = MODE_DEFAULT;
|
||||
};
|
||||
|
||||
using Assets = std::vector<Asset>;
|
||||
|
@ -165,7 +165,8 @@ int32_t CloudServiceImpl::ChangeAppSwitch(const std::string &id, const std::stri
|
||||
}
|
||||
Execute(GenTask(0, cloudInfo.user, { WORK_CLOUD_INFO_UPDATE, WORK_SCHEMA_UPDATE, WORK_SUB }));
|
||||
if (cloudInfo.enableCloud && appSwitch == SWITCH_ON) {
|
||||
syncManager_.DoCloudSync({ cloudInfo.user, bundleName });
|
||||
SyncManager::SyncInfo info(cloudInfo.user, bundleName);
|
||||
syncManager_.DoCloudSync(info);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
@ -320,7 +321,7 @@ std::map<std::string, std::vector<std::string>> CloudServiceImpl::GetDbInfoFromE
|
||||
return dbInfos;
|
||||
}
|
||||
|
||||
bool CloudServiceImpl::DoKvCloudSync(int32_t userId, const std::string &bundleName)
|
||||
bool CloudServiceImpl::DoKvCloudSync(int32_t userId, const std::string &bundleName, int32_t triggerMode)
|
||||
{
|
||||
auto stores = CheckerManager::GetInstance().GetDynamicStores();
|
||||
auto staticStores = CheckerManager::GetInstance().GetStaticStores();
|
||||
@ -343,7 +344,7 @@ bool CloudServiceImpl::DoKvCloudSync(int32_t userId, const std::string &bundleNa
|
||||
}
|
||||
for (auto user : users) {
|
||||
for (auto &store : stores) {
|
||||
syncManager_.DoCloudSync(SyncManager::SyncInfo(user, store.bundleName, store.storeId));
|
||||
syncManager_.DoCloudSync(SyncManager::SyncInfo(user, store.bundleName, store.storeId, {}, triggerMode));
|
||||
}
|
||||
}
|
||||
return found;
|
||||
@ -384,7 +385,7 @@ int32_t CloudServiceImpl::NotifyDataChange(const std::string &eventId, const std
|
||||
ZLOGD("invalid user:%{public}d", user);
|
||||
return INVALID_ARGUMENT;
|
||||
}
|
||||
if (DoKvCloudSync(cloudInfo.user, exData.info.bundleName)) {
|
||||
if (DoKvCloudSync(cloudInfo.user, exData.info.bundleName, MODE_PUSH)) {
|
||||
continue;
|
||||
}
|
||||
auto schemaKey = CloudInfo::GetSchemaKey(user, exData.info.bundleName);
|
||||
@ -400,7 +401,7 @@ int32_t CloudServiceImpl::NotifyDataChange(const std::string &eventId, const std
|
||||
}
|
||||
for (auto &dbInfo : dbInfos) {
|
||||
syncManager_.DoCloudSync(
|
||||
SyncManager::SyncInfo(cloudInfo.user, exData.info.bundleName, dbInfo.first, dbInfo.second));
|
||||
SyncManager::SyncInfo(cloudInfo.user, exData.info.bundleName, dbInfo.first, dbInfo.second, MODE_PUSH));
|
||||
}
|
||||
}
|
||||
return SUCCESS;
|
||||
@ -649,7 +650,7 @@ int32_t CloudServiceImpl::OnUserChange(uint32_t code, const std::string &user, c
|
||||
|
||||
int32_t CloudServiceImpl::OnScreenUnlocked(int32_t user)
|
||||
{
|
||||
DoKvCloudSync(user);
|
||||
DoKvCloudSync(user, "", MODE_UNLOCK);
|
||||
return E_OK;
|
||||
}
|
||||
|
||||
@ -664,7 +665,7 @@ int32_t CloudServiceImpl::OnReady(const std::string& device)
|
||||
return SUCCESS;
|
||||
}
|
||||
for (auto user : users) {
|
||||
DoKvCloudSync(user);
|
||||
DoKvCloudSync(user, "", MODE_ONLINE);
|
||||
Execute(GenTask(0, user, { WORK_CLOUD_INFO_UPDATE, WORK_SCHEMA_UPDATE, WORK_DO_CLOUD_SYNC, WORK_SUB }));
|
||||
}
|
||||
return SUCCESS;
|
||||
@ -1000,7 +1001,8 @@ bool CloudServiceImpl::ReleaseUserInfo(int32_t user)
|
||||
|
||||
bool CloudServiceImpl::DoCloudSync(int32_t user)
|
||||
{
|
||||
syncManager_.DoCloudSync(user);
|
||||
SyncManager::SyncInfo info(user);
|
||||
syncManager_.DoCloudSync(info);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ private:
|
||||
const DistributedData::ExtraData &extraData, const SchemaMeta &schemaMeta);
|
||||
std::shared_ptr<DistributedData::SharingCenter> GetSharingHandle(const HapInfo& hapInfo);
|
||||
bool GetStoreMetaData(StoreMetaData &meta);
|
||||
bool DoKvCloudSync(int32_t userId, const std::string &bundleName = "");
|
||||
bool DoKvCloudSync(int32_t userId, const std::string &bundleName = "", int32_t triggerMode = 0);
|
||||
|
||||
using SaveStrategy = int32_t (*)(const std::vector<CommonType::Value> &values, const HapInfo &hapInfo);
|
||||
static const SaveStrategy STRATEGY_SAVERS[Strategy::STRATEGY_BUTT];
|
||||
|
@ -40,8 +40,9 @@ using Account = OHOS::DistributedKv::AccountDelegate;
|
||||
using DmAdapter = OHOS::DistributedData::DeviceManagerAdapter;
|
||||
using Defer = EventCenter::Defer;
|
||||
std::atomic<uint32_t> SyncManager::genId_ = 0;
|
||||
SyncManager::SyncInfo::SyncInfo(int32_t user, const std::string &bundleName, const Store &store, const Tables &tables)
|
||||
: user_(user), bundleName_(bundleName)
|
||||
SyncManager::SyncInfo::SyncInfo(
|
||||
int32_t user, const std::string &bundleName, const Store &store, const Tables &tables, int32_t triggerMode)
|
||||
: user_(user), bundleName_(bundleName), triggerMode_(triggerMode)
|
||||
{
|
||||
if (!store.empty()) {
|
||||
tables_[store] = tables;
|
||||
@ -90,6 +91,11 @@ void SyncManager::SyncInfo::SetCompensation(bool isCompensation)
|
||||
isCompensation_ = isCompensation;
|
||||
}
|
||||
|
||||
void SyncManager::SyncInfo::SetTriggerMode(int32_t triggerMode)
|
||||
{
|
||||
triggerMode_ = triggerMode;
|
||||
}
|
||||
|
||||
void SyncManager::SyncInfo::SetError(int32_t code) const
|
||||
{
|
||||
if (async_) {
|
||||
@ -234,7 +240,7 @@ std::function<void()> SyncManager::GetPostEventTask(const std::vector<SchemaMeta
|
||||
continue;
|
||||
}
|
||||
auto query = info.GenerateQuery(database.name, database.GetTableNames());
|
||||
SyncParam syncParam = { info.mode_, info.wait_, info.isCompensation_ };
|
||||
SyncParam syncParam = { info.mode_, info.wait_, info.isCompensation_, info.triggerMode_ };
|
||||
auto evt = std::make_unique<SyncEvent>(std::move(storeInfo),
|
||||
SyncEvent::EventInfo{ syncParam, retry, std::move(query), info.async_ });
|
||||
EventCenter::GetInstance().PostEvent(std::move(evt));
|
||||
@ -318,10 +324,12 @@ std::function<void(const Event &)> SyncManager::GetSyncHandler(Retryer retryer)
|
||||
ZLOGD("database:<%{public}d:%{public}s:%{public}s> sync start", storeInfo.user, storeInfo.bundleName.c_str(),
|
||||
meta.GetStoreAlias().c_str());
|
||||
RadarReporter::Report(
|
||||
{ storeInfo.bundleName.c_str(), CLOUD_SYNC, TRIGGER_SYNC, storeInfo.syncId }, "GetSyncHandler", BEGIN);
|
||||
{ storeInfo.bundleName.c_str(), CLOUD_SYNC, TRIGGER_SYNC, storeInfo.syncId, evt.GetTriggerMode() },
|
||||
"GetSyncHandler", BEGIN);
|
||||
SyncParam syncParam = { evt.GetMode(), evt.GetWait(), evt.IsCompensation() };
|
||||
auto status = store->Sync({ SyncInfo::DEFAULT_ID }, *(evt.GetQuery()),
|
||||
evt.AutoRetry() ? RetryCallback(storeInfo, retryer) : GetCallback(evt.GetAsyncDetail(), storeInfo),
|
||||
evt.AutoRetry() ? RetryCallback(storeInfo, retryer, evt.GetTriggerMode())
|
||||
: GetCallback(evt.GetAsyncDetail(), storeInfo, evt.GetTriggerMode()),
|
||||
syncParam);
|
||||
if (status != E_OK) {
|
||||
if (async) {
|
||||
@ -332,8 +340,8 @@ std::function<void(const Event &)> SyncManager::GetSyncHandler(Retryer retryer)
|
||||
return;
|
||||
}
|
||||
int32_t errCode = status + GenStore::DB_ERR_OFFSET;
|
||||
RadarReporter::Report({ storeInfo.bundleName.c_str(), CLOUD_SYNC, FINISH_SYNC, storeInfo.syncId, errCode },
|
||||
"GetSyncHandler", END);
|
||||
RadarReporter::Report({ storeInfo.bundleName.c_str(), CLOUD_SYNC, FINISH_SYNC, storeInfo.syncId,
|
||||
evt.GetTriggerMode(), false, errCode }, "GetSyncHandler", END);
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -349,6 +357,7 @@ std::function<void(const Event &)> SyncManager::GetClientChangeHandler()
|
||||
syncInfo.SetAsyncDetail(evt.GetAsyncDetail());
|
||||
syncInfo.SetQuery(evt.GetQuery());
|
||||
syncInfo.SetCompensation(evt.IsCompensation());
|
||||
syncInfo.SetTriggerMode(evt.GetTriggerMode());
|
||||
auto times = evt.AutoRetry() ? RETRY_TIMES - CLIENT_RETRY_TIMES : RETRY_TIMES;
|
||||
executor_->Execute(GetSyncTask(times, evt.AutoRetry(), RefCount(), std::move(syncInfo)));
|
||||
};
|
||||
@ -363,7 +372,8 @@ SyncManager::Retryer SyncManager::GetRetryer(int32_t times, const SyncInfo &sync
|
||||
}
|
||||
info.SetError(code);
|
||||
RadarReporter::Report(
|
||||
{ info.bundleName_.c_str(), CLOUD_SYNC, FINISH_SYNC, info.syncId_, dbCode }, "GetRetryer", END);
|
||||
{ info.bundleName_.c_str(), CLOUD_SYNC, FINISH_SYNC, info.syncId_, info.triggerMode_, false, dbCode },
|
||||
"GetRetryer", END);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
@ -374,7 +384,8 @@ SyncManager::Retryer SyncManager::GetRetryer(int32_t times, const SyncInfo &sync
|
||||
if (code == E_NO_SPACE_FOR_ASSET || code == E_RECODE_LIMIT_EXCEEDED) {
|
||||
info.SetError(code);
|
||||
RadarReporter::Report(
|
||||
{ info.bundleName_.c_str(), CLOUD_SYNC, FINISH_SYNC, info.syncId_, dbCode }, "GetRetryer", END);
|
||||
{ info.bundleName_.c_str(), CLOUD_SYNC, FINISH_SYNC, info.syncId_, info.triggerMode_, false, dbCode },
|
||||
"GetRetryer", END);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -591,9 +602,9 @@ void SyncManager::UpdateFinishSyncInfo(const QueryKey &queryKey, uint64_t syncId
|
||||
}
|
||||
|
||||
std::function<void(const GenDetails &result)> SyncManager::GetCallback(const GenAsync &async,
|
||||
const StoreInfo &storeInfo)
|
||||
const StoreInfo &storeInfo, int32_t triggerMode)
|
||||
{
|
||||
return [this, async, storeInfo](const GenDetails &result) {
|
||||
return [this, async, storeInfo, triggerMode](const GenDetails &result) {
|
||||
if (async != nullptr) {
|
||||
async(result);
|
||||
}
|
||||
@ -620,8 +631,9 @@ std::function<void(const GenDetails &result)> SyncManager::GetCallback(const Gen
|
||||
int32_t code = result.begin()->second.code;
|
||||
int32_t dbCode = (result.begin()->second.dbCode == GenStore::DB_ERR_OFFSET) ? 0 : result.begin()->second.dbCode;
|
||||
UpdateFinishSyncInfo(queryKey, storeInfo.syncId, code);
|
||||
RadarReporter::Report(
|
||||
{ storeInfo.bundleName.c_str(), CLOUD_SYNC, FINISH_SYNC, storeInfo.syncId, dbCode }, "GetCallback", END);
|
||||
RadarReporter::Report({ storeInfo.bundleName.c_str(), CLOUD_SYNC, FINISH_SYNC, storeInfo.syncId, triggerMode,
|
||||
result.begin()->second.dataChange, dbCode },
|
||||
"GetCallback", END);
|
||||
};
|
||||
}
|
||||
|
||||
@ -680,9 +692,9 @@ bool SyncManager::InitDefaultUser(int32_t &user)
|
||||
}
|
||||
|
||||
std::function<void(const DistributedData::GenDetails &result)> SyncManager::RetryCallback(
|
||||
const StoreInfo &storeInfo, Retryer retryer)
|
||||
const StoreInfo &storeInfo, Retryer retryer, int32_t triggerMode)
|
||||
{
|
||||
return [this, retryer, storeInfo](const GenDetails &details) {
|
||||
return [this, retryer, storeInfo, triggerMode](const GenDetails &details) {
|
||||
if (details.empty()) {
|
||||
ZLOGE("retry, details empty");
|
||||
return;
|
||||
@ -693,8 +705,9 @@ std::function<void(const DistributedData::GenDetails &result)> SyncManager::Retr
|
||||
QueryKey queryKey{ GetAccountId(storeInfo.user), storeInfo.bundleName, "" };
|
||||
UpdateFinishSyncInfo(queryKey, storeInfo.syncId, code);
|
||||
if (code == E_OK) {
|
||||
RadarReporter::Report(
|
||||
{ storeInfo.bundleName.c_str(), CLOUD_SYNC, FINISH_SYNC, storeInfo.syncId }, "RetryCallback", END);
|
||||
RadarReporter::Report({ storeInfo.bundleName.c_str(), CLOUD_SYNC, FINISH_SYNC, storeInfo.syncId,
|
||||
triggerMode, details.begin()->second.dataChange },
|
||||
"RetryCallback", END);
|
||||
}
|
||||
}
|
||||
retryer(GetInterval(code), code, dbCode);
|
||||
|
@ -46,7 +46,8 @@ public:
|
||||
using Stores = std::vector<Store>;
|
||||
using Tables = std::vector<std::string>;
|
||||
using MutliStoreTables = std::map<Store, Tables>;
|
||||
SyncInfo(int32_t user, const std::string &bundleName = "", const Store &store = "", const Tables &tables = {});
|
||||
explicit SyncInfo(int32_t user, const std::string &bundleName = "", const Store &store = "",
|
||||
const Tables &tables = {}, int32_t triggerMode = 0);
|
||||
SyncInfo(int32_t user, const std::string &bundleName, const Stores &stores);
|
||||
SyncInfo(int32_t user, const std::string &bundleName, const MutliStoreTables &tables);
|
||||
void SetMode(int32_t mode);
|
||||
@ -55,6 +56,7 @@ public:
|
||||
void SetQuery(std::shared_ptr<GenQuery> query);
|
||||
void SetError(int32_t code) const;
|
||||
void SetCompensation(bool isCompensation);
|
||||
void SetTriggerMode(int32_t triggerMode);
|
||||
std::shared_ptr<GenQuery> GenerateQuery(const std::string &store, const Tables &tables);
|
||||
bool Contains(const std::string &storeName);
|
||||
inline static constexpr const char *DEFAULT_ID = "default";
|
||||
@ -71,6 +73,7 @@ public:
|
||||
GenAsync async_;
|
||||
std::shared_ptr<GenQuery> query_;
|
||||
bool isCompensation_ = false;
|
||||
int32_t triggerMode_ = 0;
|
||||
};
|
||||
SyncManager();
|
||||
~SyncManager();
|
||||
@ -120,13 +123,13 @@ private:
|
||||
void UpdateStartSyncInfo(const std::vector<std::tuple<QueryKey, uint64_t>> &cloudSyncInfos);
|
||||
void UpdateFinishSyncInfo(const QueryKey &queryKey, uint64_t syncId, int32_t code);
|
||||
std::function<void(const DistributedData::GenDetails &result)> GetCallback(const GenAsync &async,
|
||||
const StoreInfo &storeInfo);
|
||||
const StoreInfo &storeInfo, int32_t triggerMode);
|
||||
std::function<void()> GetPostEventTask(const std::vector<SchemaMeta> &schemas, CloudInfo &cloud, SyncInfo &info,
|
||||
bool retry);
|
||||
void DoExceptionalCallback(const GenAsync &async, GenDetails &details, const StoreInfo &storeInfo);
|
||||
bool InitDefaultUser(int32_t &user);
|
||||
std::function<void(const DistributedData::GenDetails &result)> RetryCallback(
|
||||
const StoreInfo &storeInfo, Retryer retryer);
|
||||
const StoreInfo &storeInfo, Retryer retryer, int32_t triggerMode);
|
||||
static void GetLastResults(
|
||||
const std::string &storeId, std::map<SyncId, CloudSyncInfo> &infos, QueryLastResults &results);
|
||||
|
||||
|
@ -650,7 +650,6 @@ KVDBGeneralStore::DBProcessCB KVDBGeneralStore::GetDBProcessCB(DetailAsync async
|
||||
return;
|
||||
}
|
||||
DistributedData::GenDetails details;
|
||||
bool downloadFinished = false;
|
||||
for (auto &[id, process] : processes) {
|
||||
auto &detail = details[id];
|
||||
detail.progress = process.process;
|
||||
@ -666,14 +665,16 @@ KVDBGeneralStore::DBProcessCB KVDBGeneralStore::GetDBProcessCB(DetailAsync async
|
||||
table.download.success = value.downLoadInfo.successCount;
|
||||
table.download.failed = value.downLoadInfo.failCount;
|
||||
table.download.untreated = table.download.total - table.download.success - table.download.failed;
|
||||
downloadFinished = downloadFinished ||
|
||||
(process.process == FINISHED && value.downLoadInfo.successCount > 0);
|
||||
detail.dataChange = detail.dataChange ||
|
||||
(process.process == FINISHED &&
|
||||
(value.downLoadInfo.insertCount > 0 || value.downLoadInfo.updateCount > 0 ||
|
||||
value.downLoadInfo.deleteCount > 0));
|
||||
}
|
||||
}
|
||||
if (async) {
|
||||
async(details);
|
||||
}
|
||||
if (downloadFinished && callback) {
|
||||
if (!details.empty() && details.begin()->second.dataChange && callback) {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
@ -1021,7 +1021,7 @@ void KVDBServiceImpl::DoCloudSync(bool statics, bool dynamic)
|
||||
stores.insert(stores.end(), dynamicStores.begin(), dynamicStores.end());
|
||||
}
|
||||
for (const auto &store : stores) {
|
||||
auto status = CloudSync({ store.bundleName }, { store.storeId }, {});
|
||||
auto status = CloudSync({ store.bundleName }, { store.storeId }, { .triggerMode = MODE_BROADCASTER });
|
||||
if (status != SUCCESS) {
|
||||
ZLOGW("cloud sync failed:%{public}d, appId:%{public}s storeId:%{public}s", status,
|
||||
store.bundleName.c_str(), Anonymous::Change(store.storeId).c_str());
|
||||
@ -1069,7 +1069,7 @@ Status KVDBServiceImpl::DoCloudSync(const StoreMetaData &meta, const SyncInfo &s
|
||||
};
|
||||
auto mixMode = static_cast<int32_t>(GeneralStore::MixMode(GeneralStore::CLOUD_TIME_FIRST,
|
||||
meta.isAutoSync ? GeneralStore::AUTO_SYNC_MODE : GeneralStore::MANUAL_SYNC_MODE));
|
||||
auto info = ChangeEvent::EventInfo(mixMode, 0, false, nullptr, syncCallback);
|
||||
auto info = ChangeEvent::EventInfo({ mixMode, 0, false, syncInfo.triggerMode }, false, nullptr, syncCallback);
|
||||
auto evt = std::make_unique<ChangeEvent>(std::move(storeInfo), std::move(info));
|
||||
EventCenter::GetInstance().PostEvent(std::move(evt));
|
||||
return SUCCESS;
|
||||
|
@ -690,6 +690,10 @@ RdbGeneralStore::DBProcessCB RdbGeneralStore::GetDBProcessCB(DetailAsync async,
|
||||
table.download.success = value.downLoadInfo.successCount;
|
||||
table.download.failed = value.downLoadInfo.failCount;
|
||||
table.download.untreated = table.download.total - table.download.success - table.download.failed;
|
||||
detail.dataChange = detail.dataChange ||
|
||||
(process.process == FINISHED &&
|
||||
(value.downLoadInfo.insertCount > 0 || value.downLoadInfo.updateCount > 0 ||
|
||||
value.downLoadInfo.deleteCount > 0));
|
||||
}
|
||||
}
|
||||
if (async) {
|
||||
|
Loading…
Reference in New Issue
Block a user