ignite-db - rename
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0ce9254c Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0ce9254c Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0ce9254c Branch: refs/heads/ignite-db-x-10884 Commit: 0ce9254ce6e976593dbee2ee28aed83dd218c498 Parents: cbfed9c Author: S.Vladykin <[email protected]> Authored: Tue Apr 12 21:15:00 2016 +0300 Committer: S.Vladykin <[email protected]> Committed: Tue Apr 12 21:15:00 2016 +0300 ---------------------------------------------------------------------- .../cache/database/tree/io/BPlusIOMeta.java | 2 +- .../cache/database/tree/io/DataPageIO.java | 2 +- .../cache/database/tree/io/IORegistry.java | 82 -------------------- .../cache/database/tree/io/IOVersions.java | 82 ++++++++++++++++++++ .../query/h2/database/io/H2InnerIO.java | 4 +- .../query/h2/database/io/H2LeafIO.java | 4 +- 6 files changed, 88 insertions(+), 88 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/0ce9254c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/BPlusIOMeta.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/BPlusIOMeta.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/BPlusIOMeta.java index f5d31ad..a8657b1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/BPlusIOMeta.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/BPlusIOMeta.java @@ -24,7 +24,7 @@ import java.nio.ByteBuffer; */ public class BPlusIOMeta extends PageIO { /** */ - public static final IORegistry<BPlusIOMeta> VERSIONS = new IORegistry<>( + public static final IOVersions<BPlusIOMeta> VERSIONS = new IOVersions<>( new BPlusIOMeta(1) ); http://git-wip-us.apache.org/repos/asf/ignite/blob/0ce9254c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/DataPageIO.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/DataPageIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/DataPageIO.java index ffa5fc1..9c43a0d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/DataPageIO.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/DataPageIO.java @@ -29,7 +29,7 @@ import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; */ public class DataPageIO extends PageIO { /** */ - public static final IORegistry<DataPageIO> VERSIONS = new IORegistry<>( + public static final IOVersions<DataPageIO> VERSIONS = new IOVersions<>( new DataPageIO(1) ); http://git-wip-us.apache.org/repos/asf/ignite/blob/0ce9254c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/IORegistry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/IORegistry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/IORegistry.java deleted file mode 100644 index c95a45d..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/IORegistry.java +++ /dev/null @@ -1,82 +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. - */ - -package org.apache.ignite.internal.processors.cache.database.tree.io; - -import java.nio.ByteBuffer; - -/** - * Registry for IO versions. - */ -public final class IORegistry<V extends PageIO> { - /** */ - private final V[] vers; - - /** - * @param vers Versions. - */ - @SafeVarargs - public IORegistry(V... vers) { - assert vers != null; - assert vers.length > 0; - - this.vers = vers; - - assert checkVersions(); - } - - /** - * @return {@code true} If versions are correct. - */ - private boolean checkVersions() { - for (int i = 0; i < vers.length; i++) { - if (vers[i].getVersion() != i + 1) - return false; - } - - return true; - } - - /** - * @return Latest IO version. - */ - public V latest() { - return forVersion(vers.length); - } - - /** - * @param ver Version. - * @return IO. - */ - public V forVersion(int ver) { - return vers[ver - 1]; - } - - /** - * @param buf Buffer. - * @return IO. - */ - public V forPage(ByteBuffer buf) { - int ver = PageIO.getVersion(buf); - - V res = forVersion(ver); - - assert res.getType() == PageIO.getType(buf); - - return res; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/0ce9254c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/IOVersions.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/IOVersions.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/IOVersions.java new file mode 100644 index 0000000..2699104 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/IOVersions.java @@ -0,0 +1,82 @@ +/* + * 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.cache.database.tree.io; + +import java.nio.ByteBuffer; + +/** + * Registry for IO versions. + */ +public final class IOVersions<V extends PageIO> { + /** */ + private final V[] vers; + + /** + * @param vers Versions. + */ + @SafeVarargs + public IOVersions(V... vers) { + assert vers != null; + assert vers.length > 0; + + this.vers = vers; + + assert checkVersions(); + } + + /** + * @return {@code true} If versions are correct. + */ + private boolean checkVersions() { + for (int i = 0; i < vers.length; i++) { + if (vers[i].getVersion() != i + 1) + return false; + } + + return true; + } + + /** + * @return Latest IO version. + */ + public V latest() { + return forVersion(vers.length); + } + + /** + * @param ver Version. + * @return IO. + */ + public V forVersion(int ver) { + return vers[ver - 1]; + } + + /** + * @param buf Buffer. + * @return IO. + */ + public V forPage(ByteBuffer buf) { + int ver = PageIO.getVersion(buf); + + V res = forVersion(ver); + + assert res.getType() == PageIO.getType(buf); + + return res; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/0ce9254c/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/io/H2InnerIO.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/io/H2InnerIO.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/io/H2InnerIO.java index bfc425d..70d5034 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/io/H2InnerIO.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/io/H2InnerIO.java @@ -20,7 +20,7 @@ package org.apache.ignite.internal.processors.query.h2.database.io; import java.nio.ByteBuffer; import org.apache.ignite.internal.processors.cache.database.tree.io.BPlusIO; import org.apache.ignite.internal.processors.cache.database.tree.io.BPlusIOInner; -import org.apache.ignite.internal.processors.cache.database.tree.io.IORegistry; +import org.apache.ignite.internal.processors.cache.database.tree.io.IOVersions; import org.apache.ignite.internal.processors.query.h2.opt.GridH2Row; import org.h2.result.SearchRow; @@ -29,7 +29,7 @@ import org.h2.result.SearchRow; */ public class H2InnerIO extends BPlusIOInner<SearchRow> implements H2RowLinkIO { /** */ - public static final IORegistry<H2InnerIO> VERSIONS = new IORegistry<>( + public static final IOVersions<H2InnerIO> VERSIONS = new IOVersions<>( new H2InnerIO(1) ); http://git-wip-us.apache.org/repos/asf/ignite/blob/0ce9254c/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/io/H2LeafIO.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/io/H2LeafIO.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/io/H2LeafIO.java index d2356a4..4cb877c 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/io/H2LeafIO.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/io/H2LeafIO.java @@ -20,7 +20,7 @@ package org.apache.ignite.internal.processors.query.h2.database.io; import java.nio.ByteBuffer; import org.apache.ignite.internal.processors.cache.database.tree.io.BPlusIO; import org.apache.ignite.internal.processors.cache.database.tree.io.BPlusIOLeaf; -import org.apache.ignite.internal.processors.cache.database.tree.io.IORegistry; +import org.apache.ignite.internal.processors.cache.database.tree.io.IOVersions; import org.apache.ignite.internal.processors.query.h2.opt.GridH2Row; import org.h2.result.SearchRow; @@ -29,7 +29,7 @@ import org.h2.result.SearchRow; */ public class H2LeafIO extends BPlusIOLeaf<SearchRow> implements H2RowLinkIO { /** */ - public static final IORegistry<H2LeafIO> VERSIONS = new IORegistry<>( + public static final IOVersions<H2LeafIO> VERSIONS = new IOVersions<>( new H2LeafIO(1) );
