github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/hadoopfs/src/main/java/io/lakefs/LakeFSFileStatus.java (about) 1 package io.lakefs; 2 3 import org.apache.hadoop.fs.FileStatus; 4 import org.apache.hadoop.fs.Path; 5 6 /** 7 * A class that represents the Lakefs status of a path. A path can be 8 * {@link io.lakefs.clients.api.model.ObjectStats.PathTypeEnum#OBJECT} or a 9 * {@link io.lakefs.clients.api.model.ObjectStats.PathTypeEnum#COMMON_PREFIX}. 10 * For lakefs objects, an instance of this class encapsulates its {@link io.lakefs.clients.api.model.ObjectStats}, and 11 * for common-prefix it acts as a markup that a common-prefix considered a directory. 12 */ 13 public class LakeFSFileStatus extends FileStatus { 14 15 private final String checksum; 16 private final String physicalAddress; 17 private final boolean isEmptyDirectory; 18 19 private LakeFSFileStatus(Builder builder) { 20 super(builder.length, builder.isdir, builder.blockReplication, builder.blockSize, builder.mTime, builder.path); 21 this.checksum = builder.checksum; 22 this.physicalAddress = builder.physicalAddress; 23 this.isEmptyDirectory = builder.isEmptyDirectory; 24 } 25 26 public String getChecksum() { 27 return checksum; 28 } 29 30 public String getPhysicalAddress() { 31 return physicalAddress; 32 } 33 34 public boolean isEmptyDirectory() { return isEmptyDirectory; } 35 36 public static class Builder { 37 private final Path path; 38 private long length; 39 private boolean isdir; 40 private short blockReplication; 41 private long blockSize; 42 private long mTime; 43 private String checksum; 44 private String physicalAddress; 45 private boolean isEmptyDirectory; 46 47 public Builder(Path path) { 48 this.path = path; 49 } 50 51 public Builder length(long length) { 52 this.length = length; 53 return this; 54 } 55 56 public Builder isdir(boolean isdir) { 57 this.isdir = isdir; 58 return this; 59 } 60 61 public Builder blockReplication(short blockReplication) { 62 this.blockReplication = blockReplication; 63 return this; 64 } 65 66 public Builder blockSize(long blockSize) { 67 this.blockSize = blockSize; 68 return this; 69 } 70 71 public Builder mTime(long mTime) { 72 this.mTime = mTime; 73 return this; 74 } 75 76 public Builder checksum(String checksum) { 77 this.checksum = checksum; 78 return this; 79 } 80 81 public Builder physicalAddress(String physicalAddress) { 82 this.physicalAddress = physicalAddress; 83 return this; 84 } 85 86 public Builder isEmptyDirectory(boolean isEmptyDirectory) { 87 this.isEmptyDirectory = isEmptyDirectory; 88 return this; 89 } 90 91 public LakeFSFileStatus build() { 92 return new LakeFSFileStatus(this); 93 } 94 } 95 }