// Path: kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/exceptions/KafkaPartitionReaderException.java
// public class KafkaPartitionReaderException extends RuntimeException {
// 	private static final long serialVersionUID = -5969989670100717318L;
// 	private short code;
// 	public KafkaPartitionReaderException(short code){
// 		super("KafkaPartition Reader Exception.code="+code);
// 		this.code=code;
// 	}
// 	public KafkaPartitionReaderException(short code,String msg){
// 		super(msg);
// 		this.code=code;
// 	}
// 	public short getCode(){
// 		return code;
// 	}
// }


import com.ebay.pulsar.druid.firehose.kafka.support.exceptions.KafkaPartitionReaderException;
import kafka.message.MessageAndMetadata;
import java.util.List;
/*******************************************************************************
*  Copyright © 2012-2015 eBay Software Foundation
*  This program is licensed under the Apache 2.0 licenses.
*  Please see LICENSE for more information.
*******************************************************************************/
package com.ebay.pulsar.druid.firehose.kafka.support.api;





/**
 *@author qxing
 * 1. Read event
 * 2. Manage read offset
 * 3. Manage commit offset
 * 4. Be aware of group, topic, partition information.
 **/
public interface PartitionReader extends Comparable<PartitionReader>{
	public PartitionReader startFrom(long offset);
	
	public void reinit();
	/**
	 * 	read events.
	 * 
	 * any errors occurred druing the read process are wrapped as KafkaPartitionReaderException which contains the error code
	 * the exception should be processed by consumer.
	 * 
	 * @return
	 * @throws KafkaPartitionReaderException
	 */
	public List<MessageAndMetadata<byte[],byte[]>> readEvents() throws KafkaPartitionReaderException ;
	public boolean readToTheEnd() ;
	public long getLargestOffset() ;
	public long fetchSmallestOffset();
	public long fetchResetOffset(String reset);
	public void commitOffset() throws Exception ;
	public void markCommitOffset();
	public long getBatchSize();
	public void initOffset() throws Exception; 
	public void resetOffset() throws Exception;
	public long getAndSetCommitOffset(long val);
	public boolean isTaken();
	public void release() ;
	public long calcWaitTime() ;
	public long getReadOffset();
// Path: kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/exceptions/KafkaPartitionReaderException.java
// public class KafkaPartitionReaderException extends RuntimeException {
// 	private static final long serialVersionUID = -5969989670100717318L;
// 	private short code;
// 	public KafkaPartitionReaderException(short code){
// 		super("KafkaPartition Reader Exception.code="+code);
// 		this.code=code;
// 	}
// 	public KafkaPartitionReaderException(short code,String msg){
// 		super(msg);
// 		this.code=code;
// 	}
// 	public short getCode(){
// 		return code;
// 	}
// }


// Path: kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/api/PartitionReader.java
import com.ebay.pulsar.druid.firehose.kafka.support.exceptions.KafkaPartitionReaderException;
import kafka.message.MessageAndMetadata;
import java.util.List;

/*******************************************************************************
*  Copyright © 2012-2015 eBay Software Foundation
*  This program is licensed under the Apache 2.0 licenses.
*  Please see LICENSE for more information.
*******************************************************************************/
package com.ebay.pulsar.druid.firehose.kafka.support.api;





/**
 *@author qxing
 * 1. Read event
 * 2. Manage read offset
 * 3. Manage commit offset
 * 4. Be aware of group, topic, partition information.
 **/
public interface PartitionReader extends Comparable<PartitionReader>{
	public PartitionReader startFrom(long offset);
	
	public void reinit();
	/**
	 * 	read events.
	 * 
	 * any errors occurred druing the read process are wrapped as KafkaPartitionReaderException which contains the error code
	 * the exception should be processed by consumer.
	 * 
	 * @return
	 * @throws KafkaPartitionReaderException
	 */
	public List<MessageAndMetadata<byte[],byte[]>> readEvents() throws KafkaPartitionReaderException ;
	public boolean readToTheEnd() ;
	public long getLargestOffset() ;
	public long fetchSmallestOffset();
	public long fetchResetOffset(String reset);
	public void commitOffset() throws Exception ;
	public void markCommitOffset();
	public long getBatchSize();
	public void initOffset() throws Exception; 
	public void resetOffset() throws Exception;
	public long getAndSetCommitOffset(long val);
	public boolean isTaken();
	public void release() ;
	public long calcWaitTime() ;
	public long getReadOffset();
	public void setReadOffset(long readOffset);