|
@ -26,9 +26,10 @@ public class SeaweedWrite { |
|
|
final FilerGrpcClient filerGrpcClient, |
|
|
final FilerGrpcClient filerGrpcClient, |
|
|
final long offset, |
|
|
final long offset, |
|
|
final byte[] bytes, |
|
|
final byte[] bytes, |
|
|
final long bytesOffset, final long bytesLength) throws IOException { |
|
|
|
|
|
|
|
|
final long bytesOffset, final long bytesLength, |
|
|
|
|
|
final String parentPath) throws IOException { |
|
|
FilerProto.FileChunk.Builder chunkBuilder = writeChunk( |
|
|
FilerProto.FileChunk.Builder chunkBuilder = writeChunk( |
|
|
replication, filerGrpcClient, offset, bytes, bytesOffset, bytesLength); |
|
|
|
|
|
|
|
|
replication, filerGrpcClient, offset, bytes, bytesOffset, bytesLength, parentPath); |
|
|
synchronized (entry) { |
|
|
synchronized (entry) { |
|
|
entry.addChunks(chunkBuilder); |
|
|
entry.addChunks(chunkBuilder); |
|
|
} |
|
|
} |
|
@ -39,13 +40,15 @@ public class SeaweedWrite { |
|
|
final long offset, |
|
|
final long offset, |
|
|
final byte[] bytes, |
|
|
final byte[] bytes, |
|
|
final long bytesOffset, |
|
|
final long bytesOffset, |
|
|
final long bytesLength) throws IOException { |
|
|
|
|
|
|
|
|
final long bytesLength, |
|
|
|
|
|
final String parentPath) throws IOException { |
|
|
FilerProto.AssignVolumeResponse response = filerGrpcClient.getBlockingStub().assignVolume( |
|
|
FilerProto.AssignVolumeResponse response = filerGrpcClient.getBlockingStub().assignVolume( |
|
|
FilerProto.AssignVolumeRequest.newBuilder() |
|
|
FilerProto.AssignVolumeRequest.newBuilder() |
|
|
.setCollection(filerGrpcClient.getCollection()) |
|
|
.setCollection(filerGrpcClient.getCollection()) |
|
|
.setReplication(replication == null ? filerGrpcClient.getReplication() : replication) |
|
|
.setReplication(replication == null ? filerGrpcClient.getReplication() : replication) |
|
|
.setDataCenter("") |
|
|
.setDataCenter("") |
|
|
.setTtlSec(0) |
|
|
.setTtlSec(0) |
|
|
|
|
|
.setParentPath(parentPath) |
|
|
.build()); |
|
|
.build()); |
|
|
String fileId = response.getFileId(); |
|
|
String fileId = response.getFileId(); |
|
|
String url = response.getUrl(); |
|
|
String url = response.getUrl(); |
|
@ -77,7 +80,7 @@ public class SeaweedWrite { |
|
|
final FilerProto.Entry.Builder entry) throws IOException { |
|
|
final FilerProto.Entry.Builder entry) throws IOException { |
|
|
|
|
|
|
|
|
synchronized (entry) { |
|
|
synchronized (entry) { |
|
|
List<FilerProto.FileChunk> chunks = FileChunkManifest.maybeManifestize(filerGrpcClient, entry.getChunksList()); |
|
|
|
|
|
|
|
|
List<FilerProto.FileChunk> chunks = FileChunkManifest.maybeManifestize(filerGrpcClient, entry.getChunksList(), parentDirectory); |
|
|
entry.clearChunks(); |
|
|
entry.clearChunks(); |
|
|
entry.addAllChunks(chunks); |
|
|
entry.addAllChunks(chunks); |
|
|
filerGrpcClient.getBlockingStub().createEntry( |
|
|
filerGrpcClient.getBlockingStub().createEntry( |
|
|