Record Class ServerQuirkSummary.Tally

java.lang.Object
java.lang.Record
org.exoplatform.caldav.utils.ServerQuirkSummary.Tally
Record Components:
count - how many times it has been seen — a rolling tally, deliberately approximate
lastSeenDay - the epoch day it was last observed, or UNKNOWN_DAY for an entry stored before the stamp existed
Enclosing class:
ServerQuirkSummary

public static record ServerQuirkSummary.Tally(long count, long lastSeenDay) extends Record
How often a behaviour has been seen, and when it was last seen.

The stamp is what lets a summary forget. Without it the row only ever grew: a behaviour a server stopped exhibiting stayed on the screen for ever, and — worse — a behaviour the comparison learned to classify differently went on being offered under its old, broader description beside its new one. A live BlueMind account showed exactly that, listing both "drops the organizer of an event with no other participants" and "does not keep ORGANIZER", the second of which would have written an over-broad excusal if anybody had ticked it.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    The stamp of an entry written by a build that did not record one.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Tally(long count, long lastSeenDay)
    Creates an instance of a Tally record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the value of the count record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    long
    Returns the value of the lastSeenDay record component.
    boolean
    notSeenWithin(long today, long days)
    Whether nothing has been seen of this behaviour within a number of days.
    seen(long times, long today)
    The same tally, seen again today.
    boolean
    staleOn(long today, long retentionDays)
    Whether this tally has gone unseen for longer than a deployment is willing to keep it.
    stamped(long migratedDay)
    The same tally with a stamp, for an entry that had none.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • UNKNOWN_DAY

      public static final long UNKNOWN_DAY
      The stamp of an entry written by a build that did not record one.
      See Also:
  • Constructor Details

    • Tally

      public Tally(long count, long lastSeenDay)
      Creates an instance of a Tally record class.
      Parameters:
      count - the value for the count record component
      lastSeenDay - the value for the lastSeenDay record component
  • Method Details

    • staleOn

      public boolean staleOn(long today, long retentionDays)
      Whether this tally has gone unseen for longer than a deployment is willing to keep it.

      An entry with no stamp is never stale: it was written before the stamp existed, and dropping somebody's history on upgrade to enforce a rule that did not apply when it was recorded would be the wrong bias. The first write after the upgrade gives it one, and the ordinary rule takes over from there.

      Parameters:
      today - the current epoch day
      retentionDays - how long an unseen behaviour is kept
      Returns:
      true when it should be forgotten
    • notSeenWithin

      public boolean notSeenWithin(long today, long days)
      Whether nothing has been seen of this behaviour within a number of days.

      An entry with no stamp answers true here and false in staleOn(long, long), and the difference is not an inconsistency. They ask different questions of the same silence. Ageing asks "has this server stopped doing it", where an unknown date must not be allowed to condemn a record nobody has evidence about. Supersession asks "is this record older than the way the comparison now describes the behaviour", and there an unknown date is not missing evidence — it is the evidence: a record with no stamp was written before this mechanism existed, so it cannot be an observation of anything current.

      Parameters:
      today - the current epoch day
      days - the number of days
      Returns:
      true when it has not been seen within them
    • seen

      public ServerQuirkSummary.Tally seen(long times, long today)
      The same tally, seen again today.
      Parameters:
      times - how many times it was seen
      today - the current epoch day
      Returns:
      the updated tally
    • stamped

      public ServerQuirkSummary.Tally stamped(long migratedDay)
      The same tally with a stamp, for an entry that had none.

      The day given must be in the past, and the caller is what decides how far. Stamping a record with today says it was seen today, and nothing observed it — the record was merely carried across a write. Doing so once froze every entry written before stamping existed: each looked current, notSeenWithin(long, long) answered false for all of them, and both supersession and ageing were held off for the whole window, on exactly the records that had been sitting longest. It also contradicted the reading notSeenWithin(long, long) is built on, that a record with no stamp predates the mechanism and so cannot be evidence of anything current.

      The migration therefore dates such a record far enough back to stay superseded-eligible at once, and no further, so what remains of its ageing window is preserved.

      Parameters:
      migratedDay - the epoch day to attribute to an entry that has no stamp; must already be back-dated by the caller
      Returns:
      the tally, stamped
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • count

      public long count()
      Returns the value of the count record component.
      Returns:
      the value of the count record component
    • lastSeenDay

      public long lastSeenDay()
      Returns the value of the lastSeenDay record component.
      Returns:
      the value of the lastSeenDay record component