From 596d476e3d858d2cb0520231f1da44804e7f2be1 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 25 Oct 2020 14:44:18 -0700 Subject: HCFS: 1.5.2 --- .../src/main/java/seaweedfs/client/FileChunkManifest.java | 8 ++++---- .../client/src/main/java/seaweedfs/client/SeaweedWrite.java | 11 +++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'other/java/client/src') diff --git a/other/java/client/src/main/java/seaweedfs/client/FileChunkManifest.java b/other/java/client/src/main/java/seaweedfs/client/FileChunkManifest.java index 79e8d9bc4..3293db2ca 100644 --- a/other/java/client/src/main/java/seaweedfs/client/FileChunkManifest.java +++ b/other/java/client/src/main/java/seaweedfs/client/FileChunkManifest.java @@ -86,7 +86,7 @@ public class FileChunkManifest { } public static List maybeManifestize( - final FilerGrpcClient filerGrpcClient, List inputChunks) throws IOException { + final FilerGrpcClient filerGrpcClient, List inputChunks, String parentDirectory) throws IOException { // the return variable List chunks = new ArrayList<>(); @@ -101,7 +101,7 @@ public class FileChunkManifest { int remaining = dataChunks.size(); for (int i = 0; i + mergeFactor < dataChunks.size(); i += mergeFactor) { - FilerProto.FileChunk chunk = mergeIntoManifest(filerGrpcClient, dataChunks.subList(i, i + mergeFactor)); + FilerProto.FileChunk chunk = mergeIntoManifest(filerGrpcClient, dataChunks.subList(i, i + mergeFactor), parentDirectory); chunks.add(chunk); remaining -= mergeFactor; } @@ -113,7 +113,7 @@ public class FileChunkManifest { return chunks; } - private static FilerProto.FileChunk mergeIntoManifest(final FilerGrpcClient filerGrpcClient, List dataChunks) throws IOException { + private static FilerProto.FileChunk mergeIntoManifest(final FilerGrpcClient filerGrpcClient, List dataChunks, String parentDirectory) throws IOException { // create and serialize the manifest dataChunks = FilerClient.beforeEntrySerialization(dataChunks); FilerProto.FileChunkManifest.Builder m = FilerProto.FileChunkManifest.newBuilder().addAllChunks(dataChunks); @@ -130,7 +130,7 @@ public class FileChunkManifest { filerGrpcClient.getReplication(), filerGrpcClient, minOffset, - data, 0, data.length); + data, 0, data.length, parentDirectory); manifestChunk.setIsChunkManifest(true); manifestChunk.setSize(maxOffset - minOffset); return manifestChunk.build(); diff --git a/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java b/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java index d3cecab75..121a0fbee 100644 --- a/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java +++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java @@ -26,9 +26,10 @@ public class SeaweedWrite { final FilerGrpcClient filerGrpcClient, final long offset, 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( - replication, filerGrpcClient, offset, bytes, bytesOffset, bytesLength); + replication, filerGrpcClient, offset, bytes, bytesOffset, bytesLength, parentPath); synchronized (entry) { entry.addChunks(chunkBuilder); } @@ -39,13 +40,15 @@ public class SeaweedWrite { final long offset, final byte[] bytes, final long bytesOffset, - final long bytesLength) throws IOException { + final long bytesLength, + final String parentPath) throws IOException { FilerProto.AssignVolumeResponse response = filerGrpcClient.getBlockingStub().assignVolume( FilerProto.AssignVolumeRequest.newBuilder() .setCollection(filerGrpcClient.getCollection()) .setReplication(replication == null ? filerGrpcClient.getReplication() : replication) .setDataCenter("") .setTtlSec(0) + .setParentPath(parentPath) .build()); String fileId = response.getFileId(); String url = response.getUrl(); @@ -77,7 +80,7 @@ public class SeaweedWrite { final FilerProto.Entry.Builder entry) throws IOException { synchronized (entry) { - List chunks = FileChunkManifest.maybeManifestize(filerGrpcClient, entry.getChunksList()); + List chunks = FileChunkManifest.maybeManifestize(filerGrpcClient, entry.getChunksList(), parentDirectory); entry.clearChunks(); entry.addAllChunks(chunks); filerGrpcClient.getBlockingStub().createEntry( -- cgit v1.2.3 From f375b93aefd8d7358df7ff5232d522a31bd15afb Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 25 Oct 2020 15:32:43 -0700 Subject: renaming --- .../java/client/src/main/java/seaweedfs/client/SeaweedWrite.java | 8 ++++---- other/java/client/src/main/proto/filer.proto | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'other/java/client/src') diff --git a/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java b/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java index 121a0fbee..b8fd3e299 100644 --- a/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java +++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java @@ -27,9 +27,9 @@ public class SeaweedWrite { final long offset, final byte[] bytes, final long bytesOffset, final long bytesLength, - final String parentPath) throws IOException { + final String path) throws IOException { FilerProto.FileChunk.Builder chunkBuilder = writeChunk( - replication, filerGrpcClient, offset, bytes, bytesOffset, bytesLength, parentPath); + replication, filerGrpcClient, offset, bytes, bytesOffset, bytesLength, path); synchronized (entry) { entry.addChunks(chunkBuilder); } @@ -41,14 +41,14 @@ public class SeaweedWrite { final byte[] bytes, final long bytesOffset, final long bytesLength, - final String parentPath) throws IOException { + final String path) throws IOException { FilerProto.AssignVolumeResponse response = filerGrpcClient.getBlockingStub().assignVolume( FilerProto.AssignVolumeRequest.newBuilder() .setCollection(filerGrpcClient.getCollection()) .setReplication(replication == null ? filerGrpcClient.getReplication() : replication) .setDataCenter("") .setTtlSec(0) - .setParentPath(parentPath) + .setPath(path) .build()); String fileId = response.getFileId(); String url = response.getUrl(); diff --git a/other/java/client/src/main/proto/filer.proto b/other/java/client/src/main/proto/filer.proto index 40a46b33f..11c29e6ec 100644 --- a/other/java/client/src/main/proto/filer.proto +++ b/other/java/client/src/main/proto/filer.proto @@ -217,7 +217,7 @@ message AssignVolumeRequest { string replication = 3; int32 ttl_sec = 4; string data_center = 5; - string parent_path = 6; + string path = 6; string rack = 7; } -- cgit v1.2.3