Search in sources :

Example 1 with FileStateProto

use of org.smartdata.protocol.ClientServerProto.FileStateProto in project SSM by Intel-bigdata.

the class ProtoBufferHelper method convert.

public static FileStateProto convert(FileState fileState) {
    FileStateProto.Builder builder = FileStateProto.newBuilder();
    builder.setPath(fileState.getPath()).setType(fileState.getFileType().getValue()).setStage(fileState.getFileStage().getValue());
    if (fileState instanceof CompactFileState) {
        FileContainerInfo fileContainerInfo = ((CompactFileState) fileState).getFileContainerInfo();
        builder.setCompactFileState(CompactFileStateProto.newBuilder().setContainerFilePath(fileContainerInfo.getContainerFilePath()).setOffset(fileContainerInfo.getOffset()).setLength(fileContainerInfo.getLength()));
    } else if (fileState instanceof CompressionFileState) {
        builder.setCompressionFileState(convert((CompressionFileState) fileState));
    }
    /*else if (fileState instanceof S3FileState) {
      builder.setS3FileState();
    } else if (fileState instanceof ) {
    }
    */
    return builder.build();
}
Also used : CompressionFileState(org.smartdata.model.CompressionFileState) FileContainerInfo(org.smartdata.model.FileContainerInfo) CompactFileStateProto(org.smartdata.protocol.ClientServerProto.CompactFileStateProto) S3FileStateProto(org.smartdata.protocol.ClientServerProto.S3FileStateProto) CompressionFileStateProto(org.smartdata.protocol.ClientServerProto.CompressionFileStateProto) FileStateProto(org.smartdata.protocol.ClientServerProto.FileStateProto) CompactFileState(org.smartdata.model.CompactFileState)

Aggregations

CompactFileState (org.smartdata.model.CompactFileState)1 CompressionFileState (org.smartdata.model.CompressionFileState)1 FileContainerInfo (org.smartdata.model.FileContainerInfo)1 CompactFileStateProto (org.smartdata.protocol.ClientServerProto.CompactFileStateProto)1 CompressionFileStateProto (org.smartdata.protocol.ClientServerProto.CompressionFileStateProto)1 FileStateProto (org.smartdata.protocol.ClientServerProto.FileStateProto)1 S3FileStateProto (org.smartdata.protocol.ClientServerProto.S3FileStateProto)1