All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hazelcast.config.MemoryTierConfig Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2008-2024, Hazelcast, Inc. All Rights Reserved.
 *
 * Licensed 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 com.hazelcast.config;

import com.hazelcast.memory.Capacity;
import com.hazelcast.memory.MemoryUnit;

import java.util.Objects;

/**
 * Memory tier configuration of Tiered-Store.
 *
 * @since 5.1
 */
public class MemoryTierConfig {

    /**
     * Default capacity. It is 256 MB.
     */
    public static final Capacity DEFAULT_CAPACITY = Capacity.of(256, MemoryUnit.MEGABYTES);

    private Capacity capacity = DEFAULT_CAPACITY;

    public MemoryTierConfig() {

    }

    public MemoryTierConfig(MemoryTierConfig memoryTierConfig) {
        capacity = memoryTierConfig.getCapacity();
    }

    /**
     * Returns the capacity of this memory tier.
     *
     * @return memory tier capacity.
     */
    public Capacity getCapacity() {
        return capacity;
    }

    /**
     * Sets the capacity of this memory tier.
     *
     * @param capacity capacity.
     * @return this MemoryTierConfig
     */
    public MemoryTierConfig setCapacity(Capacity capacity) {
        this.capacity = capacity;
        return this;
    }

    @Override
    public final boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof MemoryTierConfig that)) {
            return false;
        }

        return Objects.equals(capacity, that.capacity);
    }

    @Override
    public final int hashCode() {
        return capacity != null ? capacity.hashCode() : 0;
    }

    @Override
    public String toString() {
        return "MemoryTierConfig{"
                + "capacity=" + capacity
                + '}';
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy