http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core-test/src/portable_reader_writer_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core-test/src/portable_reader_writer_test.cpp b/modules/platform/src/main/cpp/core-test/src/portable_reader_writer_test.cpp index c4f0a11..ee27df8 100644 --- a/modules/platform/src/main/cpp/core-test/src/portable_reader_writer_test.cpp +++ b/modules/platform/src/main/cpp/core-test/src/portable_reader_writer_test.cpp @@ -1,10 +1,18 @@ /* - * Copyright (C) GridGain Systems. All Rights Reserved. - * _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. */ #ifndef _MSC_VER @@ -13,11 +21,11 @@ #include <boost/test/unit_test.hpp> -#include "gridgain/impl/interop/interop.h" -#include "gridgain/portable/portable.h" +#include "ignite/impl/interop/interop.h" +#include "ignite/portable/portable.h" -#include "gridgain/portable_test_defs.h" -#include "gridgain/portable_test_utils.h" +#include "ignite/portable_test_defs.h" +#include "ignite/portable_test_utils.h" using namespace ignite; using namespace ignite::impl::interop;
http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core-test/src/portable_session_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core-test/src/portable_session_test.cpp b/modules/platform/src/main/cpp/core-test/src/portable_session_test.cpp index 2f42971..9d84e48 100644 --- a/modules/platform/src/main/cpp/core-test/src/portable_session_test.cpp +++ b/modules/platform/src/main/cpp/core-test/src/portable_session_test.cpp @@ -1,10 +1,18 @@ /* - * Copyright (C) GridGain Systems. All Rights Reserved. - * _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. */ #ifndef _MSC_VER @@ -13,11 +21,11 @@ #include <boost/test/unit_test.hpp> -#include "gridgain/impl/interop/interop.h" -#include "gridgain/impl/portable/portable_reader_impl.h" -#include "gridgain/impl/portable/portable_writer_impl.h" +#include "ignite/impl/interop/interop.h" +#include "ignite/impl/portable/portable_reader_impl.h" +#include "ignite/impl/portable/portable_writer_impl.h" -#include "gridgain/portable_test_defs.h" +#include "ignite/portable_test_defs.h" using namespace ignite; using namespace ignite::impl::interop; http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core-test/src/portable_test_defs.cpp ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core-test/src/portable_test_defs.cpp b/modules/platform/src/main/cpp/core-test/src/portable_test_defs.cpp index d96d4eb..e818711 100644 --- a/modules/platform/src/main/cpp/core-test/src/portable_test_defs.cpp +++ b/modules/platform/src/main/cpp/core-test/src/portable_test_defs.cpp @@ -1,16 +1,24 @@ /* - * Copyright (C) GridGain Systems. All Rights Reserved. - * _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. */ -#include "gridgain/impl/interop/interop.h" -#include "gridgain/portable/portable.h" +#include "ignite/impl/interop/interop.h" +#include "ignite/portable/portable.h" -#include "gridgain/portable_test_defs.h" +#include "ignite/portable_test_defs.h" using namespace ignite; using namespace ignite::impl::interop; http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core-test/src/teamcity_boost.cpp ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core-test/src/teamcity_boost.cpp b/modules/platform/src/main/cpp/core-test/src/teamcity_boost.cpp index 8a91c4e..45c666d 100644 --- a/modules/platform/src/main/cpp/core-test/src/teamcity_boost.cpp +++ b/modules/platform/src/main/cpp/core-test/src/teamcity_boost.cpp @@ -15,7 +15,7 @@ * $Revision: 88625 $ */ -#define BOOST_TEST_MODULE GridGainCoreTest +#define BOOST_TEST_MODULE IgniteCoreTest #include <sstream> http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/Makefile.am ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/Makefile.am b/modules/platform/src/main/cpp/core/Makefile.am index 365d662..07091c6 100644 --- a/modules/platform/src/main/cpp/core/Makefile.am +++ b/modules/platform/src/main/cpp/core/Makefile.am @@ -52,12 +52,12 @@ COMMON_SRC = os/linux/src/impl/utils.cpp \ src/grid.cpp \ src/grid_factory.cpp -lib_LTLIBRARIES = libgridgain.la -libgridgain_la_SOURCES = $(COMMON_SRC) -libgridgain_la_LDFLAGS = $(LIB_LDFLAGS) -L/usr/local/lib -lignite-common -ldl -version-info 0:0:0 -release $(PACKAGE_VERSION) +lib_LTLIBRARIES = libignite.la +libignite_la_SOURCES = $(COMMON_SRC) +libignite_la_LDFLAGS = $(LIB_LDFLAGS) -L/usr/local/lib -lignite-common -ldl -version-info 0:0:0 -release $(PACKAGE_VERSION) pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = gridgain.pc +pkgconfig_DATA = ignite.pc clean-local: $(RM) *.gcno *.gcda http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/configure.ac ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/configure.ac b/modules/platform/src/main/cpp/core/configure.ac index 5f93b3c..cdd238f 100644 --- a/modules/platform/src/main/cpp/core/configure.ac +++ b/modules/platform/src/main/cpp/core/configure.ac @@ -19,7 +19,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([GridGain for C++], [7.4.1], [[email protected]], [gridgain], [www.gridgain.com]) +AC_INIT([Apache Ignite C++], [1.4.0], [[email protected]], [ignite], [ignite.apache.org]) AC_CONFIG_SRCDIR(src) AC_CANONICAL_SYSTEM @@ -57,6 +57,6 @@ AC_TYPE_SIZE_T # Checks for library functions. AC_FUNC_ERROR_AT_LINE -AC_CONFIG_FILES(Makefile include/Makefile os/linux/include/Makefile gridgain.pc) +AC_CONFIG_FILES(Makefile include/Makefile os/linux/include/Makefile ignite.pc) AC_OUTPUT http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/gridgain.pc.in ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/gridgain.pc.in b/modules/platform/src/main/cpp/core/gridgain.pc.in deleted file mode 100644 index f248f8c..0000000 --- a/modules/platform/src/main/cpp/core/gridgain.pc.in +++ /dev/null @@ -1,9 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: gridgain -Description: GridGain for C++. -Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -lgridgain http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/ignite.pc.in ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/ignite.pc.in b/modules/platform/src/main/cpp/core/ignite.pc.in new file mode 100644 index 0000000..613fd1a --- /dev/null +++ b/modules/platform/src/main/cpp/core/ignite.pc.in @@ -0,0 +1,9 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: ignite +Description: Apache Ignite C++. +Version: @PACKAGE_VERSION@ +Libs: -L${libdir} -lignite http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/Makefile.am ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/Makefile.am b/modules/platform/src/main/cpp/core/include/Makefile.am index 20300b3..e938e1c 100644 --- a/modules/platform/src/main/cpp/core/include/Makefile.am +++ b/modules/platform/src/main/cpp/core/include/Makefile.am @@ -17,45 +17,45 @@ ACLOCAL_AMFLAGS = "-Im4" -nobase_include_HEADERS = gridgain/cache/cache.h \ - gridgain/cache/cache_entry.h \ - gridgain/cache/cache_peek_mode.h \ - gridgain/cache/query/query_argument.h \ - gridgain/cache/query/query_cursor.h \ - gridgain/cache/query/query_scan.h \ - gridgain/cache/query/query_sql.h \ - gridgain/cache/query/query_text.h \ - gridgain/cache/query/query.h \ - gridgain/impl/cache/cache_impl.h \ - gridgain/impl/cache/query/query_impl.h \ - gridgain/impl/interop/interop.h \ - gridgain/impl/interop/interop_input_stream.h \ - gridgain/impl/interop/interop_memory.h \ - gridgain/impl/interop/interop_output_stream.h \ - gridgain/impl/portable/portable_metadata_handler.h \ - gridgain/impl/portable/portable_metadata_manager.h \ - gridgain/impl/portable/portable_metadata_snapshot.h \ - gridgain/impl/portable/portable_metadata_updater.h \ - gridgain/impl/portable/portable_metadata_updater_impl.h \ - gridgain/impl/portable/portable_common.h \ - gridgain/impl/portable/portable_id_resolver.h \ - gridgain/impl/portable/portable_reader_impl.h \ - gridgain/impl/portable/portable_utils.h \ - gridgain/impl/portable/portable_writer_impl.h \ - gridgain/impl/grid_environment.h \ - gridgain/impl/grid_impl.h \ - gridgain/impl/handle_registry.h \ - gridgain/impl/operations.h \ - gridgain/portable/portable.h \ - gridgain/portable/portable_consts.h \ - gridgain/portable/portable_containers.h \ - gridgain/portable/portable_type.h \ - gridgain/portable/portable_raw_reader.h \ - gridgain/portable/portable_raw_writer.h \ - gridgain/portable/portable_reader.h \ - gridgain/portable/portable_writer.h \ - gridgain/grid.h \ - gridgain/grid_configuration.h \ - gridgain/grid_error.h \ - gridgain/grid_factory.h \ - gridgain/guid.h +nobase_include_HEADERS = ignite/cache/cache.h \ + ignite/cache/cache_entry.h \ + ignite/cache/cache_peek_mode.h \ + ignite/cache/query/query_argument.h \ + ignite/cache/query/query_cursor.h \ + ignite/cache/query/query_scan.h \ + ignite/cache/query/query_sql.h \ + ignite/cache/query/query_text.h \ + ignite/cache/query/query.h \ + ignite/impl/cache/cache_impl.h \ + ignite/impl/cache/query/query_impl.h \ + ignite/impl/interop/interop.h \ + ignite/impl/interop/interop_input_stream.h \ + ignite/impl/interop/interop_memory.h \ + ignite/impl/interop/interop_output_stream.h \ + ignite/impl/portable/portable_metadata_handler.h \ + ignite/impl/portable/portable_metadata_manager.h \ + ignite/impl/portable/portable_metadata_snapshot.h \ + ignite/impl/portable/portable_metadata_updater.h \ + ignite/impl/portable/portable_metadata_updater_impl.h \ + ignite/impl/portable/portable_common.h \ + ignite/impl/portable/portable_id_resolver.h \ + ignite/impl/portable/portable_reader_impl.h \ + ignite/impl/portable/portable_utils.h \ + ignite/impl/portable/portable_writer_impl.h \ + ignite/impl/grid_environment.h \ + ignite/impl/grid_impl.h \ + ignite/impl/handle_registry.h \ + ignite/impl/operations.h \ + ignite/portable/portable.h \ + ignite/portable/portable_consts.h \ + ignite/portable/portable_containers.h \ + ignite/portable/portable_type.h \ + ignite/portable/portable_raw_reader.h \ + ignite/portable/portable_raw_writer.h \ + ignite/portable/portable_reader.h \ + ignite/portable/portable_writer.h \ + ignite/grid.h \ + ignite/grid_configuration.h \ + ignite/grid_error.h \ + ignite/grid_factory.h \ + ignite/guid.h http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/gridgain/cache/cache.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/gridgain/cache/cache.h b/modules/platform/src/main/cpp/core/include/gridgain/cache/cache.h deleted file mode 100644 index 940bff3..0000000 --- a/modules/platform/src/main/cpp/core/include/gridgain/cache/cache.h +++ /dev/null @@ -1,1153 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -#ifndef _IGNITE_CACHE -#define _IGNITE_CACHE - -#include <map> -#include <set> - -#include <ignite/common/common.h> -#include <ignite/common/concurrent.h> - -#include "gridgain/cache/cache_peek_mode.h" -#include "gridgain/cache/query/query_cursor.h" -#include "gridgain/cache/query/query_scan.h" -#include "gridgain/cache/query/query_sql.h" -#include "gridgain/cache/query/query_text.h" -#include "gridgain/impl/cache/cache_impl.h" -#include "gridgain/impl/operations.h" -#include "gridgain/grid_error.h" - -namespace ignite -{ - namespace cache - { - /** - * Main entry point for all Data Grid APIs. - */ - template<typename K, typename V> - class IGNITE_IMPORT_EXPORT Cache - { - public: - /** - * Constructor. - */ - Cache(impl::cache::CacheImpl* impl) : impl(ignite::common::concurrent::SharedPointer<impl::cache::CacheImpl>(impl)) - { - // No-op. - } - - /** - * Name of this cache (null for default cache). - */ - char* GetName() - { - return impl.Get()->GetName(); - } - - /** - * Checks whether this cache contains no key-value mappings. - * Semantically equals to Cache.Size(IGNITE_PEEK_MODE_PRIMARY) == 0. - * - * @return True if cache is empty. - */ - bool IsEmpty() - { - GridError err; - - bool res = IsEmpty(err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Checks whether this cache contains no key-value mappings. - * Semantically equals to Cache.Size(IGNITE_PEEK_MODE_PRIMARY) == 0. - * - * @param err Error. - * @return True if cache is empty. - */ - bool IsEmpty(GridError& err) - { - return impl.Get()->IsEmpty(&err); - } - - /** - * Check if cache contains mapping for this key. - * - * @param key Key. - * @return True if cache contains mapping for this key. - */ - bool ContainsKey(const K& key) - { - GridError err; - - bool res = ContainsKey(key, err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Check if cache contains mapping for this key. - * - * @param key Key. - * @param err Error. - * @return True if cache contains mapping for this key. - */ - bool ContainsKey(const K& key, GridError& err) - { - impl::In1Operation<K> op(&key); - - return impl.Get()->ContainsKey(op, &err); - } - - /** - * Check if cache contains mapping for these keys. - * - * @param keys Keys. - * @return True if cache contains mapping for all these keys. - */ - bool ContainsKeys(const std::set<K>& keys) - { - GridError err; - - bool res = ContainsKeys(keys, err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Check if cache contains mapping for these keys. - * - * @param keys Keys. - * @param err Error. - * @return True if cache contains mapping for all these keys. - */ - bool ContainsKeys(const std::set<K>& keys, GridError& err) - { - impl::InSetOperation<K> op(&keys); - - return impl.Get()->ContainsKeys(op, &err); - } - - /** - * Peeks at cached value using optional set of peek modes. This method will sequentially - * iterate over given peek modes, and try to peek at value using each peek mode. Once a - * non-null value is found, it will be immediately returned. - * This method does not participate in any transactions, however, it may peek at transactional - * value depending on the peek modes used. - * - * @param key Key. - * @param peekModes Peek modes. - * @return Value. - */ - V LocalPeek(const K& key, int32_t peekModes) - { - GridError err; - - V res = LocalPeek(key, peekModes, err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Peeks at cached value using optional set of peek modes. This method will sequentially - * iterate over given peek modes, and try to peek at value using each peek mode. Once a - * non-null value is found, it will be immediately returned. - * This method does not participate in any transactions, however, it may peek at transactional - * value depending on the peek modes used. - * - * @param key Key. - * @param peekModes Peek modes. - * @param err Error. - * @return Value. - */ - V LocalPeek(const K& key, int32_t peekModes, GridError& err) - { - impl::InCacheLocalPeekOperation<K> inOp(&key, peekModes); - impl::Out1Operation<V> outOp; - - impl.Get()->LocalPeek(inOp, outOp, peekModes, &err); - - return outOp.GetResult(); - } - - /** - * Retrieves value mapped to the specified key from cache. - * If the value is not present in cache, then it will be looked up from swap storage. If - * it's not present in swap, or if swap is disabled, and if read-through is allowed, value - * will be loaded from persistent store. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param key Key. - * @return Value. - */ - V Get(const K& key) - { - GridError err; - - V res = Get(key, err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Retrieves value mapped to the specified key from cache. - * If the value is not present in cache, then it will be looked up from swap storage. If - * it's not present in swap, or if swap is disabled, and if read-through is allowed, value - * will be loaded from persistent store. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param key Key. - * @param err Error. - * @return Value. - */ - V Get(const K& key, GridError& err) - { - impl::In1Operation<K> inOp(&key); - impl::Out1Operation<V> outOp; - - impl.Get()->Get(inOp, outOp, &err); - - return outOp.GetResult(); - } - - /** - * Retrieves values mapped to the specified keys from cache. - * If some value is not present in cache, then it will be looked up from swap storage. If - * it's not present in swap, or if swap is disabled, and if read-through is allowed, value - * will be loaded from persistent store. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param keys Keys. - * @return Map of key-value pairs. - */ - std::map<K, V> GetAll(const std::set<K>& keys) - { - GridError err; - - std::map<K, V> res = GetAll(keys, err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Retrieves values mapped to the specified keys from cache. - * If some value is not present in cache, then it will be looked up from swap storage. If - * it's not present in swap, or if swap is disabled, and if read-through is allowed, value - * will be loaded from persistent store. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param keys Keys. - * @param err Error. - * @return Map of key-value pairs. - */ - std::map<K, V> GetAll(const std::set<K>& keys, GridError& err) - { - impl::InSetOperation<K> inOp(&keys); - impl::OutMapOperation<K, V> outOp; - - impl.Get()->GetAll(inOp, outOp, &err); - - return outOp.GetResult(); - } - - /** - * Associates the specified value with the specified key in the cache. - * If the cache previously contained a mapping for the key, - * the old value is replaced by the specified value. - * - * @param key Key with which the specified value is to be associated. - * @param val Value to be associated with the specified key. - */ - void Put(const K& key, const V& val) - { - GridError err; - - Put(key, val, err); - - GridError::ThrowIfNeeded(err); - } - - /** - * Associates the specified value with the specified key in the cache. - * If the cache previously contained a mapping for the key, - * the old value is replaced by the specified value. - * - * @param key Key with which the specified value is to be associated. - * @param val Value to be associated with the specified key. - * @param err Error. - */ - void Put(const K& key, const V& val, GridError& err) - { - impl::In2Operation<K, V> op(&key, &val); - - impl.Get()->Put(op, &err); - } - - /** - * Stores given key-value pairs in cache. - * If write-through is enabled, the stored values will be persisted to store. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param vals Key-value pairs to store in cache. - */ - void PutAll(const std::map<K, V>& vals) - { - GridError err; - - PutAll(vals, err); - - GridError::ThrowIfNeeded(err); - } - - /** - * Stores given key-value pairs in cache. - * If write-through is enabled, the stored values will be persisted to store. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param vals Key-value pairs to store in cache. - * @param err Error. - */ - void PutAll(const std::map<K, V>& vals, GridError& err) - { - impl::InMapOperation<K, V> op(&vals); - - impl.Get()->PutAll(op, &err); - } - - /** - * Associates the specified value with the specified key in this cache, - * returning an existing value if one existed. - * - * @param key Key with which the specified value is to be associated. - * @param val Value to be associated with the specified key. - * @return The value associated with the key at the start of the - * operation or null if none was associated. - */ - V GetAndPut(const K& key, const V& val) - { - GridError err; - - V res = GetAndPut(key, val, err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Associates the specified value with the specified key in this cache, - * returning an existing value if one existed. - * - * @param key Key with which the specified value is to be associated. - * @param val Value to be associated with the specified key. - * @param err Error. - * @return The value associated with the key at the start of the - * operation or null if none was associated. - */ - V GetAndPut(const K& key, const V& val, GridError& err) - { - impl::In2Operation<K, V> inOp(&key, &val); - impl::Out1Operation<V> outOp; - - impl.Get()->GetAndPut(inOp, outOp, &err); - - return outOp.GetResult(); - } - - /** - * Atomically replaces the value for a given key if and only if there is - * a value currently mapped by the key. - * - * @param key Key with which the specified value is to be associated. - * @param val Value to be associated with the specified key. - * @return The previous value associated with the specified key, or - * null if there was no mapping for the key. - */ - V GetAndReplace(const K& key, const V& val) - { - GridError err; - - V res = GetAndReplace(key, val, err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Atomically replaces the value for a given key if and only if there is - * a value currently mapped by the key. - * - * @param key Key with which the specified value is to be associated. - * @param val Value to be associated with the specified key. - * @param err Error. - * @return The previous value associated with the specified key, or - * null if there was no mapping for the key. - */ - V GetAndReplace(const K& key, const V& val, GridError& err) - { - impl::In2Operation<K, V> inOp(&key, &val); - impl::Out1Operation<V> outOp; - - impl.Get()->GetAndReplace(inOp, outOp, &err); - - return outOp.GetResult(); - } - - /** - * Atomically removes the entry for a key only if currently mapped to some value. - * - * @param key Key with which the specified value is associated. - * @return The value if one existed or null if no mapping existed for this key. - */ - V GetAndRemove(const K& key) - { - GridError err; - - V res = GetAndRemove(key, err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Atomically removes the entry for a key only if currently mapped to some value. - * - * @param key Key with which the specified value is associated. - * @param err Error. - * @return The value if one existed or null if no mapping existed for this key. - */ - V GetAndRemove(const K& key, GridError& err) - { - impl::In1Operation<K> inOp(&key); - impl::Out1Operation<V> outOp; - - impl.Get()->GetAndRemove(inOp, outOp, &err); - - return outOp.GetResult(); - } - - /** - * Atomically associates the specified key with the given value if it is not - * already associated with a value. - * - * @param key Key with which the specified value is to be associated. - * @param val Value to be associated with the specified key. - * @return True if a value was set. - */ - bool PutIfAbsent(const K& key, const V& val) - { - GridError err; - - bool res = PutIfAbsent(key, val, err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Atomically associates the specified key with the given value if it is not - * already associated with a value. - * - * @param key Key with which the specified value is to be associated. - * @param val Value to be associated with the specified key. - * @param err Error. - * @return True if a value was set. - */ - bool PutIfAbsent(const K& key, const V& val, GridError& err) - { - impl::In2Operation<K, V> op(&key, &val); - - return impl.Get()->PutIfAbsent(op, &err); - } - - /** - * Stores given key-value pair in cache only if cache had no previous mapping for it. - * If cache previously contained value for the given key, then this value is returned. - * In case of PARTITIONED or REPLICATED caches, the value will be loaded from the primary node, - * which in its turn may load the value from the swap storage, and consecutively, if it's not - * in swap, from the underlying persistent storage. - * If the returned value is not needed, method putxIfAbsent() should be used instead of this one to - * avoid the overhead associated with returning of the previous value. - * If write-through is enabled, the stored value will be persisted to store. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param key Key to store in cache. - * @param val Value to be associated with the given key. - * @return Previously contained value regardless of whether put happened or not - * (null if there was no previous value). - */ - V GetAndPutIfAbsent(const K& key, const V& val) - { - GridError err; - - V res = GetAndPutIfAbsent(key, val, err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Stores given key-value pair in cache only if cache had no previous mapping for it. - * If cache previously contained value for the given key, then this value is returned. - * In case of PARTITIONED or REPLICATED caches, the value will be loaded from the primary node, - * which in its turn may load the value from the swap storage, and consecutively, if it's not - * in swap, from the underlying persistent storage. - * If the returned value is not needed, method putxIfAbsent() should be used instead of this one to - * avoid the overhead associated with returning of the previous value. - * If write-through is enabled, the stored value will be persisted to store. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param key Key to store in cache. - * @param val Value to be associated with the given key. - * @param err Error. - * @return Previously contained value regardless of whether put happened or not - * (null if there was no previous value). - */ - V GetAndPutIfAbsent(const K& key, const V& val, GridError& err) - { - impl::In2Operation<K, V> inOp(&key, &val); - impl::Out1Operation<V> outOp; - - impl.Get()->GetAndPutIfAbsent(inOp, outOp, &err); - - return outOp.GetResult(); - } - - /** - * Stores given key-value pair in cache only if there is a previous mapping for it. - * If cache previously contained value for the given key, then this value is returned. - * In case of PARTITIONED or REPLICATED caches, the value will be loaded from the primary node, - * which in its turn may load the value from the swap storage, and consecutively, if it's not - * in swap, rom the underlying persistent storage. - * If write-through is enabled, the stored value will be persisted to store. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param key Key to store in cache. - * @param val Value to be associated with the given key. - * @return True if the value was replaced. - */ - bool Replace(const K& key, const V& val) - { - GridError err; - - bool res = Replace(key, val, err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Stores given key-value pair in cache only if there is a previous mapping for it. - * If cache previously contained value for the given key, then this value is returned. - * In case of PARTITIONED or REPLICATED caches, the value will be loaded from the primary node, - * which in its turn may load the value from the swap storage, and consecutively, if it's not - * in swap, rom the underlying persistent storage. - * If write-through is enabled, the stored value will be persisted to store. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param key Key to store in cache. - * @param val Value to be associated with the given key. - * @param err Error. - * @return True if the value was replaced. - */ - bool Replace(const K& key, const V& val, GridError& err) - { - impl::In2Operation<K, V> op(&key, &val); - - return impl.Get()->Replace(op, &err); - } - - /** - * Stores given key-value pair in cache only if only if the previous value is equal to the - * old value passed as argument. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param key Key to store in cache. - * @param oldVal Old value to match. - * @param newVal Value to be associated with the given key. - * @return True if replace happened, false otherwise. - */ - bool Replace(const K& key, const V& oldVal, const V& newVal) - { - GridError err; - - bool res = Replace(key, oldVal, newVal, err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Stores given key-value pair in cache only if only if the previous value is equal to the - * old value passed as argument. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param key Key to store in cache. - * @param oldVal Old value to match. - * @param newVal Value to be associated with the given key. - * @param err Error. - * @return True if replace happened, false otherwise. - */ - bool Replace(const K& key, const V& oldVal, const V& newVal, GridError& err) - { - impl::In3Operation<K, V, V> op(&key, &oldVal, &newVal); - - return impl.Get()->ReplaceIfEqual(op, &err); - } - - /** - * Attempts to evict all entries associated with keys. Note, that entry will be evicted only - * if it's not used (not participating in any locks or transactions). - * - * @param keys Keys to evict from cache. - */ - void LocalEvict(const std::set<K>& keys) - { - GridError err; - - LocalEvict(keys, err); - - GridError::ThrowIfNeeded(err); - } - - /** - * Attempts to evict all entries associated with keys. Note, that entry will be evicted only - * if it's not used (not participating in any locks or transactions). - * - * @param keys Keys to evict from cache. - * @param err Error. - */ - void LocalEvict(const std::set<K>& keys, GridError& err) - { - impl::InSetOperation<K> op(&keys); - - impl.Get()->LocalEvict(op, &err); - } - - /** - * Clear cache. - */ - void Clear() - { - GridError err; - - Clear(err); - - GridError::ThrowIfNeeded(err); - } - - /** - * Clear cache. - * - * @param err Error. - */ - void Clear(GridError& err) - { - impl.Get()->Clear(&err); - } - - /** - * Clear entry from the cache and swap storage, without notifying listeners or CacheWriters. - * Entry is cleared only if it is not currently locked, and is not participating in a transaction. - * - * @param key Key to clear. - */ - void Clear(const K& key) - { - GridError err; - - Clear(key, err); - - GridError::ThrowIfNeeded(err); - } - - /** - * Clear entry from the cache and swap storage, without notifying listeners or CacheWriters. - * Entry is cleared only if it is not currently locked, and is not participating in a transaction. - * - * @param key Key to clear. - * @param err Error. - */ - void Clear(const K& key, GridError& err) - { - impl::In1Operation<K> op(&key); - - impl.Get()->Clear(op, &err); - } - - /** - * Clear entries from the cache and swap storage, without notifying listeners or CacheWriters. - * Entry is cleared only if it is not currently locked, and is not participating in a transaction. - * - * @param keys Keys to clear. - */ - void ClearAll(const std::set<K>& keys) - { - GridError err; - - ClearAll(keys, err); - - GridError::ThrowIfNeeded(err); - } - - /** - * Clear entries from the cache and swap storage, without notifying listeners or CacheWriters. - * Entry is cleared only if it is not currently locked, and is not participating in a transaction. - * - * @param keys Keys to clear. - * @param err Error. - */ - void ClearAll(const std::set<K>& keys, GridError& err) - { - impl::InSetOperation<K> op(&keys); - - impl.Get()->ClearAll(op, &err); - } - - /** - * Clear entry from the cache and swap storage, without notifying listeners or CacheWriters. - * Entry is cleared only if it is not currently locked, and is not participating in a transaction. - * Note that this operation is local as it merely clears an entry from local cache, it does not - * remove entries from remote caches. - * - * @param key Key to clear. - */ - void LocalClear(const K& key) - { - GridError err; - - LocalClear(key, err); - - GridError::ThrowIfNeeded(err); - } - - /** - * Clear entry from the cache and swap storage, without notifying listeners or CacheWriters. - * Entry is cleared only if it is not currently locked, and is not participating in a transaction. - * Note that this operation is local as it merely clears an entry from local cache, it does not - * remove entries from remote caches. - * - * @param key Key to clear. - * @param err Error. - */ - void LocalClear(const K& key, GridError& err) - { - impl::In1Operation<K> op(&key); - - impl.Get()->LocalClear(op, &err); - } - - /** - * Clear entries from the cache and swap storage, without notifying listeners or CacheWriters. - * Entry is cleared only if it is not currently locked, and is not participating in a transaction. - * Note that this operation is local as it merely clears entries from local cache, it does not - * remove entries from remote caches. - * - * @param keys Keys to clear. - */ - void LocalClearAll(const std::set<K>& keys) - { - GridError err; - - LocalClearAll(keys, err); - - GridError::ThrowIfNeeded(err); - } - - /** - * Clear entries from the cache and swap storage, without notifying listeners or CacheWriters. - * Entry is cleared only if it is not currently locked, and is not participating in a transaction. - * Note that this operation is local as it merely clears entries from local cache, it does not - * remove entries from remote caches. - * - * @param keys Keys to clear. - * @param err Error. - */ - void LocalClearAll(const std::set<K>& keys, GridError& err) - { - impl::InSetOperation<K> op(&keys); - - impl.Get()->LocalClearAll(op, &err); - } - - /** - * Removes given key mapping from cache. If cache previously contained value for the given key, - * then this value is returned. In case of PARTITIONED or REPLICATED caches, the value will be - * loaded from the primary node, which in its turn may load the value from the disk-based swap - * storage, and consecutively, if it's not in swap, from the underlying persistent storage. - * If the returned value is not needed, method removex() should always be used instead of this - * one to avoid the overhead associated with returning of the previous value. - * If write-through is enabled, the value will be removed from store. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param key Key whose mapping is to be removed from cache. - * @return False if there was no matching key. - */ - bool Remove(const K& key) - { - GridError err; - - bool res = Remove(key, err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Removes given key mapping from cache. If cache previously contained value for the given key, - * then this value is returned. In case of PARTITIONED or REPLICATED caches, the value will be - * loaded from the primary node, which in its turn may load the value from the disk-based swap - * storage, and consecutively, if it's not in swap, from the underlying persistent storage. - * If the returned value is not needed, method removex() should always be used instead of this - * one to avoid the overhead associated with returning of the previous value. - * If write-through is enabled, the value will be removed from store. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param key Key whose mapping is to be removed from cache. - * @param err Error. - * @return False if there was no matching key. - */ - bool Remove(const K& key, GridError& err) - { - impl::In1Operation<K> op(&key); - - return impl.Get()->Remove(op, &err); - } - - /** - * Removes given key mapping from cache if one exists and value is equal to the passed in value. - * If write-through is enabled, the value will be removed from store. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param key Key whose mapping is to be removed from cache. - * @param val Value to match against currently cached value. - * @return True if entry was removed, false otherwise. - */ - bool Remove(const K& key, const V& val) - { - GridError err; - - bool res = Remove(key, val, err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Removes given key mapping from cache if one exists and value is equal to the passed in value. - * If write-through is enabled, the value will be removed from store. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param key Key whose mapping is to be removed from cache. - * @param val Value to match against currently cached value. - * @param err Error. - * @return True if entry was removed, false otherwise. - */ - bool Remove(const K& key, const V& val, GridError& err) - { - impl::In2Operation<K, V> op(&key, &val); - - return impl.Get()->RemoveIfEqual(op, &err); - } - - /** - * Removes given key mappings from cache. - * If write-through is enabled, the value will be removed from store. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param keys Keys whose mappings are to be removed from cache. - */ - void RemoveAll(const std::set<K>& keys) - { - GridError err; - - RemoveAll(keys, err); - - GridError::ThrowIfNeeded(err); - } - - /** - * Removes given key mappings from cache. - * If write-through is enabled, the value will be removed from store. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param keys Keys whose mappings are to be removed from cache. - * @param err Error. - */ - void RemoveAll(const std::set<K>& keys, GridError& err) - { - impl::InSetOperation<K> op(&keys); - - impl.Get()->RemoveAll(op, &err); - } - - /** - * Removes all mappings from cache. - * If write-through is enabled, the value will be removed from store. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param err Error. - */ - void RemoveAll() - { - GridError err; - - RemoveAll(err); - - GridError::ThrowIfNeeded(err); - } - - /** - * Removes all mappings from cache. - * If write-through is enabled, the value will be removed from store. - * This method is transactional and will enlist the entry into ongoing transaction if there is one. - * - * @param err Error. - */ - void RemoveAll(GridError& err) - { - return impl.Get()->RemoveAll(&err); - } - - /** - * Gets the number of all entries cached on this node. - * - * @return Cache size on this node. - */ - int32_t LocalSize() - { - return LocalSize(IGNITE_PEEK_MODE_ALL); - } - - /** - * Gets the number of all entries cached on this node. - * - * @param err Error. - * @return Cache size on this node. - */ - int32_t LocalSize(GridError& err) - { - return LocalSize(IGNITE_PEEK_MODE_ALL, err); - } - - /** - * Gets the number of all entries cached on this node. - * - * @param Peek modes. - * @return Cache size on this node. - */ - int32_t LocalSize(int32_t peekModes) - { - GridError err; - - int32_t res = LocalSize(peekModes, err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Gets the number of all entries cached on this node. - * - * @param Peek modes. - * @param err Error. - * @return Cache size on this node. - */ - int32_t LocalSize(int32_t peekModes, GridError& err) - { - return impl.Get()->LocalSize(peekModes, &err); - } - - /** - * Gets the number of all entries cached across all nodes. - * NOTE: this operation is distributed and will query all participating nodes for their cache sizes. - * - * @return Cache size across all nodes. - */ - int32_t Size() - { - return Size(ignite::cache::IGNITE_PEEK_MODE_ALL); - } - - /** - * Gets the number of all entries cached across all nodes. - * NOTE: this operation is distributed and will query all participating nodes for their cache sizes. - * - * @param err Error. - * @return Cache size across all nodes. - */ - int32_t Size(GridError& err) - { - return Size(ignite::cache::IGNITE_PEEK_MODE_ALL, err); - } - - /** - * Gets the number of all entries cached across all nodes. - * NOTE: this operation is distributed and will query all participating nodes for their cache sizes. - * - * @param Peek modes. - * @return Cache size across all nodes. - */ - int32_t Size(int32_t peekModes) - { - GridError err; - - int32_t res = Size(peekModes, err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Gets the number of all entries cached across all nodes. - * NOTE: this operation is distributed and will query all participating nodes for their cache sizes. - * - * @param Peek modes. - * @param err Error. - * @return Cache size across all nodes. - */ - int32_t Size(int32_t peekModes, GridError& err) - { - return impl.Get()->Size(peekModes, &err); - } - - /** - * Perform SQL query. - * - * @param qry Query. - * @return Query cursor. - */ - query::QueryCursor<K, V> Query(const query::SqlQuery& qry) - { - GridError err; - - query::QueryCursor<K, V> res = Query(qry, err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Perform SQL query. - * - * @param qry Query. - * @param err Error. - * @return Query cursor. - */ - query::QueryCursor<K, V> Query(const query::SqlQuery& qry, GridError& err) - { - impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QuerySql(qry, &err); - - return query::QueryCursor<K, V>(cursorImpl); - } - - /* - * Perform text query. - * - * @param qry Query. - * @return Query cursor. - */ - query::QueryCursor<K, V> Query(const query::TextQuery& qry) - { - GridError err; - - query::QueryCursor<K, V> res = Query(qry, err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /* - * Perform text query. - * - * @param qry Query. - * @param err Error. - * @return Query cursor. - */ - query::QueryCursor<K, V> Query(const query::TextQuery& qry, GridError& err) - { - impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QueryText(qry, &err); - - return query::QueryCursor<K, V>(cursorImpl); - } - - /* - * Perform scan query. - * - * @param qry Query. - * @return Query cursor. - */ - query::QueryCursor<K, V> Query(const query::ScanQuery& qry) - { - GridError err; - - query::QueryCursor<K, V> res = Query(qry, err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /* - * Perform scan query. - * - * @param qry Query. - * @param err Error. - * @return Query cursor. - */ - query::QueryCursor<K, V> Query(const query::ScanQuery& qry, GridError& err) - { - impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QueryScan(qry, &err); - - return query::QueryCursor<K, V>(cursorImpl); - } - - private: - /** Implementation delegate. */ - ignite::common::concurrent::SharedPointer<impl::cache::CacheImpl> impl; - }; - } -} - -#endif http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/gridgain/cache/cache_entry.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/gridgain/cache/cache_entry.h b/modules/platform/src/main/cpp/core/include/gridgain/cache/cache_entry.h deleted file mode 100644 index 2b6c785..0000000 --- a/modules/platform/src/main/cpp/core/include/gridgain/cache/cache_entry.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -#ifndef _IGNITE_CACHE_ENTRY -#define _IGNITE_CACHE_ENTRY - -#include <ignite/common/common.h> - -namespace ignite -{ - namespace cache - { - /** - * Cache entry. - */ - template<typename K, typename V> - class IGNITE_IMPORT_EXPORT CacheEntry - { - public: - /** - * Default constructor. - */ - CacheEntry() : key(K()), val(V()) - { - // No-op. - } - - /** - * Constructor. - * - * @param key Key. - * @param val Value. - */ - CacheEntry(const K& key, const V& val) : key(key), val(val) - { - // No-op. - } - - /** - * Copy constructor. - * - * @param other Other instance. - */ - CacheEntry(const CacheEntry& other) - { - key = other.key; - val = other.val; - } - - /** - * Assignment operator. - * - * @param other Other instance. - */ - CacheEntry& operator=(const CacheEntry& other) - { - if (this != &other) - { - CacheEntry tmp(other); - - K& key0 = key; - V& val0 = val; - - key = tmp.key; - val = tmp.val; - - tmp.key = key0; - tmp.val = val0; - } - - return *this; - } - - /** - * Get key. - * - * @return Key. - */ - K GetKey() - { - return key; - } - - /** - * Get value. - * - * @return Value. - */ - V GetValue() - { - return val; - } - - private: - /** Key. */ - K key; - - /** Value. */ - V val; - }; - } -} - -#endif http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/gridgain/cache/cache_peek_mode.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/gridgain/cache/cache_peek_mode.h b/modules/platform/src/main/cpp/core/include/gridgain/cache/cache_peek_mode.h deleted file mode 100644 index be61887..0000000 --- a/modules/platform/src/main/cpp/core/include/gridgain/cache/cache_peek_mode.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -#ifndef _IGNITE_CACHE_PEEK_MODE -#define _IGNITE_CACHE_PEEK_MODE - -namespace ignite -{ - namespace cache - { - /** - * Enumeration of all supported cache peek modes. - */ - enum CachePeekMode - { - /** - * Peeks into all available cache storages. - */ - IGNITE_PEEK_MODE_ALL = 0x01, - - /** - * Peek into near cache only (don't peek into partitioned cache). - * In case of LOCAL cache, behaves as IGNITE_PEEK_MODE_ALL mode. - */ - IGNITE_PEEK_MODE_NEAR = 0x02, - - /** - * Peek value from primary copy of partitioned cache only (skip near cache). - * In case of LOCAL cache, behaves as IGNITE_PEEK_MODE_ALL mode. - */ - IGNITE_PEEK_MODE_PRIMARY = 0x04, - - /** - * Peek value from backup copies of partitioned cache only (skip near cache). - * In case of LOCAL cache, behaves as IGNITE_PEEK_MODE_ALL mode. - */ - IGNITE_PEEK_MODE_BACKUP = 0x08, - - /** - * Peeks value from the on-heap storage only. - */ - IGNITE_PEEK_MODE_ONHEAP = 0x10, - - /** - * Peeks value from the off-heap storage only, without loading off-heap value into cache. - */ - IGNITE_PEEK_MODE_OFFHEAP = 0x20, - - /** - * Peeks value from the swap storage only, without loading swapped value into cache. - */ - IGNITE_PEEK_MODE_SWAP = 0x40 - }; - } -} - -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/gridgain/cache/query/query.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/gridgain/cache/query/query.h b/modules/platform/src/main/cpp/core/include/gridgain/cache/query/query.h deleted file mode 100644 index 2bf607c..0000000 --- a/modules/platform/src/main/cpp/core/include/gridgain/cache/query/query.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -#ifndef _IGNITE_QUERY -#define _IGNITE_QUERY - -#include "gridgain/cache/query/query_argument.h" -#include "gridgain/cache/query/query_cursor.h" -#include "gridgain/cache/query/query_scan.h" -#include "gridgain/cache/query/query_sql.h" -#include "gridgain/cache/query/query_text.h" - -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/gridgain/cache/query/query_argument.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/gridgain/cache/query/query_argument.h b/modules/platform/src/main/cpp/core/include/gridgain/cache/query/query_argument.h deleted file mode 100644 index 1ed96da..0000000 --- a/modules/platform/src/main/cpp/core/include/gridgain/cache/query/query_argument.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -#ifndef _IGNITE_CACHE_QUERY_ARGUMENT -#define _IGNITE_CACHE_QUERY_ARGUMENT - -#include "gridgain/portable/portable_raw_writer.h" - -namespace ignite -{ - namespace cache - { - namespace query - { - /** - * Base class for all query arguments. - */ - class QueryArgumentBase - { - public: - /** - * Destructor. - */ - virtual ~QueryArgumentBase() - { - // No-op. - } - - /** - * Copy argument. - * - * @return Copy. - */ - virtual QueryArgumentBase* Copy() = 0; - - /** - * Write argument. - */ - virtual void Write(ignite::portable::PortableRawWriter& writer) = 0; - }; - - /** - * Query argument. - */ - template<typename T> - class QueryArgument : public QueryArgumentBase - { - public: - /** - * Constructor. - * - * @param val Value. - */ - QueryArgument(const T& val) : val(val) - { - // No-op. - } - - /** - * Copy constructor. - * - * @param other Other instance. - */ - QueryArgument(const QueryArgument& other) - { - val = other.val; - } - - /** - * Assignment operator. - * - * @param other Other instance. - */ - QueryArgument& operator=(const QueryArgument& other) - { - if (this != &other) - { - QueryArgument tmp(other); - - T val0 = val; - val = tmp.val; - tmp.val = val0; - } - - return *this; - } - - ~QueryArgument() - { - // No-op. - } - - QueryArgumentBase* Copy() - { - return new QueryArgument(val); - } - - void Write(ignite::portable::PortableRawWriter& writer) - { - writer.WriteObject<T>(val); - } - - private: - /** Value. */ - T val; - }; - } - } -} - -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/gridgain/cache/query/query_cursor.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/gridgain/cache/query/query_cursor.h b/modules/platform/src/main/cpp/core/include/gridgain/cache/query/query_cursor.h deleted file mode 100644 index dbe738c..0000000 --- a/modules/platform/src/main/cpp/core/include/gridgain/cache/query/query_cursor.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -#ifndef _IGNITE_CACHE_QUERY_CURSOR -#define _IGNITE_CACHE_QUERY_CURSOR - -#include <vector> - -#include <ignite/common/concurrent.h> - -#include "gridgain/cache/cache_entry.h" -#include "gridgain/grid_error.h" -#include "gridgain/impl/cache/query/query_impl.h" -#include "gridgain/impl/operations.h" - -namespace ignite -{ - namespace cache - { - namespace query - { - /** - * Query cursor. - */ - template<typename K, typename V> - class QueryCursor - { - public: - /** - * Default constructor. - */ - QueryCursor() : impl(NULL) - { - // No-op. - } - - /** - * Constructor. - * - * @param impl Implementation. - */ - QueryCursor(impl::cache::query::QueryCursorImpl* impl) : - impl(ignite::common::concurrent::SharedPointer<impl::cache::query::QueryCursorImpl>(impl)) - { - // No-op. - } - - /** - * Check whether next entry exists. - * - * @return True if next entry exists. - */ - bool HasNext() - { - GridError err; - - bool res = HasNext(err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Check whether next entry exists. - * - * @param err Error. - * @return True if next entry exists. - */ - bool HasNext(GridError& err) - { - impl::cache::query::QueryCursorImpl* impl0 = impl.Get(); - - if (impl0) - return impl0->HasNext(&err); - else - { - err = GridError(GridError::IGNITE_ERR_GENERIC, - "Instance is not usable (did you check for error?)."); - - return false; - } - } - - /** - * Get next entry. - * - * @return Next entry. - */ - CacheEntry<K, V> GetNext() - { - GridError err; - - CacheEntry<K, V> res = GetNext(err); - - GridError::ThrowIfNeeded(err); - - return res; - } - - /** - * Get next entry. - * - * @param err Error. - * @return Next entry. - */ - CacheEntry<K, V> GetNext(GridError& err) - { - impl::cache::query::QueryCursorImpl* impl0 = impl.Get(); - - if (impl0) { - impl::Out2Operation<K, V> outOp; - - impl0->GetNext(outOp, &err); - - if (err.GetCode() == GridError::IGNITE_SUCCESS) - { - K& key = outOp.Get1(); - V& val = outOp.Get2(); - - return CacheEntry<K, V>(key, val); - } - else - return CacheEntry<K, V>(); - } - else - { - err = GridError(GridError::IGNITE_ERR_GENERIC, - "Instance is not usable (did you check for error?)."); - - return CacheEntry<K, V>(); - } - } - - /** - * Get all entries. - * - * @param Vector where query entries will be stored. - */ - void GetAll(std::vector<CacheEntry<K, V>>& res) - { - GridError err; - - GetAll(res, err); - - GridError::ThrowIfNeeded(err); - } - - /** - * Get all entries. - * - * @param Vector where query entries will be stored. - * @param err Error. - */ - void GetAll(std::vector<CacheEntry<K, V>>& res, GridError& err) - { - impl::cache::query::QueryCursorImpl* impl0 = impl.Get(); - - if (impl0) { - impl::OutQueryGetAllOperation<K, V> outOp(&res); - - impl0->GetAll(outOp, &err); - } - else - err = GridError(GridError::IGNITE_ERR_GENERIC, - "Instance is not usable (did you check for error?)."); - } - - private: - /** Implementation delegate. */ - ignite::common::concurrent::SharedPointer<impl::cache::query::QueryCursorImpl> impl; - }; - } - } -} - -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/0d70d547/modules/platform/src/main/cpp/core/include/gridgain/cache/query/query_scan.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/gridgain/cache/query/query_scan.h b/modules/platform/src/main/cpp/core/include/gridgain/cache/query/query_scan.h deleted file mode 100644 index 0955aee..0000000 --- a/modules/platform/src/main/cpp/core/include/gridgain/cache/query/query_scan.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -#ifndef _IGNITE_CACHE_QUERY_SCAN -#define _IGNITE_CACHE_QUERY_SCAN - -#include <stdint.h> -#include <string> - -#include "gridgain/portable/portable_raw_writer.h" - -namespace ignite -{ - namespace cache - { - namespace query - { - /* - * Scab query. - */ - class ScanQuery - { - public: - /* - * Constructor. - */ - ScanQuery() : part(-1), pageSize(1024), loc(false) - { - // No-op. - } - - /* - * Constructor. - * - * @param part Partition. - */ - ScanQuery(int32_t part) : part(part), pageSize(1024), loc(false) - { - // No-op. - } - - /* - * Get partition to scan. - * - * @return Partition to scan. - */ - int32_t GetPartition() - { - return part; - } - - /* - * Set partition to scan. - * - * @param part Partition to scan. - */ - void SetPartition(int32_t part) - { - this->part = part; - } - - /* - * Get page size. - * - * @return Page size. - */ - int32_t GetPageSize() - { - return pageSize; - } - - /* - * Set page size. - * - * @param pageSize Page size. - */ - void SetPageSize(int32_t pageSize) - { - this->pageSize = pageSize; - } - - /* - * Get local flag. - * - * @return Local flag. - */ - bool IsLocal() - { - return loc; - } - - /* - * Set local flag. - * - * @param loc Local flag. - */ - void SetLocal(bool loc) - { - this->loc = loc; - } - - /* - * Write query info to the stream. - * - * @param writer Writer. - */ - void Write(portable::PortableRawWriter& writer) const - { - writer.WriteBool(loc); - writer.WriteInt32(pageSize); - - if (part < 0) - writer.WriteBool(false); - else - { - writer.WriteBool(true); - writer.WriteInt32(part); - } - - writer.WriteNull(); // Predicates are not supported yet. - } - - private: - /* Partition. */ - int32_t part; - - /* Page size. */ - int32_t pageSize; - - /* Local flag. */ - bool loc; - }; - } - } -} - -#endif \ No newline at end of file
