Class StatusUtil


  • public class StatusUtil
    extends Object
    Helper methods to create Status protobuf messages
    • Constructor Detail

      • StatusUtil

        public StatusUtil()
    • Method Detail

      • ingestedUntil

        public static Replication.Status ingestedUntil​(long recordsIngested)
        Creates a Replication.Status for newly-created data that must be replicated
        Parameters:
        recordsIngested - Offset of records which need to be replicated
        Returns:
        A Replication.Status tracking data that must be replicated
      • replicated

        public static Replication.Status replicated​(long recordsReplicated)
        Parameters:
        recordsReplicated - Offset of records which have been replicated
        Returns:
        A Replication.Status tracking data that must be replicated
      • replicatedAndIngested

        public static Replication.Status replicatedAndIngested​(long recordsReplicated,
                                                               long recordsIngested)
        Creates a @{link Status} for a file which has new data and data which has been replicated
        Parameters:
        recordsReplicated - Offset of records which have been replicated
        recordsIngested - Offset for records which need to be replicated
        Returns:
        A Replication.Status for the given parameters
      • fileCreatedValue

        public static Value fileCreatedValue​(long timeCreated)
        Returns:
        A Value for a new file that was just created
      • fileClosed

        public static Replication.Status fileClosed()
        Returns:
        A Status representing a closed file
      • fileClosedValue

        public static Value fileClosedValue()
        Returns:
        A Value representing a closed file
      • openWithUnknownLength

        public static Replication.Status openWithUnknownLength​(long timeCreated)
        Returns:
        A Replication.Status for an open file of unspecified length, all of which needs replicating.
      • openWithUnknownLength

        public static Replication.Status openWithUnknownLength()
        Returns:
        A Replication.Status for an open file of unspecified length, all of which needs replicating.
      • openWithUnknownLengthValue

        public static Value openWithUnknownLengthValue()
        Returns:
        A Value for an open file of unspecified length, all of which needs replicating.
      • fromValue

        public static Replication.Status fromValue​(Value v)
                                            throws com.google.protobuf.InvalidProtocolBufferException
        Parameters:
        v - Value with serialized Status
        Returns:
        A Status created from the Value
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • isSafeForRemoval

        public static boolean isSafeForRemoval​(Replication.Status status)
        Is the given Status fully replicated and is its file ready for deletion on the source
        Parameters:
        status - a Status protobuf
        Returns:
        True if the file this Status references can be deleted.
      • isFullyReplicated

        public static boolean isFullyReplicated​(Replication.Status status)
        Is the given Status fully replicated but potentially not yet safe for deletion
        Parameters:
        status - a Status protobuf
        Returns:
        True if the file this Status references is fully replicated so far
      • isWorkRequired

        public static boolean isWorkRequired​(Replication.Status status)
        Given the Replication.Status, is there replication work to be done
        Parameters:
        status - Status for a file
        Returns:
        true if replication work is required