|
@ -1,14 +1,11 @@ |
|
|
package seaweed.hdfs; |
|
|
package seaweed.hdfs; |
|
|
|
|
|
|
|
|
import org.apache.hadoop.hdfs.util.ByteBufferOutputStream; |
|
|
|
|
|
import org.apache.http.HttpEntity; |
|
|
import org.apache.http.HttpEntity; |
|
|
import org.apache.http.HttpHeaders; |
|
|
import org.apache.http.HttpHeaders; |
|
|
import org.apache.http.HttpResponse; |
|
|
import org.apache.http.HttpResponse; |
|
|
import org.apache.http.client.HttpClient; |
|
|
import org.apache.http.client.HttpClient; |
|
|
import org.apache.http.client.methods.HttpGet; |
|
|
import org.apache.http.client.methods.HttpGet; |
|
|
import org.apache.http.impl.client.HttpClientBuilder; |
|
|
import org.apache.http.impl.client.HttpClientBuilder; |
|
|
import org.slf4j.Logger; |
|
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
import seaweedfs.client.FilerGrpcClient; |
|
|
import seaweedfs.client.FilerGrpcClient; |
|
|
import seaweedfs.client.FilerProto; |
|
|
import seaweedfs.client.FilerProto; |
|
|
|
|
|
|
|
@ -23,7 +20,7 @@ import java.util.Map; |
|
|
|
|
|
|
|
|
public class SeaweedRead { |
|
|
public class SeaweedRead { |
|
|
|
|
|
|
|
|
private static final Logger LOG = LoggerFactory.getLogger(SeaweedRead.class); |
|
|
|
|
|
|
|
|
// private static final Logger LOG = LoggerFactory.getLogger(SeaweedRead.class); |
|
|
|
|
|
|
|
|
// returns bytesRead |
|
|
// returns bytesRead |
|
|
public static long read(FilerGrpcClient filerGrpcClient, List<VisibleInterval> visibleIntervals, |
|
|
public static long read(FilerGrpcClient filerGrpcClient, List<VisibleInterval> visibleIntervals, |
|
@ -81,7 +78,7 @@ public class SeaweedRead { |
|
|
int len = (int) (chunkView.logicOffset - position + chunkView.size); |
|
|
int len = (int) (chunkView.logicOffset - position + chunkView.size); |
|
|
OutputStream outputStream = new ByteBufferOutputStream(ByteBuffer.wrap(buffer, startOffset, len)); |
|
|
OutputStream outputStream = new ByteBufferOutputStream(ByteBuffer.wrap(buffer, startOffset, len)); |
|
|
entity.writeTo(outputStream); |
|
|
entity.writeTo(outputStream); |
|
|
LOG.debug("* read chunkView:{} startOffset:{} length:{}", chunkView, startOffset, len); |
|
|
|
|
|
|
|
|
// LOG.debug("* read chunkView:{} startOffset:{} length:{}", chunkView, startOffset, len); |
|
|
|
|
|
|
|
|
return len; |
|
|
return len; |
|
|
|
|
|
|
|
|