Interface ConnectionStore

All Known Implementing Classes:
LocalConnectionStore, RedisConnectionStore

public interface ConnectionStore
Abstraction for connection state storage used by ConnectionTracker.

Implementations may store state locally (in-process) or remotely (e.g. Redis) to support single-node and clustered deployments respectively.

See Also:
  • Method Details

    • recordConnection

      void recordConnection(String ipAddress)
      Records a new connection from the specified IP address.
      Parameters:
      ipAddress - The IP address establishing the connection.
    • recordDisconnection

      void recordDisconnection(String ipAddress)
      Records connection closure from the specified IP address.
      Parameters:
      ipAddress - The IP address closing the connection.
    • getActiveConnections

      int getActiveConnections(String ipAddress)
      Gets the current number of active connections for an IP address.
      Parameters:
      ipAddress - The IP address to check.
      Returns:
      Number of active connections.
    • getTotalActiveConnections

      int getTotalActiveConnections()
      Gets the total number of active connections across all IPs.
      Returns:
      Total active connections.
    • getRecentConnectionCount

      int getRecentConnectionCount(String ipAddress, int windowSeconds)
      Gets the number of recent connections from an IP within the specified window.
      Parameters:
      ipAddress - The IP address to check.
      windowSeconds - Time window in seconds.
      Returns:
      Number of connections within window.
    • recordCommand

      void recordCommand(String ipAddress)
      Records a command execution for the specified IP.
      Parameters:
      ipAddress - The IP address executing the command.
    • getCommandsPerMinute

      int getCommandsPerMinute(String ipAddress)
      Gets the number of commands executed in the last minute for an IP.
      Parameters:
      ipAddress - The IP address to check.
      Returns:
      Number of commands in last minute.
    • recordBytesTransferred

      void recordBytesTransferred(String ipAddress, long bytes)
      Records bytes transferred for the specified IP.
      Parameters:
      ipAddress - The IP address.
      bytes - Number of bytes transferred.
    • reset

      void reset()
      Clears all tracking data.
    • shutdown

      void shutdown()
      Shuts down any background resources held by this store.