Tabnine Logo
org.apache.rocketmq.store
Code IndexAdd Tabnine to your IDE (free)

How to use org.apache.rocketmq.store

Best Java code snippets using org.apache.rocketmq.store (Showing top 20 results out of 315)

origin: apache/rocketmq

public boolean flush(final int flushLeastPages) {
  boolean result = this.mappedFileQueue.flush(flushLeastPages);
  if (isExtReadEnable()) {
    result = result & this.consumeQueueExt.flush(flushLeastPages);
  }
  return result;
}
origin: apache/rocketmq

/**
 * Minus address saved in file.
 */
public long getMinAddress() {
  MappedFile firstFile = this.mappedFileQueue.getFirstMappedFile();
  if (firstFile == null) {
    return decorate(0);
  }
  return decorate(firstFile.getFileFromOffset());
}
origin: apache/rocketmq

public void destroy() {
  this.maxPhysicOffset = -1;
  this.minLogicOffset = 0;
  this.mappedFileQueue.destroy();
  if (isExtReadEnable()) {
    this.consumeQueueExt.destroy();
  }
}
origin: apache/rocketmq

@Override
public long getEarliestMessageTime(String topic, int queueId) {
  ConsumeQueue logicQueue = this.findConsumeQueue(topic, queueId);
  if (logicQueue != null) {
    long minLogicOffset = logicQueue.getMinLogicOffset();
    SelectMappedBufferResult result = logicQueue.getIndexBuffer(minLogicOffset / ConsumeQueue.CQ_STORE_UNIT_SIZE);
    return getStoreTime(result);
  }
  return -1;
}
origin: apache/rocketmq

public long getMinOffset() {
  MappedFile mappedFile = this.mappedFileQueue.getFirstMappedFile();
  if (mappedFile != null) {
    if (mappedFile.isAvailable()) {
      return mappedFile.getFileFromOffset();
    } else {
      return this.rollNextFile(mappedFile.getFileFromOffset());
    }
  }
  return -1;
}
origin: apache/rocketmq

@Override
public long getMessageStoreTimeStamp(String topic, int queueId, long consumeQueueOffset) {
  ConsumeQueue logicQueue = this.findConsumeQueue(topic, queueId);
  if (logicQueue != null) {
    SelectMappedBufferResult result = logicQueue.getIndexBuffer(consumeQueueOffset);
    return getStoreTime(result);
  }
  return -1;
}
origin: apache/rocketmq

private void recover(final boolean lastExitOK) {
  long maxPhyOffsetOfConsumeQueue = this.recoverConsumeQueue();
  if (lastExitOK) {
    this.commitLog.recoverNormally(maxPhyOffsetOfConsumeQueue);
  } else {
    this.commitLog.recoverAbnormally(maxPhyOffsetOfConsumeQueue);
  }
  this.recoverTopicQueueTable();
}
origin: apache/rocketmq

public SelectMappedBufferResult getIndexBuffer(final long startIndex) {
  int mappedFileSize = this.mappedFileSize;
  long offset = startIndex * CQ_STORE_UNIT_SIZE;
  if (offset >= this.getMinLogicOffset()) {
    MappedFile mappedFile = this.mappedFileQueue.findMappedFileByOffset(offset);
    if (mappedFile != null) {
      SelectMappedBufferResult result = mappedFile.selectMappedBuffer((int) (offset % mappedFileSize));
      return result;
    }
  }
  return null;
}
origin: apache/rocketmq

public void checkSelf() {
  mappedFileQueue.checkSelf();
  if (isExtReadEnable()) {
    this.consumeQueueExt.checkSelf();
  }
}
origin: apache/rocketmq

/**
 * Get data from buffer.
 *
 * @param address less than 0
 */
public CqExtUnit get(final long address) {
  CqExtUnit cqExtUnit = new CqExtUnit();
  if (get(address, cqExtUnit)) {
    return cqExtUnit;
  }
  return null;
}
origin: apache/rocketmq

public long getMaxOffset() {
  MappedFile mappedFile = getLastMappedFile();
  if (mappedFile != null) {
    return mappedFile.getFileFromOffset() + mappedFile.getReadPosition();
  }
  return 0;
}
origin: apache/rocketmq

public boolean commit(final int commitLeastPages) {
  boolean result = true;
  MappedFile mappedFile = this.findMappedFileByOffset(this.committedWhere, this.committedWhere == 0);
  if (mappedFile != null) {
    int offset = mappedFile.commit(commitLeastPages);
    long where = mappedFile.getFileFromOffset() + offset;
    result = where == this.committedWhere;
    this.committedWhere = where;
  }
  return result;
}
origin: apache/rocketmq

public long getMaxOffsetInQueue(String topic, int queueId) {
  ConsumeQueue logic = this.findConsumeQueue(topic, queueId);
  if (logic != null) {
    long offset = logic.getMaxOffsetInQueue();
    return offset;
  }
  return 0;
}
origin: apache/rocketmq

public long getMinOffsetInQueue(String topic, int queueId) {
  ConsumeQueue logic = this.findConsumeQueue(topic, queueId);
  if (logic != null) {
    return logic.getMinOffsetInQueue();
  }
  return -1;
}
origin: apache/rocketmq

public ConsumeQueueExt.CqExtUnit getExt(final long offset) {
  if (isExtReadEnable()) {
    return this.consumeQueueExt.get(offset);
  }
  return null;
}
origin: apache/rocketmq

public long getOffsetInQueueByTime(String topic, int queueId, long timestamp) {
  ConsumeQueue logic = this.findConsumeQueue(topic, queueId);
  if (logic != null) {
    return logic.getOffsetInQueueByTime(timestamp);
  }
  return 0;
}
origin: apache/rocketmq

public MappedFile getMappedFileByTime(final long timestamp) {
  Object[] mfs = this.copyMappedFiles(0);
  if (null == mfs)
    return null;
  for (int i = 0; i < mfs.length; i++) {
    MappedFile mappedFile = (MappedFile) mfs[i];
    if (mappedFile.getLastModifiedTimestamp() >= timestamp) {
      return mappedFile;
    }
  }
  return (MappedFile) mfs[mfs.length - 1];
}
origin: apache/rocketmq

public void init(final String fileName, final int fileSize,
  final TransientStorePool transientStorePool) throws IOException {
  init(fileName, fileSize);
  this.writeBuffer = transientStorePool.borrowBuffer();
  this.transientStorePool = transientStorePool;
}
origin: apache/rocketmq

public int deleteExpiredFile(long offset) {
  int cnt = this.mappedFileQueue.deleteExpiredFileByOffset(offset, CQ_STORE_UNIT_SIZE);
  this.correctMinOffset(offset);
  return cnt;
}
origin: apache/rocketmq

public boolean getExt(final long offset, ConsumeQueueExt.CqExtUnit cqExtUnit) {
  if (isExtReadEnable()) {
    return this.consumeQueueExt.get(offset, cqExtUnit);
  }
  return false;
}
org.apache.rocketmq.store

Most used classes

  • MessageStoreConfig
  • AppendMessageResult
    When write a message to the commit log, returns results
  • CommitLog
    Store all metadata downtime for recovery, data protection reliability
  • ConsumeQueue
  • ConsumeQueueExt$CqExtUnit
    Store unit.
  • DispatchRequest,
  • GetMessageResult,
  • MessageExtBrokerInner,
  • MessageFilter,
  • MessageStore,
  • PutMessageResult,
  • QueryMessageResult,
  • SelectMappedBufferResult,
  • BrokerRole,
  • StorePathConfigHelper,
  • ScheduleMessageService,
  • BrokerStatsManager,
  • HAService,
  • AllocateMappedFileService$AllocateRequest
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now