Record Class ServerQuirkSummary.Tally
- Record Components:
count- how many times it has been seen — a rolling tally, deliberately approximatelastSeenDay- the epoch day it was last observed, orUNKNOWN_DAYfor an entry stored before the stamp existed
- Enclosing class:
ServerQuirkSummary
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
FieldsModifier and TypeFieldDescriptionstatic final longThe stamp of an entry written by a build that did not record one. -
Constructor Summary
ConstructorsConstructorDescriptionTally(long count, long lastSeenDay) Creates an instance of aTallyrecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongcount()Returns the value of thecountrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.longReturns the value of thelastSeenDayrecord component.booleannotSeenWithin(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.booleanstaleOn(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 StringtoString()Returns a string representation of this record class.
-
Field Details
-
UNKNOWN_DAY
public static final long UNKNOWN_DAYThe 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 aTallyrecord class.- Parameters:
count- the value for thecountrecord componentlastSeenDay- the value for thelastSeenDayrecord 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 dayretentionDays- 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 daydays- the number of days- Returns:
- true when it has not been seen within them
-
seen
The same tally, seen again today.- Parameters:
times- how many times it was seentoday- the current epoch day- Returns:
- the updated tally
-
stamped
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 readingnotSeenWithin(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
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. -
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. -
equals
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 '=='. -
count
public long count()Returns the value of thecountrecord component.- Returns:
- the value of the
countrecord component
-
lastSeenDay
public long lastSeenDay()Returns the value of thelastSeenDayrecord component.- Returns:
- the value of the
lastSeenDayrecord component
-