Class EntryHistorical


  • public final class EntryHistorical
    extends Object
    This class is used to store historical information that is used to resolve modify conflicts: it is effectively the content of the ds-sync-hist attribute.

    It is assumed that the common case is not to have conflict and therefore is optimized (in order of importance) for:

    1. detecting potential conflict
    2. fast update of historical information for non-conflicting change
    3. fast and efficient purge
    4. compact
    5. solve conflict. This should also be as fast as possible but not at the cost of any of the other previous objectives
    One Historical object is created for each entry in the entry cache and each Historical Object contains a list of attribute historical information

    ds-sync-hist attribute must always converge

    Note: the content of the ds-sync-hist attribute is considered the same as user data: any divergence in its content is considered a serious bug that should be fixed immediately.

    • Field Detail

      • HISTORICAL_ATTRIBUTE_NAME

        public static final String HISTORICAL_ATTRIBUTE_NAME
        Name of the attribute used to store historical information.
        See Also:
        Constant Field Values
    • Constructor Detail

      • EntryHistorical

        public EntryHistorical()
        Default constructor used before decoding.
    • Method Detail

      • newInstanceFromEntry

        public static EntryHistorical newInstanceFromEntry​(Entry entry)
        Construct an Historical object from the provided entry by reading the historical attribute. Return an empty object when the entry does not contain any historical attribute.
        Parameters:
        entry - The entry which historical information must be loaded
        Returns:
        The constructed Historical information object
      • getEntryUUID

        public static UUID getEntryUUID​(Entry entry)
        Get the entry unique Id in String form.
        Parameters:
        entry - The entry for which the unique id should be returned.
        Returns:
        The Unique Id of the entry, or a fake one if none is found.
      • isHistoricalAttribute

        public static boolean isHistoricalAttribute​(Attribute attr)
        Check if a given attribute is an attribute used to store historical information.
        Parameters:
        attr - The attribute that needs to be checked.
        Returns:
        a boolean indicating if the given attribute is used to store historical information.
      • getEntryADDDate

        public CSN getEntryADDDate()
        Returns the CSN of the operation that added this entry.
        Returns:
        The CSN of the operation that added this entry.
      • setEntryADDDate

        public void setEntryADDDate​(CSN csn)
        Sets the CSN of the operation that added this entry.
        Parameters:
        csn - The CSN of the operation that added this entry.
      • getEntryMODDNDate

        public CSN getEntryMODDNDate()
        Returns the CSN of the operation that renamed this entry.
        Returns:
        The CSN of the operation that renamed this entry.
      • setEntryMODDNDate

        public void setEntryMODDNDate​(CSN csn)
        Sets the CSN of the operation that renamed this entry.
        Parameters:
        csn - The CSN of the operation that renamed this entry.
      • getAllAttrHistorical

        public Map<AttributeDescription,​AttrHistorical> getAllAttrHistorical()
        Returns the historical information for all attributes.
        Returns:
        The historical information for all attributes.
      • getAttrHistorical

        public AttrHistorical getAttrHistorical​(AttributeDescription attributeDescription)
        Returns the historical information for the named attribute.
        Parameters:
        attributeDescription - The attribute name.
        Returns:
        The historical information for the named attribute, or null if there isn't any.
      • addAttrHistoricalAddValue

        public void addAttrHistoricalAddValue​(AttributeDescription attributeDescription,
                                              CSN csn,
                                              ByteString value)
        Updates this entry historical information with the provided add modification.
        Parameters:
        attributeDescription - The attribute description.
        csn - The CSN of the modification.
        value - The value that was added.
      • addAttrHistoricalDeleteValue

        public void addAttrHistoricalDeleteValue​(AttributeDescription attributeDescription,
                                                 CSN csn,
                                                 ByteString value)
        Updates this entry historical information with the provided delete modification.
        Parameters:
        attributeDescription - The attribute description.
        csn - The CSN of the modification.
        value - The value that was deleted.
      • addAttrHistoricalReplaceValue

        public void addAttrHistoricalReplaceValue​(AttributeDescription attributeDescription,
                                                  CSN csn,
                                                  ByteString value)
        Updates this entry historical information with the provided replace modification.
        Parameters:
        attributeDescription - The attribute description.
        csn - The CSN of the modification.
        value - The value that was replaced.
      • addAttrHistoricalDeleteAttr

        public void addAttrHistoricalDeleteAttr​(AttributeDescription attributeDescription,
                                                CSN csn)
        Updates this entry historical information with the provided delete attribute modification.
        Parameters:
        attributeDescription - The attribute description.
        csn - The CSN of the modification.