1 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache-2.0 license that can be
3 // found in the LICENSE file.
5 #ifndef COMMON_EXTERNAL_STORAGE_H_
6 #define COMMON_EXTERNAL_STORAGE_H_
15 #include "common/app2ext_dynamic_service.h"
16 #include "common/utils/request.h"
18 namespace common_installer {
21 * @brief The ExternalStorage class
22 * Encapsulates mounting package in external memory for performing
23 * installation request.
25 class ExternalStorage final {
27 static std::unique_ptr<ExternalStorage> MoveInstalledStorage(
28 RequestType type, const std::filesystem::path& application_root,
29 const std::string& pkgid, const std::string& package_type,
30 uid_t uid, bool is_external_move);
32 static std::unique_ptr<ExternalStorage> AcquireExternalStorage(
33 RequestType type, const std::filesystem::path& application_root,
34 const std::string& pkgid, const std::string& package_type,
35 const std::filesystem::path& space_requirement, uid_t uid);
37 static std::unique_ptr<ExternalStorage> MigrateExternalStorage(
38 RequestType type, const std::string& pkgid, uid_t uid);
40 ExternalStorage(RequestType type, const std::string& pkgid,
41 const std::string& package_type,
42 const std::filesystem::path& application_root, uid_t uid);
44 ExternalStorage(RequestType type, const std::string& pkgid,
45 const std::string& package_type,
46 const std::filesystem::path& application_root, uid_t uid,
47 bool is_external_move);
48 ExternalStorage(RequestType type, const std::string& pkgid, uid_t uid);
54 const std::vector<std::string>& external_dirs() const;
57 App2ExtDynamicService service;
59 bool Initialize(const std::filesystem::path& space_requirement);
60 bool Finalize(bool success);
64 std::string package_type_;
65 std::filesystem::path application_root_;
68 std::shared_ptr<app2ext_handle> handle_;
69 std::vector<std::string> external_dirs_;
72 } // namespace common_installer
74 #endif // COMMON_EXTERNAL_STORAGE_H_