1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_CLOUD_DISK_SERVICE_NOTIFY_CONST_H
17 #define OHOS_CLOUD_DISK_SERVICE_NOTIFY_CONST_H
18 
19 #include "clouddisk_db_const.h"
20 #include "cloud_disk_inode.h"
21 #include "values_bucket.h"
22 #include <string>
23 
24 namespace OHOS::FileManagement::CloudDisk {
25 
26 const std::string TYPE_DIR_STR = "directory";
27 
28 enum class NotifyOpsType : uint32_t {
29     DAEMON_SETXATTR = 0,
30     DAEMON_SETATTR,
31     DAEMON_RESTORE,
32     DAEMON_RECYCLE,
33     DAEMON_MKDIR,
34     DAEMON_RMDIR,
35     DAEMON_UNLINK,
36     DAEMON_RENAME,
37     DAEMON_WRITE,
38     SERVICE_INSERT,
39     SERVICE_UPDATE,
40     SERVICE_UPDATE_RECYCLE,
41     SERVICE_DELETE,
42     SERVICE_DELETE_BATCH,
43     OPS_NONE,
44 };
45 
46 using FindCloudDiskInodeFunc = std::function<std::shared_ptr<CloudDiskInode>(CloudDiskFuseData*, int64_t)>;
47 struct NotifyParamDisk {
48     CloudDiskFuseData *data = nullptr;
49     FindCloudDiskInodeFunc func;
50     NotifyOpsType opsType = NotifyOpsType::OPS_NONE;
51     std::shared_ptr<CloudDiskInode> inoPtr = nullptr;
52     fuse_ino_t ino = 0;
53     std::string name = "";
54     fuse_ino_t newIno = 0;
55     std::string newName = "";
56 };
57 
58 struct ParamDiskOthers {
59     int32_t dirtyType = static_cast<int32_t>(DirtyType::TYPE_NO_NEED_UPLOAD);
60     bool isDir = false;
61 };
62 
63 struct NotifyParamService {
64     NotifyOpsType opsType = NotifyOpsType::OPS_NONE;
65     std::string cloudId = "";
66     NotifyType notifyType = NotifyType::NOTIFY_NONE;
67     CacheNode node;
68 };
69 
70 struct ParamServiceOther {
71     int32_t userId;
72     std::string bundleName;
73     std::vector<NotifyData> notifyDataList = {};
74 };
75 
76 } // namespace OHOS::FileManagement::CloudDisk
77 #endif // OHOS_CLOUD_DISK_SERVICE_NOTIFY_CONST_H