States and State Transitions in Consumers

The following diagram shows the actions that can take place within a consumer that supports notifications through IRowsetNotify.

Consumer state/state transition diagram

states and actions in consumer with notifications

States

  • Initial is a conceptual state denoting the initial state of any IRowsetNotify method before any phase starts. At this point, full-phased events such as DBREASON_COLUMN_SET can receive an OKTODO or FAILEDTODO notification. Any other phase at this point is unexpected, causing the method to undergo a transition to the Undo Work2 state that returns S_FALSE.

  • OKTODO, ABOUTTODO, SYNCHAFTER, and DIDEVENT are method-transition states that occur when the method receives the phase having the same name as the respective state. All these states can involve some internal work by the consumer. All states, except DIDEVENT, can receive a FAILEDTODO notification, which causes the method to undergo a transition to the Undo Work1 state.

  • Undo Work1 is an internal state to which the listener undergoes a transition from any state (except DIDEVENT) on reception of a FAILEDTODO notification. In this state, any work done by the consumer is undone. After the work is undone, the method reverts back to the Initial state and returns S_OK.

  • Undo Work2 is an internal state that captures any unexpected phase. In this state, any work done by the consumer is undone. Once the work is undone, the method reverts back to the Initial state and returns S_FALSE.

Transitions

  • Arrows with a continuous heavy line represent transitions within states upon reception of some expected phase.

  • Arrows with a continuous light line represent transitions resulting from receiving an unexpected phase.

  • Arrows with a dashed line represent an internal transition by the consumer.