Platforms: moved several cache store classes to Ignite.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2938a9b4 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2938a9b4 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2938a9b4 Branch: refs/heads/ignite-884 Commit: 2938a9b4a06b0e0a9f19625ce1b168e4a4a2f87d Parents: 536af49 Author: vozerov-gridgain <voze...@gridgain.com> Authored: Wed Aug 26 17:11:46 2015 +0300 Committer: vozerov-gridgain <voze...@gridgain.com> Committed: Wed Aug 26 17:11:46 2015 +0300 ---------------------------------------------------------------------- .../cache/store/PlatformCacheStore.java | 25 ++++++++ .../cache/store/PlatformCacheStoreCallback.java | 61 ++++++++++++++++++++ 2 files changed, 86 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/2938a9b4/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cache/store/PlatformCacheStore.java ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cache/store/PlatformCacheStore.java b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cache/store/PlatformCacheStore.java new file mode 100644 index 0000000..6e0c1d9 --- /dev/null +++ b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cache/store/PlatformCacheStore.java @@ -0,0 +1,25 @@ +/* + * 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. + */ + +package org.apache.ignite.internal.processors.platform.cache.store; + +/** + * Marker interface denoting that this instance is platform cache store. + */ +public interface PlatformCacheStore { + // No-op. +} http://git-wip-us.apache.org/repos/asf/ignite/blob/2938a9b4/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cache/store/PlatformCacheStoreCallback.java ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cache/store/PlatformCacheStoreCallback.java b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cache/store/PlatformCacheStoreCallback.java new file mode 100644 index 0000000..32e0ab7 --- /dev/null +++ b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cache/store/PlatformCacheStoreCallback.java @@ -0,0 +1,61 @@ +/* + * 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. + */ + +package org.apache.ignite.internal.processors.platform.cache.store; + +import org.apache.ignite.internal.portable.*; +import org.apache.ignite.internal.processors.platform.*; +import org.apache.ignite.internal.processors.platform.memory.*; + +/** + * Platform cache store callback. + */ +public abstract class PlatformCacheStoreCallback { + /** Context. */ + protected final PlatformContext ctx; + + /** + * Constructor. + * + * @param ctx Context. + */ + protected PlatformCacheStoreCallback(PlatformContext ctx) { + this.ctx = ctx; + } + + /** + * Invoke the callback. + * + * @param memPtr Memory pointer. + */ + public void invoke(long memPtr) { + if (memPtr > 0) { + try (PlatformMemory mem = ctx.memory().get(memPtr)) { + PortableRawReaderEx reader = ctx.reader(mem); + + invoke0(reader); + } + } + } + + /** + * Internal invoke routine. + * + * @param reader Reader. + */ + protected abstract void invoke0(PortableRawReaderEx reader); +}