Class ClientSideConfig

    • Constructor Detail

      • ClientSideConfig

        protected ClientSideConfig​(Version backwardCompatibilityVersion,
                                   Optional<TimeMeter> clientSideClock)
    • Method Detail

      • getDefault

        public static ClientSideConfig getDefault()
        Returns default client-side configuration for proxy-manager that configured with following parameters:
        • Client-clock: is null. This means that server-side clock is always used.
        • Backward compatibility version: is Versions.getLatest(). This means that compatibility with legacy versions is switched off.
        Returns:
        default client-side configuration for proxy-manager
      • backwardCompatibleWith

        public ClientSideConfig backwardCompatibleWith​(Version backwardCompatibilityVersion)
        Returns new instance of ClientSideConfig with configured backwardCompatibilityVersion.

        Use this method in case of rolling upgrades, when you want from already new nodes to continue communication using the legacy protocol version which is compatible with backwardCompatibilityVersion.

        By default backward compatibility version is Versions.getLatest(). This means that compatibility with legacy versions is switched off.

        Parameters:
        backwardCompatibilityVersion - the Bucket4j protocol version to be backward compatible with other nodes in the cluster.
        Returns:
        new instance of ClientSideConfig with configured backwardCompatibilityVersion.
      • withClientClock

        public ClientSideConfig withClientClock​(TimeMeter clientClock)
        Returns new instance of ClientSideConfig with configured clientClock.

        Use this method when you want to measure current time by yourself. In normal scenarios you should not use this functionality, but sometimes it can be useful, especially for testing and modeling.

        By default client-clock is null. This means that server-side clock is always used.

        Parameters:
        clientClock - the clock that will be used for time measuring instead of server-side clock.
        Returns:
        new instance of ClientSideConfig with configured clientClock.
      • getClientSideClock

        public Optional<TimeMeter> getClientSideClock()
        Returns clock that will be used for time measurement.
        Returns:
        clock that will be used for time measurement.
        See Also:
        withClientClock(TimeMeter)
      • getBackwardCompatibilityVersion

        public Version getBackwardCompatibilityVersion()
        Returns the Bucket4j protocol version is used to be backward compatible with other nodes in the cluster.
        Returns:
        the Bucket4j protocol version is used to be backward compatible with other nodes in the cluster.
        See Also:
        backwardCompatibleWith(Version)