From 3a7d33147feced4346e7266e8f0317e0c38d229c Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 6 May 2021 10:51:05 -0700 Subject: [PATCH] Updated SeaweedFS Java Client (markdown) --- SeaweedFS-Java-Client.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/SeaweedFS-Java-Client.md b/SeaweedFS-Java-Client.md index 46b793c..4dd048f 100644 --- a/SeaweedFS-Java-Client.md +++ b/SeaweedFS-Java-Client.md @@ -95,4 +95,21 @@ You can also use this API for standard file manipulation: directory listing, fil filerClient.rm("/new_folder/new_empty_file", false, true); filerClient.rm("/new_folder", true, true); +``` + +## Advanced Usage +Sometimes you may need to go deeper. For example, change modification time `mtime`. + +``` + // load existing entry + FilerProto.Entry entry = filerClient.lookupEntry("/some/dir","entryName"); + + // change the attribute + FilerProto.Entry.Builder entryBuilder = FilerProto.Entry.newBuilder(entry); + FilerProto.FuseAttributes.Builder attrBuilder = FilerProto.FuseAttributes.newBuilder(entry.getAttributes()); + attrBuilder.setMtime(...) + + // save the new entry + entryBuilder.setAttributes(attrBuilder); + filerClient.updateEntry("/some/dir", entryBuilder.build()); ``` \ No newline at end of file