Class ProfilePersistenceHelper


  • class ProfilePersistenceHelper
    extends Object
    Write profiles to disk at shutdown, read at startup. The files are gzip compressed, we previously stored them with a ".dat" extension instead of ".txt.gz", so it wasn't apparent. Now migrated to a ".txt.gz" extension.
    • Constructor Detail

      • ProfilePersistenceHelper

        public ProfilePersistenceHelper​(RouterContext ctx)
    • Method Detail

      • setUs

        public void setUs​(Hash routerIdentHash)
      • writeProfile

        public boolean writeProfile​(PeerProfile profile)
        write out the data from the profile to the file
        Returns:
        success
      • writeProfile

        public void writeProfile​(PeerProfile profile,
                                 OutputStream out,
                                 boolean addComments)
                          throws IOException
        write out the data from the profile to the stream
        Parameters:
        addComments - add comment lines to the output
        Throws:
        IOException
        Since:
        0.9.41
      • deleteOldProfiles

        public int deleteOldProfiles​(long age)
        Delete profile files with timestamps older than 'age' ago
        Returns:
        number deleted
        Since:
        0.9.28
      • readProfile

        public PeerProfile readProfile​(File file,
                                       long cutoff)
        Parameters:
        cutoff - delete and return null if older than this (absolute time)