Signed-off-by: yangliu <yangliu178@huawei.com>
This commit is contained in:
yangliu 2024-11-18 22:45:37 +08:00
parent 3a83392ed1
commit 636163358a
3 changed files with 18 additions and 11 deletions

View File

@ -59,7 +59,7 @@ using system_clock = std::chrono::system_clock;
using DMAdapter = DistributedData::DeviceManagerAdapter;
using DumpManager = OHOS::DistributedData::DumpManager;
using CommContext = OHOS::DistributedData::CommunicatorContext;
using SecretKeyMeta = DistributedData::SecretKeyMetaData;
using SecretKeyMeta = DistributedData::SecretKeyMetaData;
static constexpr const char *DEFAULT_USER_ID = "0";
__attribute__((used)) KVDBServiceImpl::Factory KVDBServiceImpl::factory_;
KVDBServiceImpl::Factory::Factory()
@ -816,15 +816,7 @@ bool KVDBServiceImpl::IsTripleAutoLaunch(
if (storeMeta.bundleName == Bootstrap::GetInstance().GetProcessLabel()) {
param.userId = storeMeta.user;
}
option.schema = storeMeta.schema;
option.createDirByStoreIdOnly = true;
option.dataDir = storeMeta.dataDir;
option.secOption = ConvertSecurity(storeMeta.securityLevel);
option.isAutoSync = storeMeta.isAutoSync;
option.syncDualTupleMode = true; // dual tuple flag
param.appId = storeMeta.appId;
param.storeId = storeMeta.storeId;
param.option = option;
SetAutoLaunchParam(option, param);
isFindIdentifier = true;
return isTripleIdentifierEqual;
}
@ -833,6 +825,19 @@ bool KVDBServiceImpl::IsTripleAutoLaunch(
return false;
}
void KVDBServiceImpl::SetAutoLaunchParam(DistributedDB::AutoLaunchOption &option, DistributedDB::AutoLaunchParam &param)
{
option.schema = storeMeta.schema;
option.createDirByStoreIdOnly = true;
option.dataDir = storeMeta.dataDir;
option.secOption = ConvertSecurity(storeMeta.securityLevel);
option.isAutoSync = storeMeta.isAutoSync;
option.syncDualTupleMode = true; // dual tuple flag
param.appId = storeMeta.appId;
param.storeId = storeMeta.storeId;
param.option = option;
}
int32_t KVDBServiceImpl::DoTripleAutoLaunch(StoreMetaData &meta)
{
auto watchers = GetWatchers(meta.tokenId, meta.storeId);

View File

@ -156,6 +156,7 @@ private:
StoreMetaData &meta, bool &isFindIdentifier);
int32_t DoTripleAutoLaunch(StoreMetaData &meta);
DistributedDB::SecurityOption ConvertSecurity(int securityLevel);
void SetAutoLaunchParam(DistributedDB::AutoLaunchOption &option, DistributedDB::AutoLaunchParam &param);
Status ConvertDbStatusNative(DBStatus status);
static Factory factory_;
ConcurrentMap<uint32_t, SyncAgent> syncAgents_;

View File

@ -295,7 +295,8 @@ int32_t ObjectServiceImpl::ObjectStatic::OnAppUninstall(const std::string &bundl
return result;
}
int32_t ObjectServiceImpl::ResolveAutoLaunch(const std::string &identifier, DistributedDB::AutoLaunchParam &param, bool &isFindIdentifier)
int32_t ObjectServiceImpl::ResolveAutoLaunch(const std::string &identifier, DistributedDB::AutoLaunchParam &param,
bool &isFindIdentifier)
{
ZLOGI("start, user:%{public}s appId:%{public}s storeId:%{public}s identifier:%{public}s", param.userId.c_str(),
param.appId.c_str(), DistributedData::Anonymous::Change(param.storeId).c_str(),