Package alluxio.grpc

Class GrpcUtils


  • @ThreadSafe
    public final class GrpcUtils
    extends java.lang.Object
    Utility methods for conversion between wire types and grpc types.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static alluxio.grpc.Scope combine​(alluxio.grpc.Scope scope1, alluxio.grpc.Scope scope2)  
      static boolean contains​(alluxio.grpc.Scope source, alluxio.grpc.Scope target)  
      static alluxio.grpc.MountPOptions fromMountEntry​(alluxio.proto.journal.File.AddMountPointEntry mountEntryPoint)
      Creates mount proto options from File.AddMountPointEntry.
      static BlockInfo fromProto​(alluxio.grpc.BlockInfo blockPInfo)
      Converts a proto type to a wire type.
      static BlockLocation fromProto​(alluxio.grpc.BlockLocation blockPLocation)
      Converts a proto type to a wire type.
      static FileBlockInfo fromProto​(alluxio.grpc.FileBlockInfo fileBlockPInfo)
      Converts a proto type to a wire type.
      static FileInfo fromProto​(alluxio.grpc.FileInfo pInfo)
      Converts a proto type to a wire type.
      static DescendantType fromProto​(alluxio.grpc.LoadDescendantPType pDescendantType)
      Converts a proto type to a wire type.
      static TieredIdentity.LocalityTier fromProto​(alluxio.grpc.LocalityTier localityPTier)
      Converts a proto type to a wire type.
      static MountPointInfo fromProto​(alluxio.grpc.MountPointInfo mountPointPInfo)
      Converts a proto type to a wire type.
      static AccessControlList fromProto​(alluxio.grpc.PAcl pAcl)  
      static AclAction fromProto​(alluxio.grpc.PAclAction pAction)  
      static AclEntry fromProto​(alluxio.grpc.PAclEntry pAclEntry)  
      static AclEntryType fromProto​(alluxio.grpc.PAclEntryType pAclEntryType)  
      static TieredIdentity fromProto​(alluxio.grpc.TieredIdentity tieredPIdentity)
      Converts a proto type to a wire type.
      static WorkerInfo fromProto​(alluxio.grpc.WorkerInfo workerInfo)
      Converts a proto type to a wire type.
      static WorkerNetAddress fromProto​(alluxio.grpc.WorkerNetAddress workerNetPAddress)
      Converts a proto type to a wire type.
      static java.net.InetSocketAddress[] netAddressToSocketAddress​(java.util.List<alluxio.grpc.NetAddress> request)
      Convert a list of NetAddress to InetSocketAddress.
      static alluxio.grpc.GetStatusPOptions toGetStatusOptions​(alluxio.grpc.ExistsPOptions existsOptions)
      Converts from proto type to options.
      static alluxio.grpc.GetRegisterLeasePResponse toProto​(long workerId, java.util.Optional<RegisterLease> lease)  
      static alluxio.grpc.LoadDescendantPType toProto​(DescendantType loadDescendantType)
      Converts options to proto type.
      static alluxio.grpc.PAcl toProto​(AccessControlList acl)  
      static alluxio.grpc.PAclAction toProto​(AclAction action)  
      static alluxio.grpc.PAclEntry toProto​(AclEntry aclEntry)  
      static alluxio.grpc.PAclEntryType toProto​(AclEntryType aclEntryType)  
      static alluxio.grpc.PAcl toProto​(DefaultAccessControlList defaultAcl)  
      static alluxio.grpc.BlockInfo toProto​(BlockInfo blockInfo)
      Converts wire type to proto type.
      static alluxio.grpc.BlockLocation toProto​(BlockLocation blockLocation)
      Converts wire type to proto type.
      static alluxio.grpc.CommandType toProto​(CommandType commandType)  
      static alluxio.grpc.FileBlockInfo toProto​(FileBlockInfo fileBlockInfo)
      Converts wire type to proto type.
      static alluxio.grpc.FileInfo toProto​(FileInfo fileInfo)
      Converts a wire type to a proto type.
      static alluxio.grpc.FileSystemCommand toProto​(FileSystemCommand fsCommand)  
      static alluxio.grpc.LoadMetadataPType toProto​(LoadMetadataType loadMetadataType)
      Converts options to proto type.
      static alluxio.grpc.MountPointInfo toProto​(MountPointInfo info)
      Converts wire type to proto type.
      static alluxio.grpc.PersistFile toProto​(PersistFile persistFile)  
      static alluxio.grpc.TieredIdentity toProto​(TieredIdentity tieredIdentity)
      Converts wire type to proto type.
      static alluxio.grpc.LocalityTier toProto​(TieredIdentity.LocalityTier localityTier)
      Converts wire type to proto type.
      static alluxio.grpc.UfsInfo toProto​(UfsInfo ufsInfo)  
      static alluxio.grpc.WorkerInfo toProto​(WorkerInfo workerInfo)
      Converts wire type to proto type.
      static alluxio.grpc.WorkerNetAddress toProto​(WorkerNetAddress workerNetAddress)
      Converts wire type to proto type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • toGetStatusOptions

        public static alluxio.grpc.GetStatusPOptions toGetStatusOptions​(alluxio.grpc.ExistsPOptions existsOptions)
        Converts from proto type to options.
        Parameters:
        existsOptions - the proto options to convert
        Returns:
        the converted proto options
      • fromMountEntry

        public static alluxio.grpc.MountPOptions fromMountEntry​(alluxio.proto.journal.File.AddMountPointEntry mountEntryPoint)
        Creates mount proto options from File.AddMountPointEntry.
        Parameters:
        mountEntryPoint - mount point entry
        Returns:
        created mount proto options
      • fromProto

        public static AccessControlList fromProto​(alluxio.grpc.PAcl pAcl)
        Parameters:
        pAcl - the proto representation
        Returns:
        the AccessControlList instance created from the proto representation
      • fromProto

        public static AclEntry fromProto​(alluxio.grpc.PAclEntry pAclEntry)
        Parameters:
        pAclEntry - the proto representation
        Returns:
        the AclEntry instance created from the proto representation
      • fromProto

        public static AclAction fromProto​(alluxio.grpc.PAclAction pAction)
        Parameters:
        pAction - the proto representation
        Returns:
        the AclAction created from the proto representation
      • fromProto

        public static AclEntryType fromProto​(alluxio.grpc.PAclEntryType pAclEntryType)
        Parameters:
        pAclEntryType - the proto representation
        Returns:
        the AclEntryType created from the proto representation
      • fromProto

        public static BlockLocation fromProto​(alluxio.grpc.BlockLocation blockPLocation)
        Converts a proto type to a wire type.
        Parameters:
        blockPLocation - the proto type to convert
        Returns:
        the converted wire type
      • fromProto

        public static BlockInfo fromProto​(alluxio.grpc.BlockInfo blockPInfo)
        Converts a proto type to a wire type.
        Parameters:
        blockPInfo - the proto type to convert
        Returns:
        the converted wire type
      • fromProto

        public static DescendantType fromProto​(alluxio.grpc.LoadDescendantPType pDescendantType)
        Converts a proto type to a wire type.
        Parameters:
        pDescendantType - the proto representation of a descendant type
        Returns:
        the wire representation of the descendant type
      • fromProto

        public static FileInfo fromProto​(alluxio.grpc.FileInfo pInfo)
        Converts a proto type to a wire type.
        Parameters:
        pInfo - the proto representation of a file information
        Returns:
        wire representation of the file information
      • fromProto

        public static FileBlockInfo fromProto​(alluxio.grpc.FileBlockInfo fileBlockPInfo)
        Converts a proto type to a wire type.
        Parameters:
        fileBlockPInfo - the proto type to convert
        Returns:
        the converted wire type
      • fromProto

        public static TieredIdentity fromProto​(alluxio.grpc.TieredIdentity tieredPIdentity)
        Converts a proto type to a wire type.
        Parameters:
        tieredPIdentity - the proto type to convert
        Returns:
        the converted wire type
      • fromProto

        public static TieredIdentity.LocalityTier fromProto​(alluxio.grpc.LocalityTier localityPTier)
        Converts a proto type to a wire type.
        Parameters:
        localityPTier - the proto type to convert
        Returns:
        the converted wire type
      • fromProto

        public static MountPointInfo fromProto​(alluxio.grpc.MountPointInfo mountPointPInfo)
        Converts a proto type to a wire type.
        Parameters:
        mountPointPInfo - the proto type to convert
        Returns:
        the converted wire type
      • fromProto

        public static WorkerInfo fromProto​(alluxio.grpc.WorkerInfo workerInfo)
        Converts a proto type to a wire type.
        Parameters:
        workerInfo - the proto type to convert
        Returns:
        the converted wire type
      • fromProto

        public static WorkerNetAddress fromProto​(alluxio.grpc.WorkerNetAddress workerNetPAddress)
        Converts a proto type to a wire type.
        Parameters:
        workerNetPAddress - the proto type to convert
        Returns:
        the converted wire type
      • toProto

        public static alluxio.grpc.PAcl toProto​(AccessControlList acl)
        Parameters:
        acl - the access control list to convert
        Returns:
        the proto representation of this object
      • toProto

        public static alluxio.grpc.PAcl toProto​(DefaultAccessControlList defaultAcl)
        Parameters:
        defaultAcl - the default access control list to convert
        Returns:
        the proto representation of default acl object
      • toProto

        public static alluxio.grpc.PAclAction toProto​(AclAction action)
        Parameters:
        action - the acl action to convert
        Returns:
        the proto representation of this enum
      • toProto

        public static alluxio.grpc.PAclEntry toProto​(AclEntry aclEntry)
        Parameters:
        aclEntry - the acl entry to convert
        Returns:
        the proto representation of AclEntry instance
      • toProto

        public static alluxio.grpc.PAclEntryType toProto​(AclEntryType aclEntryType)
        Parameters:
        aclEntryType - the acl entry type to convert
        Returns:
        the proto representation of this enum
      • toProto

        public static alluxio.grpc.BlockInfo toProto​(BlockInfo blockInfo)
        Converts wire type to proto type.
        Parameters:
        blockInfo - the wire type to convert
        Returns:
        the converted proto type
      • toProto

        public static alluxio.grpc.BlockLocation toProto​(BlockLocation blockLocation)
        Converts wire type to proto type.
        Parameters:
        blockLocation - the wire type to convert
        Returns:
        the converted proto type
      • toProto

        public static alluxio.grpc.FileInfo toProto​(FileInfo fileInfo)
        Converts a wire type to a proto type.
        Parameters:
        fileInfo - the wire representation of a file information
        Returns:
        proto representation of the file information
      • toProto

        public static alluxio.grpc.FileBlockInfo toProto​(FileBlockInfo fileBlockInfo)
        Converts wire type to proto type.
        Parameters:
        fileBlockInfo - the wire representation to convert
        Returns:
        converted proto representation
      • toProto

        public static alluxio.grpc.LoadMetadataPType toProto​(LoadMetadataType loadMetadataType)
        Converts options to proto type.
        Parameters:
        loadMetadataType - the LoadMetadataType
        Returns:
        the proto representation of this enum
      • toProto

        public static alluxio.grpc.LoadDescendantPType toProto​(DescendantType loadDescendantType)
        Converts options to proto type.
        Parameters:
        loadDescendantType - the DescendantType
        Returns:
        the proto representation of this enum
      • toProto

        public static alluxio.grpc.LocalityTier toProto​(TieredIdentity.LocalityTier localityTier)
        Converts wire type to proto type.
        Parameters:
        localityTier - the wire representation to convert
        Returns:
        converted proto representation
      • toProto

        public static alluxio.grpc.MountPointInfo toProto​(MountPointInfo info)
        Converts wire type to proto type.
        Parameters:
        info - the wire representation to convert
        Returns:
        converted proto representation
      • toProto

        public static alluxio.grpc.TieredIdentity toProto​(TieredIdentity tieredIdentity)
        Converts wire type to proto type.
        Parameters:
        tieredIdentity - the wire representation to convert
        Returns:
        the converted proto representation
      • toProto

        public static alluxio.grpc.WorkerInfo toProto​(WorkerInfo workerInfo)
        Converts wire type to proto type.
        Parameters:
        workerInfo - the wire representation to convert
        Returns:
        the converted proto representation
      • toProto

        public static alluxio.grpc.WorkerNetAddress toProto​(WorkerNetAddress workerNetAddress)
        Converts wire type to proto type.
        Parameters:
        workerNetAddress - the wire representation to convert
        Returns:
        the converted proto representation
      • toProto

        public static alluxio.grpc.CommandType toProto​(CommandType commandType)
        Parameters:
        commandType - wire type
        Returns:
        proto representation of given wire type
      • toProto

        public static alluxio.grpc.PersistFile toProto​(PersistFile persistFile)
        Parameters:
        persistFile - wire type
        Returns:
        proto representation of given wire type
      • toProto

        public static alluxio.grpc.FileSystemCommand toProto​(FileSystemCommand fsCommand)
        Parameters:
        fsCommand - wire type
        Returns:
        proto representation of given wire type
      • toProto

        public static alluxio.grpc.UfsInfo toProto​(UfsInfo ufsInfo)
        Parameters:
        ufsInfo - wire type
        Returns:
        proto representation of given wire type
      • toProto

        public static alluxio.grpc.GetRegisterLeasePResponse toProto​(long workerId,
                                                                     java.util.Optional<RegisterLease> lease)
        Parameters:
        workerId - the worker that requests a lease
        lease - the lease decision from the master
        Returns:
        a GetRegisterLeasePResponse
      • contains

        public static boolean contains​(alluxio.grpc.Scope source,
                                       alluxio.grpc.Scope target)
        Parameters:
        source - source enum
        target - target enum
        Returns:
        true if target enum is contained within the source
      • combine

        public static alluxio.grpc.Scope combine​(alluxio.grpc.Scope scope1,
                                                 alluxio.grpc.Scope scope2)
        Parameters:
        scope1 - source1
        scope2 - source2
        Returns:
        combined enum of given enums
      • netAddressToSocketAddress

        public static java.net.InetSocketAddress[] netAddressToSocketAddress​(java.util.List<alluxio.grpc.NetAddress> request)
                                                                      throws java.net.UnknownHostException
        Convert a list of NetAddress to InetSocketAddress.
        Parameters:
        request - the net addresses
        Returns:
        the list of InetSocketAddresses
        Throws:
        java.net.UnknownHostException