Extract storage code into libcynara-storage 33/27533/5
authorAleksander Zdyb <a.zdyb@partner.samsung.com>
Wed, 17 Sep 2014 06:22:20 +0000 (08:22 +0200)
committerAleksander Zdyb <a.zdyb@samsung.com>
Fri, 19 Sep 2014 06:39:48 +0000 (08:39 +0200)
libcynara-storage is an extrenal library containing
C++ symbols used in cynara itself as well as
in upcomming libcynara-offline-admin.

Change-Id: I56ce83339ec3bc1b17cc54e3ba5f3863316117fe

19 files changed:
CMakeLists.txt
packaging/cynara.spec
packaging/libcynara-storage.manifest [new file with mode: 0644]
src/CMakeLists.txt
src/service/CMakeLists.txt
src/storage/BucketDeserializer.cpp [moved from src/service/storage/BucketDeserializer.cpp with 100% similarity]
src/storage/BucketDeserializer.h [moved from src/service/storage/BucketDeserializer.h with 89% similarity]
src/storage/Buckets.h [moved from src/service/storage/Buckets.h with 89% similarity]
src/storage/CMakeLists.txt [new file with mode: 0644]
src/storage/InMemoryStorageBackend.cpp [moved from src/service/storage/InMemoryStorageBackend.cpp with 100% similarity]
src/storage/InMemoryStorageBackend.h [moved from src/service/storage/InMemoryStorageBackend.h with 94% similarity]
src/storage/Storage.cpp [moved from src/service/storage/Storage.cpp with 100% similarity]
src/storage/Storage.h [moved from src/service/storage/Storage.h with 91% similarity]
src/storage/StorageBackend.h [moved from src/service/storage/StorageBackend.h with 93% similarity]
src/storage/StorageDeserializer.cpp [moved from src/service/storage/StorageDeserializer.cpp with 100% similarity]
src/storage/StorageDeserializer.h [moved from src/service/storage/StorageDeserializer.h with 92% similarity]
src/storage/StorageSerializer.cpp [moved from src/service/storage/StorageSerializer.cpp with 100% similarity]
src/storage/StorageSerializer.h [moved from src/service/storage/StorageSerializer.h with 94% similarity]
test/CMakeLists.txt

index 8c10a18..0623e9a 100644 (file)
@@ -86,6 +86,7 @@ SET(TARGET_LIB_CREDS_COMMONS "cynara-creds-commons")
 SET(TARGET_LIB_CREDS_DBUS "cynara-creds-dbus")
 SET(TARGET_LIB_CREDS_SOCKET "cynara-creds-socket")
 SET(TARGET_LIB_SESSION "cynara-session")
+SET(TARGET_LIB_CYNARA_STORAGE "cynara-storage")
 
 ADD_SUBDIRECTORY(src)
 ADD_SUBDIRECTORY(pkgconfig)
index 015737a..2977e5c 100644 (file)
@@ -15,6 +15,7 @@ Source1007:    libcynara-creds-commons.manifest
 Source1008:    libcynara-creds-dbus.manifest
 Source1009:    libcynara-creds-socket.manifest
 Source1010:    libcynara-session.manifest
+Source1011:    libcynara-storage.manifest
 Requires:      default-ac-domains
 Requires(pre): pwdutils
 Requires(post):   smack
@@ -93,6 +94,21 @@ Requires:   libcynara-admin = %{version}-%{release}
 admin client library (devel) for setting, listing and removing policies
 
 #######################################################
+%package -n libcynara-storage
+Summary:    Cynara - storage
+Requires:   cynara = %{version}-%{release}
+
+%description -n libcynara-storage
+cynara common storage library with common storage functionalities
+
+%package -n libcynara-storage-devel
+Summary:    Cynara - storage-devel
+Requires:   cynara = %{version}-%{release}
+
+%description -n libcynara-storage-devel
+cynara common storage library (devel) with common storage functionalities
+
+#######################################################
 %package -n libcynara-commons
 Summary:    Cynara - cynara commons library
 Requires:   cynara = %{version}-%{release}
@@ -197,6 +213,7 @@ cp -a %{SOURCE1007} .
 cp -a %{SOURCE1008} .
 cp -a %{SOURCE1009} .
 cp -a %{SOURCE1010} .
+cp -a %{SOURCE1011} .
 cp -a test/db/db* .
 
 %build
@@ -281,6 +298,14 @@ fi
 
 %postun -n libcynara-admin -p /sbin/ldconfig
 
+%post -n libcynara-storage -p /sbin/ldconfig
+
+%postun -n libcynara-storage -p /sbin/ldconfig
+
+%post -n libcynara-storage-devel -p /sbin/ldconfig
+
+%postun -n libcynara-storage-devel -p /sbin/ldconfig
+
 %post -n libcynara-commons -p /sbin/ldconfig
 
 %postun -n libcynara-commons -p /sbin/ldconfig
@@ -376,6 +401,14 @@ fi
 %{_libdir}/libcynara-admin.so
 %{_libdir}/pkgconfig/cynara-admin.pc
 
+%files -n libcynara-storage
+%manifest libcynara-storage.manifest
+%license LICENSE
+%{_libdir}/libcynara-storage.so.*
+
+%files -n libcynara-storage-devel
+%{_libdir}/libcynara-storage.so
+
 %files -n libcynara-commons
 %manifest libcynara-commons.manifest
 %license LICENSE
diff --git a/packaging/libcynara-storage.manifest b/packaging/libcynara-storage.manifest
new file mode 100644 (file)
index 0000000..a76fdba
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_" />
+       </request>
+</manifest>
index 2e3e7bf..66a1186 100644 (file)
@@ -48,6 +48,7 @@ ADD_SUBDIRECTORY(common)
 ADD_SUBDIRECTORY(client)
 ADD_SUBDIRECTORY(client-common)
 ADD_SUBDIRECTORY(admin)
+ADD_SUBDIRECTORY(storage)
 ADD_SUBDIRECTORY(service)
 ADD_SUBDIRECTORY(helpers/creds-commons)
 ADD_SUBDIRECTORY(helpers/creds-dbus)
index ce1e67d..f1c4c8a 100644 (file)
@@ -24,15 +24,11 @@ SET(CYNARA_SOURCES
     ${CYNARA_SERVICE_PATH}/main/main.cpp
     ${CYNARA_SERVICE_PATH}/sockets/Descriptor.cpp
     ${CYNARA_SERVICE_PATH}/sockets/SocketManager.cpp
-    ${CYNARA_SERVICE_PATH}/storage/BucketDeserializer.cpp
-    ${CYNARA_SERVICE_PATH}/storage/InMemoryStorageBackend.cpp
-    ${CYNARA_SERVICE_PATH}/storage/Storage.cpp
-    ${CYNARA_SERVICE_PATH}/storage/StorageDeserializer.cpp
-    ${CYNARA_SERVICE_PATH}/storage/StorageSerializer.cpp
     )
 
 INCLUDE_DIRECTORIES(
     ${CYNARA_SERVICE_PATH}
+    ${CYNARA_PATH}
     )
 
 ADD_EXECUTABLE(${TARGET_CYNARA} ${CYNARA_SOURCES})
@@ -40,6 +36,7 @@ ADD_EXECUTABLE(${TARGET_CYNARA} ${CYNARA_SOURCES})
 TARGET_LINK_LIBRARIES(${TARGET_CYNARA}
     ${CYNARA_DEP_LIBRARIES}
     ${TARGET_CYNARA_COMMON}
+    ${TARGET_LIB_CYNARA_STORAGE}
     )
 
 INSTALL(TARGETS ${TARGET_CYNARA} DESTINATION ${BIN_INSTALL_DIR})
similarity index 89%
rename from src/service/storage/BucketDeserializer.h
rename to src/storage/BucketDeserializer.h
index 64adb51..0a38b27 100644 (file)
@@ -19,8 +19,8 @@
  * @version     1.0
  * @brief       Headers for Cynara::BucketDeserializer
  */
-#ifndef SRC_SERVICE_STORAGE_BUCKETDESERIALIZER_H_
-#define SRC_SERVICE_STORAGE_BUCKETDESERIALIZER_H_
+#ifndef SRC_STORAGE_BUCKETDESERIALIZER_H_
+#define SRC_STORAGE_BUCKETDESERIALIZER_H_
 
 #include <fstream>
 #include <memory>
@@ -48,4 +48,4 @@ private:
 
 } /* namespace Cynara */
 
-#endif /* SRC_SERVICE_STORAGE_BUCKETDESERIALIZER_H_ */
+#endif /* SRC_STORAGE_BUCKETDESERIALIZER_H_ */
similarity index 89%
rename from src/service/storage/Buckets.h
rename to src/storage/Buckets.h
index 1fdc249..1ec4969 100644 (file)
@@ -21,8 +21,8 @@
  * @brief       Headers for Buckets
  */
 
-#ifndef SRC_SERVICE_STORAGE_BUCKETS_H_
-#define SRC_SERVICE_STORAGE_BUCKETS_H_
+#ifndef SRC_STORAGE_BUCKETS_H_
+#define SRC_STORAGE_BUCKETS_H_
 
 #include <unordered_map>
 
@@ -35,4 +35,4 @@ typedef std::unordered_map<PolicyBucketId, PolicyBucket> Buckets;
 
 } /* namespace Cynara */
 
-#endif /* SRC_SERVICE_STORAGE_BUCKETS_H_ */
+#endif /* SRC_STORAGE_BUCKETS_H_ */
diff --git a/src/storage/CMakeLists.txt b/src/storage/CMakeLists.txt
new file mode 100644 (file)
index 0000000..620dc2d
--- /dev/null
@@ -0,0 +1,55 @@
+# Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#    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.
+#
+# @file        CMakeLists.txt
+# @author      Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
+# @author      Aleksander Zdyb <a.zdyb@samsung.com>
+#
+
+SET(LIB_CYNARA_STORAGE_VERSION_MAJOR 0)
+SET(LIB_CYNARA_STORAGE_VERSION ${LIB_CYNARA_STORAGE_VERSION_MAJOR}.3.0)
+
+SET(CYNARA_LIB_CYNARA_STORAGE_PATH ${CYNARA_PATH}/storage)
+
+SET(LIB_CYNARA_STORAGE_SOURCES
+    ${CYNARA_LIB_CYNARA_STORAGE_PATH}/BucketDeserializer.cpp
+    ${CYNARA_LIB_CYNARA_STORAGE_PATH}/InMemoryStorageBackend.cpp
+    ${CYNARA_LIB_CYNARA_STORAGE_PATH}/Storage.cpp
+    ${CYNARA_LIB_CYNARA_STORAGE_PATH}/StorageDeserializer.cpp
+    ${CYNARA_LIB_CYNARA_STORAGE_PATH}/StorageSerializer.cpp
+    )
+
+INCLUDE_DIRECTORIES(
+    ${CYNARA_LIB_CYNARA_STORAGE_PATH}
+    ${CYNARA_PATH}/include
+    ${CYNARA_PATH}
+    )
+
+ADD_DEFINITIONS("-fvisibility=default")
+
+ADD_LIBRARY(${TARGET_LIB_CYNARA_STORAGE} SHARED ${LIB_CYNARA_STORAGE_SOURCES})
+
+SET_TARGET_PROPERTIES(
+    ${TARGET_LIB_CYNARA_STORAGE}
+    PROPERTIES
+        SOVERSION ${LIB_CYNARA_STORAGE_VERSION_MAJOR}
+        VERSION ${LIB_CYNARA_STORAGE_VERSION}
+    )
+
+TARGET_LINK_LIBRARIES(${TARGET_LIB_CYNARA_STORAGE}
+    ${CYNARA_DEP_LIBRARIES}
+    ${TARGET_CYNARA_COMMON}
+    )
+
+INSTALL(TARGETS ${TARGET_LIB_CYNARA_STORAGE} DESTINATION ${LIB_INSTALL_DIR})
similarity index 94%
rename from src/service/storage/InMemoryStorageBackend.h
rename to src/storage/InMemoryStorageBackend.h
index d811edd..67d0898 100644 (file)
@@ -20,8 +20,8 @@
  * @brief       Headers for InMemoryStorageBackend
  */
 
-#ifndef SRC_SERVICE_STORAGE_INMEMORYSTORAGEBACKEND_H_
-#define SRC_SERVICE_STORAGE_INMEMORYSTORAGEBACKEND_H_
+#ifndef SRC_STORAGE_INMEMORYSTORAGEBACKEND_H_
+#define SRC_STORAGE_INMEMORYSTORAGEBACKEND_H_
 
 #include <fstream>
 #include <memory>
@@ -80,4 +80,4 @@ protected:
 
 } /* namespace Cynara */
 
-#endif /* SRC_SERVICE_STORAGE_INMEMORYSTORAGEBACKEND_H_ */
+#endif /* SRC_STORAGE_INMEMORYSTORAGEBACKEND_H_ */
similarity index 91%
rename from src/service/storage/Storage.h
rename to src/storage/Storage.h
index 82052d0..c292820 100644 (file)
  * @author      Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
  * @author      Aleksander Zdyb <a.zdyb@partner.samsung.com>
  * @version     1.0
- * @brief       This file is the implementation file of log system
+ * @brief       This file is the implementation storage
  */
 
-#ifndef SRC_SERVICE_STORAGE_STORAGE_H_
-#define SRC_SERVICE_STORAGE_STORAGE_H_
+#ifndef SRC_STORAGE_STORAGE_H_
+#define SRC_STORAGE_STORAGE_H_
 
 #include <map>
 #include <string>
@@ -65,4 +65,4 @@ private:
 
 } // namespace Cynara
 
-#endif /* SRC_SERVICE_STORAGE_STORAGE_H_ */
+#endif /* SRC_STORAGE_STORAGE_H_ */
similarity index 93%
rename from src/service/storage/StorageBackend.h
rename to src/storage/StorageBackend.h
index b015bf0..7dc3881 100644 (file)
@@ -20,8 +20,8 @@
  * @brief       Headers for StorageBackend base class
  */
 
-#ifndef SRC_SERVICE_STORAGE_STORAGEBACKEND_H_
-#define SRC_SERVICE_STORAGE_STORAGEBACKEND_H_
+#ifndef SRC_STORAGE_STORAGEBACKEND_H_
+#define SRC_STORAGE_STORAGEBACKEND_H_
 
 #include <string>
 
@@ -59,4 +59,4 @@ public:
 
 } /* namespace Cynara */
 
-#endif /* SRC_SERVICE_STORAGE_STORAGEBACKEND_H_ */
+#endif /* SRC_STORAGE_STORAGEBACKEND_H_ */
similarity index 92%
rename from src/service/storage/StorageDeserializer.h
rename to src/storage/StorageDeserializer.h
index 3c9e3f7..f9d9716 100644 (file)
@@ -19,8 +19,8 @@
  * @version     1.0
  * @brief       Headers for Cynara::StorageDeserializer
  */
-#ifndef SRC_SERVICE_STORAGE_STORAGEDESERIALIZER_H_
-#define SRC_SERVICE_STORAGE_STORAGEDESERIALIZER_H_
+#ifndef SRC_STORAGE_STORAGEDESERIALIZER_H_
+#define SRC_STORAGE_STORAGEDESERIALIZER_H_
 
 #include <functional>
 #include <fstream>
@@ -57,4 +57,4 @@ private:
 
 } /* namespace Cynara */
 
-#endif /* SRC_SERVICE_STORAGE_STORAGEDESERIALIZER_H_ */
+#endif /* SRC_STORAGE_STORAGEDESERIALIZER_H_ */
similarity index 94%
rename from src/service/storage/StorageSerializer.h
rename to src/storage/StorageSerializer.h
index 55ec2cd..dd6bbf4 100644 (file)
@@ -20,8 +20,8 @@
  * @brief       Headers for Cynara::StorageSerializer
  */
 
-#ifndef SRC_SERVICE_STORAGE_STORAGESERIALIZER_H_
-#define SRC_SERVICE_STORAGE_STORAGESERIALIZER_H_
+#ifndef SRC_STORAGE_STORAGESERIALIZER_H_
+#define SRC_STORAGE_STORAGESERIALIZER_H_
 
 #include <functional>
 #include <fstream>
@@ -88,4 +88,4 @@ public:
 
 } /* namespace Cynara */
 
-#endif /* SRC_SERVICE_STORAGE_STORAGESERIALIZER_H_ */
+#endif /* SRC_STORAGE_STORAGESERIALIZER_H_ */
index b04f6d8..fa4cf90 100644 (file)
@@ -26,11 +26,11 @@ SET(CYNARA_SOURCES_FOR_TESTS
     ${CYNARA_SRC}/common/types/PolicyKey.cpp
     ${CYNARA_SRC}/common/types/PolicyKeyHelpers.cpp
     ${CYNARA_SRC}/common/types/PolicyType.cpp
-    ${CYNARA_SRC}/service/storage/Storage.cpp
-    ${CYNARA_SRC}/service/storage/InMemoryStorageBackend.cpp
-    ${CYNARA_SRC}/service/storage/BucketDeserializer.cpp
-    ${CYNARA_SRC}/service/storage/StorageDeserializer.cpp
-    ${CYNARA_SRC}/service/storage/StorageSerializer.cpp
+    ${CYNARA_SRC}/storage/BucketDeserializer.cpp
+    ${CYNARA_SRC}/storage/InMemoryStorageBackend.cpp
+    ${CYNARA_SRC}/storage/Storage.cpp
+    ${CYNARA_SRC}/storage/StorageDeserializer.cpp
+    ${CYNARA_SRC}/storage/StorageSerializer.cpp
 )
 
 SET(CYNARA_TESTS_SOURCES
@@ -58,7 +58,7 @@ INCLUDE_DIRECTORIES(
     ${PKGS_INCLUDE_DIRS}
     ${CYNARA_SRC}/common
     ${CYNARA_SRC}/include
-    ${CYNARA_SRC}/service
+    ${CYNARA_SRC}
 )
 
 ADD_EXECUTABLE(${TARGET_CYNARA_TESTS}