// Path: src/main/java/org/rakam/cache/hazelcast/treemap/operations/GetOperation.java
// public class GetOperation extends TreeMapBaseOperation {
//     private Integer numberOfElements = null;
//     private Map<String, Long> returnValue;
// 
//     public GetOperation(String name) {
//         super(name);
//     }
// 
//     public GetOperation() {
// 
//     }
// 
//     public GetOperation(String name, Integer numberOfElements) {
//         super(name);
//         this.numberOfElements = numberOfElements;
//     }
// 
//     @Override
//     public int getId() {
//         return TreeMapSerializerFactory.GET;
//     }
// 
//     @Override
//     public void run() throws Exception {
//         TreeMapService service = getService();
//         if(numberOfElements==null)
//             this.returnValue = service.getHLL(name).getAll();
//         else
//             this.returnValue = service.getHLL(name).getTopItems(numberOfElements);
//     }
// 
//     @Override
//     public Object getResponse() {
//         return returnValue;
//     }
// }
// 
// Path: src/main/java/org/rakam/cache/hazelcast/treemap/operations/IncrementByOperation.java
// public class IncrementByOperation extends TreeMapBackupAwareOperation {
//     private String key;
//     private long by;
// 
//     public IncrementByOperation(String name, String key, long by) {
//         super(name);
//         this.by = by;
//         this.key = key;
//     }
// 
//     public IncrementByOperation() {
// 
//     }
// 
//     @Override
//     protected void writeInternal(ObjectDataOutput out) throws IOException {
//         super.writeInternal(out);
//         out.writeLong(by);
//         out.writeUTF(key);
//     }
// 
//     @Override
//     protected void readInternal(ObjectDataInput in) throws IOException {
//         super.readInternal(in);
//         by = in.readLong();
//         key = in.readUTF();
//     }
// 
//     @Override
//     public void run() throws Exception {
// 
//         OrderedCounterMap map = ((TreeMapService) getService()).getHLL(name);
//         map.increment(key, by);
//     }
// 
//     @Override
//     public Operation getBackupOperation() {
//         return new IncrementByBackupOperation();
//     }
// 
//     @Override
//     public int getId() {
//         return TreeMapSerializerFactory.ADD;
//     }
// }


import com.hazelcast.spi.*;
import com.hazelcast.util.ExceptionUtil;
import org.rakam.cache.hazelcast.treemap.operations.GetOperation;
import org.rakam.cache.hazelcast.treemap.operations.IncrementByOperation;
import java.util.Map;
        try {
            OperationService operationService = getNodeEngine().getOperationService();
            return (InternalCompletableFuture<E>) operationService.invokeOnPartition(
                    TreeMapService.SERVICE_NAME, operation, partitionId);
        } catch (Throwable throwable) {
            throw ExceptionUtil.rethrow(throwable);
        }
    }

    @Override
    public String getServiceName() {
        return TreeMapService.SERVICE_NAME;
    }

    @Override
    public String toString() {
        return "Map{" + "name='" + name + '\'' + '}';
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public void increment(String key, long by) {
        asyncIncrementBy(key, by).getSafely();
    }

    public InternalCompletableFuture<Void> asyncIncrementBy(String key, long by) {
// Path: src/main/java/org/rakam/cache/hazelcast/treemap/operations/GetOperation.java
// public class GetOperation extends TreeMapBaseOperation {
//     private Integer numberOfElements = null;
//     private Map<String, Long> returnValue;
// 
//     public GetOperation(String name) {
//         super(name);
//     }
// 
//     public GetOperation() {
// 
//     }
// 
//     public GetOperation(String name, Integer numberOfElements) {
//         super(name);
//         this.numberOfElements = numberOfElements;
//     }
// 
//     @Override
//     public int getId() {
//         return TreeMapSerializerFactory.GET;
//     }
// 
//     @Override
//     public void run() throws Exception {
//         TreeMapService service = getService();
//         if(numberOfElements==null)
//             this.returnValue = service.getHLL(name).getAll();
//         else
//             this.returnValue = service.getHLL(name).getTopItems(numberOfElements);
//     }
// 
//     @Override
//     public Object getResponse() {
//         return returnValue;
//     }
// }
// 
// Path: src/main/java/org/rakam/cache/hazelcast/treemap/operations/IncrementByOperation.java
// public class IncrementByOperation extends TreeMapBackupAwareOperation {
//     private String key;
//     private long by;
// 
//     public IncrementByOperation(String name, String key, long by) {
//         super(name);
//         this.by = by;
//         this.key = key;
//     }
// 
//     public IncrementByOperation() {
// 
//     }
// 
//     @Override
//     protected void writeInternal(ObjectDataOutput out) throws IOException {
//         super.writeInternal(out);
//         out.writeLong(by);
//         out.writeUTF(key);
//     }
// 
//     @Override
//     protected void readInternal(ObjectDataInput in) throws IOException {
//         super.readInternal(in);
//         by = in.readLong();
//         key = in.readUTF();
//     }
// 
//     @Override
//     public void run() throws Exception {
// 
//         OrderedCounterMap map = ((TreeMapService) getService()).getHLL(name);
//         map.increment(key, by);
//     }
// 
//     @Override
//     public Operation getBackupOperation() {
//         return new IncrementByBackupOperation();
//     }
// 
//     @Override
//     public int getId() {
//         return TreeMapSerializerFactory.ADD;
//     }
// }


// Path: src/main/java/org/rakam/cache/hazelcast/treemap/TreeMapProxy.java
import com.hazelcast.spi.*;
import com.hazelcast.util.ExceptionUtil;
import org.rakam.cache.hazelcast.treemap.operations.GetOperation;
import org.rakam.cache.hazelcast.treemap.operations.IncrementByOperation;
import java.util.Map;

        try {
            OperationService operationService = getNodeEngine().getOperationService();
            return (InternalCompletableFuture<E>) operationService.invokeOnPartition(
                    TreeMapService.SERVICE_NAME, operation, partitionId);
        } catch (Throwable throwable) {
            throw ExceptionUtil.rethrow(throwable);
        }
    }

    @Override
    public String getServiceName() {
        return TreeMapService.SERVICE_NAME;
    }

    @Override
    public String toString() {
        return "Map{" + "name='" + name + '\'' + '}';
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public void increment(String key, long by) {
        asyncIncrementBy(key, by).getSafely();
    }

    public InternalCompletableFuture<Void> asyncIncrementBy(String key, long by) {
        Operation operation = new IncrementByOperation(name, key, by);