X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=service%2Fnative%2Fnotification_persistent_service%2Fserver%2Finclude%2Fns_npp_registry_entry.h;fp=service%2Fnative%2Fnotification_persistent_service%2Fserver%2Finclude%2Fns_npp_registry_entry.h;h=3cb475ee1da1973e746ab446eea67cd345958eab;hb=17cf21bcf8a2e29d2cbcf0a313474d2a4ee44f5d;hp=0000000000000000000000000000000000000000;hpb=9e86046cdb356913ae026f616e5bf17f6f238aa5;p=staging%2Fbasesystem.git diff --git a/service/native/notification_persistent_service/server/include/ns_npp_registry_entry.h b/service/native/notification_persistent_service/server/include/ns_npp_registry_entry.h new file mode 100755 index 0000000..3cb475e --- /dev/null +++ b/service/native/notification_persistent_service/server/include/ns_npp_registry_entry.h @@ -0,0 +1,330 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_NPPService +/// \brief The file contains declaration of CRegistryEntry class. +/// +/// +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGISTRY_ENTRY_H_ +#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGISTRY_ENTRY_H_ + +#include +#include +#include "ns_npp_types.h" + +/** + * This class contains the registry information of the files/folders to be peresisted. + */ +class CRegistryEntry { + public: + //////////////////////////////////////////////////////////////////////////////////////////////// + /// CRegistryEntry + /// Constructor of CRegistryEntry class + /// + /// \param [OUT] f_ctag + /// std::string& - File or Folder tag + /// + /// \param [OUT] f_crequester + /// std::string& - Requester Name + /// + /// \param [OUT] f_cstoragepath + /// std::string& - File or Folder persistence storage path + /// + /// \param [IN] f_bisuserpersistence + /// BOOL - File or Folder is user specific + /// \return + /// + //////////////////////////////////////////////////////////////////////////////////////////////// + explicit CRegistryEntry(const std::string &f_ctag, const std::string &f_crequester, + const std::string &f_cstoragepath, BOOL f_bisuserpersistence); + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// CRegistryEntry + /// Copy Constructor of CRegistryEntry class + /// + /// \param + /// + /// \return + /// + //////////////////////////////////////////////////////////////////////////////////////////////// + CRegistryEntry(const CRegistryEntry &f_objin); + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// operator= + /// Operator overload = + /// + /// \param [IN] f_objin + /// CRegistryEntry& - In object. + /// + /// \return + /// + //////////////////////////////////////////////////////////////////////////////////////////////// + CRegistryEntry &operator=(const CRegistryEntry &f_objin); // NOLINT (readability/naming) + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// SetReleasePath + /// Set release path. + /// + /// \param [IN] f_creleasepath + /// std::string& - Path of the file/folder to be released. + /// + /// \return + /// + //////////////////////////////////////////////////////////////////////////////////////////////// + VOID SetReleasePath(const std::string &f_creleasepath); + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// SetBeingPersisted + /// Set the file/folder persist member variable to true to notify that the file/folder is being + /// persisted. + /// + /// \param + /// + /// \return + /// + //////////////////////////////////////////////////////////////////////////////////////////////// + VOID SetBeingPersisted(); + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// AckReceived + /// Ack from copy worker received. Process the ack. + /// + /// \param + /// + /// \return + /// + //////////////////////////////////////////////////////////////////////////////////////////////// + VOID AckReceived(); + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// IsReleased + /// Check if File/folder released or not. + /// + /// \param + /// + /// \return BOOL + // BOOL - True if file/folder is released else false + /// + //////////////////////////////////////////////////////////////////////////////////////////////// + BOOL IsReleased() const; + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// HasntBeenPersisted + /// File persisted or not + /// + /// \param + /// + /// \return BOOL + // BOOL - True if file is not persisted else false + /// + //////////////////////////////////////////////////////////////////////////////////////////////// + BOOL HasntBeenPersisted() const; + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// IsPersisted + /// File/Folder persisted or not + /// + /// \param + /// + /// \return BOOL + // BOOL - True if file/folder is persisted else false + /// + //////////////////////////////////////////////////////////////////////////////////////////////// + BOOL IsPersisted() const; + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// IsAckPending + /// Ack is pending or not. + /// + /// \param + /// + /// \return BOOL + // BOOL - True if ack is pending else false + /// + //////////////////////////////////////////////////////////////////////////////////////////////// + BOOL IsAckPending() const; + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// GetPersistPath + /// Get the persist path. + /// + /// \param + /// + /// \return std::string + // std::string - Returns the persist path. + /// + //////////////////////////////////////////////////////////////////////////////////////////////// + std::string GetPersistPath() const; + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// GetReleasePath + /// Get the release path. + /// + /// \param + /// + /// \return std::string + // std::string - Returns the release path. + /// + //////////////////////////////////////////////////////////////////////////////////////////////// + std::string GetReleasePath() const; + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// GetLoadPath + /// Get the load path. + /// + /// \param [IN] f_epersisttype + /// ENotificationpersistentservicePersistType - type of persisted data + /// + /// \param [IN] f_cusername + /// std::string - Current user name + /// + /// + /// \return std::string + // std::string - Returns the load path. + /// + //////////////////////////////////////////////////////////////////////////////////////////////// + std::string GetLoadPath(ENotificationpersistentservicePersistType f_epersisttype, std::string f_cusername) const; + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// GetRequester + /// Get the name of requester. + /// + /// \param + /// + /// \return std::string + // std::string - Returns the name of requester. + /// + //////////////////////////////////////////////////////////////////////////////////////////////// + std::string GetRequester() const; + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// GetTag + /// Get the tag. + /// + /// \param + /// + /// \return std::string + // std::string - Returns the tag. + /// + //////////////////////////////////////////////////////////////////////////////////////////////// + std::string GetTag() const; + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// IsUserPersistence + /// Returns TRUE if it is a user persistence. + /// + /// \param + /// + /// \return BOOL + // BOOL - Returns TRUE if it is a user persistence. + /// + //////////////////////////////////////////////////////////////////////////////////////////////// + BOOL IsUserPersistence(); + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// SetCurrentAction + /// Set current copying action of a the corresponding tag. + /// + /// \param [IN] f_ecurrentaction + /// ENPS_Loadtype - Current action + /// + /// \return + //////////////////////////////////////////////////////////////////////////////////////////////// + VOID SetCurrentAction(ENPS_Loadtype f_ecurrentaction); + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// ResetPersistedFlag + /// Reset Persist flags + /// + /// \param + /// + /// \return + //////////////////////////////////////////////////////////////////////////////////////////////// + VOID ResetPersistedFlag(); + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// SetPersistProperties + /// creates persistence path and stores the persist type + /// + /// \param [IN] f_epersisttype + /// ENotificationpersistentservicePersistType - Set persist type + /// \param [IN] f_cusername + /// std::string - Username related to persist tag if any. + /// + /// + /// \return + //////////////////////////////////////////////////////////////////////////////////////////////// + VOID SetPersistProperties(ENotificationpersistentservicePersistType f_epersisttype, std::string f_cusername = ""); + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// GetPersistType + /// Returns persist type of a job + /// + /// \param + /// + /// \return ENotificationpersistentservicePersistType + // ENotificationpersistentservicePersistType - Returns persist type + /// + //////////////////////////////////////////////////////////////////////////////////////////////// + ENotificationpersistentservicePersistType GetPersistType() const; + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// SetPersistentCategory + /// Sets the persistent type related to tag + /// + /// \param [IN] f_epersistcategory + /// EFrameworkunifiedPersistCategory - persist category + /// + /// \return EFrameworkunifiedStatus + // EFrameworkunifiedStatus - success or failure status + /// + //////////////////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedStatus SetPersistentCategory(EFrameworkunifiedPersistCategory f_epersistcategory); + + //////////////////////////////////////////////////////////////////////////////////////////////// + /// GetPersistentCategory + /// Returns persistent type of tag + /// + /// \param + /// + /// \return EFrameworkunifiedPersistCategory + // EFrameworkunifiedPersistCategory - Returns persistent type + /// + //////////////////////////////////////////////////////////////////////////////////////////////// + EFrameworkunifiedPersistCategory GetPersistentCategory(); + + ENPSPersistenceJobState m_eJobState; // Current state of a job + + private: + std::string m_cTag; // File/Folder tag + std::string m_cRequestor; // Requester application name + BOOL m_bIsReleased; // if file or folder released + BOOL m_bIsPersisted; // if file or folder is persisted + std::string m_cPersistPath; // Persist path + std::string m_cReleasePath; // Release path + std::string m_cBasePath; // Persist base path + BOOL m_bIsUserPersistence; // If user persistence + ENPS_Loadtype m_eCurrentAction; // Current action to load file to/from + /// temporary/persistence memory + ENotificationpersistentservicePersistType m_ePersistType; + EFrameworkunifiedPersistCategory m_ePersistCategory; // Persistent category +}; + +#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGISTRY_ENTRY_H_