Class ForeignWriterSummary

java.lang.Object
org.exoplatform.caldav.utils.ForeignWriterSummary

public class ForeignWriterSummary extends Object
How the deployments seen writing into a server's accounts are held on the server's own row (EXO-89824).

One bounded string, for the reason the quirk summary gives. It survives a restart, because an empty section after one is an empty section exactly when somebody is investigating; it stays cheap, because it is one short column per server rather than a row per copy; and it costs no extra query, because the drawer already fetches the registration. It is also the only shape that works on more than one node — the detection happens on whichever node ran the pass, and the drawer is served by whichever node took the request.

Format: authority@day, entries separated by ;, the day an epoch day. ai-contribution-ft.meeds.io@20342;host:8080@20339. The day is what lets the list forget: a deployment moved to another account stops appearing, and its entry ages out rather than accusing an administrator for ever of something they have already fixed.

See Also:
  • Method Details

    • parse

      public static Map<String,Long> parse(String summary)
      Reads a stored summary.

      Never throws on a malformed string. The column is evidence written by a background pass and read by a drawer; a row a hand-edit or an older version left unreadable must cost an administrator an entry, never the page. An entry without a day, or with one that is not a number, is dropped rather than guessed at — a wrong date here would age out a live finding or keep a dead one.

      Parameters:
      summary - the stored value, possibly null or empty
      Returns:
      the deployments and the epoch day each was last seen, most recently seen first, never null
    • record

      public static Map<String,Long> record(Map<String,Long> stored, String authority, long today, long retentionDays)
      Records that a deployment was seen writing here today, forgetting what has not been seen for long enough.
      Parameters:
      stored - what the row holds, as parse(java.lang.String) read it
      authority - the deployment just seen, or null to age the list without adding to it
      today - the current epoch day
      retentionDays - how long an unseen deployment stays on the list
      Returns:
      the new list, most recently seen first, bounded to 5
    • format

      public static String format(Map<String,Long> writers)
      Writes a summary back to the shape the column holds.

      Bounded to the column: the least recently seen entries are left out until the rest fits, so a write never fails on length.

      Parameters:
      writers - the deployments and the epoch day each was last seen
      Returns:
      the value to store, or null when there is nothing to say — null rather than an empty string, so a server that has never seen one reads the same as a server whose last entry has just aged out