Class DatabaseManagementImpl

java.lang.Object
io.github.mfvanek.pg.common.management.DatabaseManagementImpl
All Implemented Interfaces:
DatabaseManagement, io.github.mfvanek.pg.settings.ConfigurationAware, io.github.mfvanek.pg.statistics.StatisticsAware

public class DatabaseManagementImpl extends Object implements DatabaseManagement
Implementation of DatabaseManagement.
See Also:
  • StatisticsMaintenanceOnHost
  • ConfigurationMaintenanceOnHost
  • Constructor Details

    • DatabaseManagementImpl

      public DatabaseManagementImpl(@Nonnull io.github.mfvanek.pg.connection.HighAvailabilityPgConnection haPgConnection, @Nonnull Function<io.github.mfvanek.pg.connection.PgConnection,io.github.mfvanek.pg.statistics.maintenance.StatisticsMaintenanceOnHost> statisticsOnHostFactory, @Nonnull Function<io.github.mfvanek.pg.connection.PgConnection,io.github.mfvanek.pg.settings.maintenance.ConfigurationMaintenanceOnHost> configurationOnHostFactory)
  • Method Details

    • resetStatistics

      public boolean resetStatistics()
      Reset all statistics counters on all hosts in the cluster to zero.

      It is safe running this method on your database. It just reset counters without any impact on performance.

      Specified by:
      resetStatistics in interface DatabaseManagement
      Specified by:
      resetStatistics in interface io.github.mfvanek.pg.statistics.StatisticsAware
      Returns:
      true if the operation is successful
      See Also:
      • StatisticsMaintenanceOnHost
    • getLastStatsResetTimestamp

      @Nonnull public Optional<OffsetDateTime> getLastStatsResetTimestamp()
      Gets time at which database statistics were last reset on the primary host.
      Specified by:
      getLastStatsResetTimestamp in interface DatabaseManagement
      Specified by:
      getLastStatsResetTimestamp in interface io.github.mfvanek.pg.statistics.StatisticsAware
      Returns:
      Optional of null or time at which database statistics were last reset.
    • getParamsWithDefaultValues

      @Nonnull public Set<io.github.mfvanek.pg.settings.PgParam> getParamsWithDefaultValues(@Nonnull io.github.mfvanek.pg.settings.ServerSpecification specification)
      Specified by:
      getParamsWithDefaultValues in interface io.github.mfvanek.pg.settings.ConfigurationAware
    • getParamsCurrentValues

      @Nonnull public Set<io.github.mfvanek.pg.settings.PgParam> getParamsCurrentValues()
      Specified by:
      getParamsCurrentValues in interface io.github.mfvanek.pg.settings.ConfigurationAware