Esempio n. 1
0
            public ListElement(long id, T value, string traceType, ListElementState state = ListElementState.Invalid)
            {
                this.traceType = traceType;

                if (id == ForbiddenId)
                {
                    TestableAssertHelper.FailInvalidOperation(this.traceType, "DataStore.ListElement", "id == ForbiddenId: {0}", ForbiddenId);
                }

                this.id       = id;
                this.value    = value;
                this.State    = state;
                this.Next     = null;
                this.Previous = null;
                this.DequeueCommittingTransaction = null;
                this.stateMachineLock             = new object();
            }
Esempio n. 2
0
            private void TransitionToState(ListElementState targetState, ListElementState allowedCurrentState)
            {
                lock (this.stateMachineLock)
                {
                    if (allowedCurrentState != this.State)
                    {
                        throw new InvalidOperationException(
                                  string.Format(
                                      "Invalid listElement state transition. \n\tCurrent state: {0}\n\tTarget state: {1}\n\tAllowed current state: {2}",
                                      this.State,
                                      targetState,
                                      allowedCurrentState));
                    }

                    this.State = targetState;
                }
            }
Esempio n. 3
0
 public static IListElement <T> CreateQueueListElement(long id, T value, string traceType, ListElementState state = ListElementState.Invalid)
 {
     return(new ListElement(id, value, traceType, state));
 }