[ https://issues.apache.org/jira/browse/GORA-656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17344711#comment-17344711 ]
ASF GitHub Bot commented on GORA-656: ------------------------------------- kamaci commented on a change in pull request #222: URL: https://github.com/apache/gora/pull/222#discussion_r632660595 ########## File path: gora-hazelcast/src/main/java/org/apache/gora/hazelcast/query/HazelcastResult.java ########## @@ -0,0 +1,91 @@ +/** + * 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.gora.hazelcast.query; + +import java.io.IOException; +import java.util.Iterator; +import java.util.NavigableSet; + +import org.apache.gora.hazelcast.store.HazelcastStore; +import org.apache.gora.persistency.impl.PersistentBase; +import org.apache.gora.query.Query; +import org.apache.gora.query.impl.ResultBase; +import org.apache.gora.store.DataStore; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * {@link HazelcastResult} is the primary class + * responsible for representing result set of a cache manipulation query + * {@link HazelcastQuery} + */ +public class HazelcastResult<K, T extends PersistentBase> extends ResultBase<K, T> { + + private static final Logger LOG = LoggerFactory.getLogger(HazelcastResult.class); + private NavigableSet<K> cacheKeySet; + private Iterator<K> iterator; + private int current; + + public HazelcastResult(DataStore<K, T> dataStore, Query<K, T> query) { + super(dataStore, query); + } + + public HazelcastResult(DataStore<K, T> dataStore, Query<K, T> query, NavigableSet<K> cacheKeySet) { + super(dataStore, query); + this.cacheKeySet = cacheKeySet; + this.iterator = cacheKeySet.iterator(); + this.current = 0; + } + + public HazelcastStore<K, T> getDataStore() { + return (HazelcastStore<K, T>) super.getDataStore(); + } + + @Override + public float getProgress() throws IOException { + if (cacheKeySet.size() == 0) { + return 1; + } + float progress = ((float) current / (float) cacheKeySet.size()); Review comment: You can inline variable. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Hazelcast IMap backed datastore > ------------------------------- > > Key: GORA-656 > URL: https://issues.apache.org/jira/browse/GORA-656 > Project: Apache Gora > Issue Type: Improvement > Reporter: Kevin Ratnasekera > Priority: Major > Labels: gsoc2020 > Time Spent: 1h > Remaining Estimate: 0h > > Current implementation of JCache datastore is written in a way that it will > work with any JCache provider. Even though we have made explicitly available > Hazelcast JCache provider to the classpath. This implementation should be > based on the native interfaces of IMap. -- This message was sent by Atlassian Jira (v8.3.4#803005)