mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
71 lines
2.6 KiB
Java
71 lines
2.6 KiB
Java
/*
|
|
* Copyright (C) 2015 higherfrequencytrading.com
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
package net.openhft.chronicle.hash.impl;
|
|
|
|
import static net.openhft.lang.io.NativeBytes.UNSAFE;
|
|
|
|
public enum TierData {
|
|
;
|
|
|
|
public static final long NEXT_TIER_INDEX_OFFSET = 0L;
|
|
public static final long PREV_TIER_INDEX_OFFSET = NEXT_TIER_INDEX_OFFSET + 8L;
|
|
public static final long NEXT_POS_TO_SEARCH_FROM_TIERED_OFFSET = PREV_TIER_INDEX_OFFSET + 8L;
|
|
public static final long SEGMENT_INDEX_OFFSET = NEXT_POS_TO_SEARCH_FROM_TIERED_OFFSET + 8L;
|
|
public static final long TIER_OFFSET = SEGMENT_INDEX_OFFSET + 4L;
|
|
|
|
public static long nextTierIndex(long address) {
|
|
return UNSAFE.getLong(address + NEXT_TIER_INDEX_OFFSET);
|
|
}
|
|
|
|
public static void nextTierIndex(long address, long nextTierIndex) {
|
|
UNSAFE.putLong(address + NEXT_TIER_INDEX_OFFSET, nextTierIndex);
|
|
}
|
|
|
|
public static long nextPosToSearchFromTiered(long address) {
|
|
return UNSAFE.getLong(address + NEXT_POS_TO_SEARCH_FROM_TIERED_OFFSET);
|
|
}
|
|
|
|
public static void nextPosToSearchFromTiered(long address, long nextPosToSearchFrom) {
|
|
UNSAFE.putLong(address + NEXT_POS_TO_SEARCH_FROM_TIERED_OFFSET,
|
|
nextPosToSearchFrom);
|
|
}
|
|
|
|
public static long prevTierIndex(long address) {
|
|
return UNSAFE.getLong(address + PREV_TIER_INDEX_OFFSET);
|
|
}
|
|
|
|
public static void prevTierIndex(long address, long prevTierIndex) {
|
|
UNSAFE.putLong(address + PREV_TIER_INDEX_OFFSET, prevTierIndex);
|
|
}
|
|
|
|
public static int segmentIndex(long address) {
|
|
return UNSAFE.getInt(address + SEGMENT_INDEX_OFFSET);
|
|
}
|
|
|
|
public static void segmentIndex(long address, int segmentIndex) {
|
|
UNSAFE.putInt(address + SEGMENT_INDEX_OFFSET, segmentIndex);
|
|
}
|
|
|
|
public static int tier(long address) {
|
|
return UNSAFE.getInt(address + TIER_OFFSET);
|
|
}
|
|
|
|
public static void tier(long address, int tier) {
|
|
UNSAFE.putInt(address + TIER_OFFSET, tier);
|
|
}
|
|
}
|