|
@ -45,9 +45,7 @@ public class SeaweedWrite { |
|
|
|
|
|
|
|
|
String etag = multipartUpload(targetUrl, auth, bytes, bytesOffset, bytesLength, cipherKey); |
|
|
String etag = multipartUpload(targetUrl, auth, bytes, bytesOffset, bytesLength, cipherKey); |
|
|
|
|
|
|
|
|
// cache fileId ~ bytes |
|
|
|
|
|
SeaweedRead.chunkCache.setChunk(fileId, bytes); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
synchronized (entry) { |
|
|
entry.addChunks(FilerProto.FileChunk.newBuilder() |
|
|
entry.addChunks(FilerProto.FileChunk.newBuilder() |
|
|
.setFileId(fileId) |
|
|
.setFileId(fileId) |
|
|
.setOffset(offset) |
|
|
.setOffset(offset) |
|
@ -56,11 +54,16 @@ public class SeaweedWrite { |
|
|
.setETag(etag) |
|
|
.setETag(etag) |
|
|
.setCipherKey(cipherKeyString) |
|
|
.setCipherKey(cipherKeyString) |
|
|
); |
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// cache fileId ~ bytes |
|
|
|
|
|
SeaweedRead.chunkCache.setChunk(fileId, bytes); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static void writeMeta(final FilerGrpcClient filerGrpcClient, |
|
|
public static void writeMeta(final FilerGrpcClient filerGrpcClient, |
|
|
final String parentDirectory, final FilerProto.Entry.Builder entry) { |
|
|
final String parentDirectory, final FilerProto.Entry.Builder entry) { |
|
|
|
|
|
synchronized (entry){ |
|
|
filerGrpcClient.getBlockingStub().createEntry( |
|
|
filerGrpcClient.getBlockingStub().createEntry( |
|
|
FilerProto.CreateEntryRequest.newBuilder() |
|
|
FilerProto.CreateEntryRequest.newBuilder() |
|
|
.setDirectory(parentDirectory) |
|
|
.setDirectory(parentDirectory) |
|
@ -68,6 +71,7 @@ public class SeaweedWrite { |
|
|
.build() |
|
|
.build() |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private static String multipartUpload(String targetUrl, |
|
|
private static String multipartUpload(String targetUrl, |
|
|
String auth, |
|
|
String auth, |
|
|