Class DelegatingRoleAwareSynchronizedStateProvider<P,F>

java.lang.Object
com.inductiveautomation.ignition.gateway.redundancy.types.DelegatingRoleAwareSynchronizedStateProvider<P,F>
All Implemented Interfaces:
SynchronizedStateProvider<P,F>

public abstract class DelegatingRoleAwareSynchronizedStateProvider<P,F> extends Object implements SynchronizedStateProvider<P,F>
  • Constructor Details

    • DelegatingRoleAwareSynchronizedStateProvider

      public DelegatingRoleAwareSynchronizedStateProvider(String id)
  • Method Details

    • intantiateForRole

      protected abstract SynchronizedStateProvider<P,F> intantiateForRole(NodeRole role)
    • getDelegate

      public SynchronizedStateProvider<P,F> getDelegate()
    • init

      public void init(SyncController controller)
      Description copied from interface: SynchronizedStateProvider
      "Starts" the provider. The controller can be used to request sync whenever the provider thinks there has been a change. It can be called freely, the parent system will coalesce calls into single operations that happen periodically.
      Specified by:
      init in interface SynchronizedStateProvider<P,F>
    • shutdown

      public void shutdown()
      Description copied from interface: SynchronizedStateProvider
      Called when the system is being shut down or the gateway has changed role. It should be expected that startup may be called again on the same instance.
      Specified by:
      shutdown in interface SynchronizedStateProvider<P,F>
    • getId

      public String getId()
      Description copied from interface: SynchronizedStateProvider
      A simple and unique identifier for this state subsystem.
      Specified by:
      getId in interface SynchronizedStateProvider<P,F>
    • isBidirectional

      public boolean isBidirectional()
      Description copied from interface: SynchronizedStateProvider
      Indicates the state can be synchronized bi-directionally.
      Specified by:
      isBidirectional in interface SynchronizedStateProvider<P,F>
    • fullRequiresRestart

      public boolean fullRequiresRestart()
      Description copied from interface: SynchronizedStateProvider
      This is used by the system to detect "major" changes. When this is true, and a full sync is required, the system is marked as "Out of Date", and knows it will be restarted when an update arrives.
      Specified by:
      fullRequiresRestart in interface SynchronizedStateProvider<P,F>
    • getVersion

      public VersionToken getVersion()
      Description copied from interface: SynchronizedStateProvider
      This represents the current version of the state. It is a *little* tricky, however, when it comes to bi-directional states. Bi-directional states mean that changes can happen on both sides and are merged when synchronized. How this works: 1) Utimately the goal is to have the version be the same on both sides. 2) The state synchronizer will keep track of the last version seen, both locally and remotely. 3) When a partial state is applied here, this provider determines if it still has changes. If so, it requests a sync. 4) When the partial pull comes in, it will be for an older revision- this revision is relative to this side. At this point, the provider returns the outstanding changes with an id equal to what was last received. If in the mean time the other side has modified the state again, it the cycle would continue- except in step 3 there shouldn't be any more outstanding changes. This logic is handled by the AbstractSynchronizedStateProvider.
      Specified by:
      getVersion in interface SynchronizedStateProvider<P,F>
    • pullPartial

      public State<P> pullPartial(VersionToken version)
      Description copied from interface: SynchronizedStateProvider
      Should return a set of partial changes going from the provided version. If not available, should return State.outOfDate().
      Specified by:
      pullPartial in interface SynchronizedStateProvider<P,F>
    • pullFull

      public State<F> pullFull()
      Description copied from interface: SynchronizedStateProvider
      Should return the full state.
      Specified by:
      pullFull in interface SynchronizedStateProvider<P,F>
    • applyPartialState

      public void applyPartialState(State<P> state)
      Description copied from interface: SynchronizedStateProvider
      Should apply the partial state. If the process fails for some reason, the system should reset its internal version and request sync, so that the full state may be transferred.
      Specified by:
      applyPartialState in interface SynchronizedStateProvider<P,F>
    • applyFullState

      public void applyFullState(State<F> state)
      Description copied from interface: SynchronizedStateProvider
      Applies the full state. If the update fails, the system should reset its internal version and request sync in order to retry.
      Specified by:
      applyFullState in interface SynchronizedStateProvider<P,F>