/** */ BaselineTopologyHistory tailFrom(int id) { BaselineTopologyHistory tail = new BaselineTopologyHistory(); for (BaselineTopologyHistoryItem item : hist) { if (item.id() >= id) tail.hist.add(item); } return tail; }
/** */ void writeHistoryItem(ReadWriteMetastorage metastorage, BaselineTopologyHistoryItem histItem) throws IgniteCheckedException { if (histItem == null) return; hist.add(histItem); metastorage.write(METASTORE_BLT_HIST_PREFIX + histItem.id(), histItem); }
/** */ void removeHistory(ReadWriteMetastorage metastorage) throws IgniteCheckedException { if (hist.isEmpty()) return; for (BaselineTopologyHistoryItem histItem : hist) metastorage.remove(METASTORE_BLT_HIST_PREFIX + histItem.id()); hist.clear(); }
/** */ void flushHistoryItems(ReadWriteMetastorage metastorage) throws IgniteCheckedException { while(!bufferedForStore.isEmpty()) { BaselineTopologyHistoryItem item = bufferedForStore.remove(); metastorage.write(METASTORE_BLT_HIST_PREFIX + item.id(), item); } } }
/** * @param blt Blt. */ private void writeBaselineTopology(BaselineTopology blt, BaselineTopologyHistoryItem prevBltHistItem) throws IgniteCheckedException { assert metastorage != null; if (inMemoryMode) return; sharedCtx.database().checkpointReadLock(); try { if (blt != null) { if (log.isInfoEnabled()) { U.log(log, "Writing BaselineTopology[id=" + blt.id() + "]"); if (prevBltHistItem != null) U.log(log, "Writing BaselineTopologyHistoryItem[id=" + prevBltHistItem.id() + "]"); } bltHist.writeHistoryItem(metastorage, prevBltHistItem); metastorage.write(METASTORE_CURR_BLT_KEY, blt); } else { if (log.isInfoEnabled()) U.log(log, "Removing BaselineTopology and history"); metastorage.remove(METASTORE_CURR_BLT_KEY); bltHist.removeHistory(metastorage); } } finally { sharedCtx.database().checkpointReadUnlock(); } }
/** */ void flushHistoryItems(ReadWriteMetastorage metastorage) throws IgniteCheckedException { while(!bufferedForStore.isEmpty()) { BaselineTopologyHistoryItem item = bufferedForStore.remove(); metastorage.write(METASTORE_BLT_HIST_PREFIX + item.id(), item); } } }
/** */ BaselineTopologyHistory tailFrom(int id) { BaselineTopologyHistory tail = new BaselineTopologyHistory(); for (BaselineTopologyHistoryItem item : hist) { if (item.id() >= id) tail.hist.add(item); } return tail; }
/** */ void writeHistoryItem(ReadWriteMetastorage metastorage, BaselineTopologyHistoryItem histItem) throws IgniteCheckedException { if (histItem == null) return; hist.add(histItem); metastorage.write(METASTORE_BLT_HIST_PREFIX + histItem.id(), histItem); }
/** */ void removeHistory(ReadWriteMetastorage metastorage) throws IgniteCheckedException { if (hist.isEmpty()) return; for (BaselineTopologyHistoryItem histItem : hist) metastorage.remove(METASTORE_BLT_HIST_PREFIX + histItem.id()); hist.clear(); }
/** * @param blt Blt. */ private void writeBaselineTopology(BaselineTopology blt, BaselineTopologyHistoryItem prevBltHistItem) throws IgniteCheckedException { assert metastorage != null; if (inMemoryMode) return; sharedCtx.database().checkpointReadLock(); try { if (blt != null) { if (log.isInfoEnabled()) { U.log(log, "Writing BaselineTopology[id=" + blt.id() + "]"); if (prevBltHistItem != null) U.log(log, "Writing BaselineTopologyHistoryItem[id=" + prevBltHistItem.id() + "]"); } bltHist.writeHistoryItem(metastorage, prevBltHistItem); metastorage.write(METASTORE_CURR_BLT_KEY, blt); } else { if (log.isInfoEnabled()) U.log(log, "Removing BaselineTopology and history"); metastorage.remove(METASTORE_CURR_BLT_KEY); bltHist.removeHistory(metastorage); } } finally { sharedCtx.database().checkpointReadUnlock(); } }