summaryrefslogtreecommitdiffstats
path: root/state.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add or groups to hold providesCasey Dahlin2008-12-151-0/+11
| | | | You can now specify hold provisions which read "One of (a,b,c)"
* Add a couple of helpers to base classesCasey Dahlin2008-12-151-0/+13
|
* Add a method to print all states in colorCasey Dahlin2008-12-101-0/+7
|
* Make names for state classes explicit.Casey Dahlin2008-11-071-0/+4
| | | | | Don't truss ruby to return the correct name for SomeState.class.name when SomeState might be passed around in other constants.
* Add check for forking a live state.Casey Dahlin2008-11-071-0/+1
| | | | States which are up should never fork.
* Annotate TypeErrorsCasey Dahlin2008-11-071-7/+7
| | | | | Several locations which through TypeError on invalid argument now further explain the error.
* Remove commented out consistency checkCasey Dahlin2008-10-271-1/+0
| | | | | Its nearly impossible to get this one working. We should use a declarative language if we want to be this anal about making things disappear.
* Make Dep holds give params of dependentCasey Dahlin2008-10-131-1/+1
| | | | The dependent now provides information for dep holds
* Merge State#break_holds into State#becomes_defunctCasey Dahlin2008-10-101-7/+2
| | | | No point in having this little two-liner called in one place only.
* Better release comparisonCasey Dahlin2008-10-101-1/+2
| | | | | State#release will now release all holds which match (should be rare) and matches holds more correctly.
* Make State#check_deps behave properly when droppingCasey Dahlin2008-10-101-1/+4
| | | | | State#check_deps used to throw an exception if called for a dropping receiver. Now check_deps is a no-op on dropping states.
* Fix bugs in State::process_eventCasey Dahlin2008-10-101-2/+2
| | | | | State::process_event was only checking states that were up, when it should do the opposite, and wasn't forwarding parameters from the event.
* Get caused_by from class in State#react_to?Casey Dahlin2008-10-101-1/+1
| | | | | State#react_to? was looking for an instance variable that was really a class attribute.
* Add State::get_all methodCasey Dahlin2008-10-101-0/+5
| | | | | State::get_all gets all states. When the receiver is a subclass of State it returns all states of that type.
* Better event matchingCasey Dahlin2008-10-091-1/+1
| | | | Event matching should now be deterministic
* Delete trace functionCasey Dahlin2008-10-091-17/+2
| | | | Its not a very good solution anyway, so we'll just pop it out.
* Properly deterministic hashing that accounts for depsCasey Dahlin2008-10-091-1/+3
| | | | | State#hash now gives consistent results (finally) and takes deps into account (again)
* Introduce hold-differentiated statesCasey Dahlin2008-10-081-8/+41
| | | | | | States can now receive parameters from the holds placed on them out of a specific set of parameters marked for this kind of retrieval, /and/ multiple states can be differentiated based on this mechanism.
* Comment typo fixCasey Dahlin2008-10-081-1/+1
| | | | Capitalization irks me
* Add parenthesis to expression in State#hashCasey Dahlin2008-10-081-1/+1
| | | | Minor clarification
* State#hold and State#release now take a params argumentCasey Dahlin2008-10-081-10/+10
| | | | You may now hold with parameters.
* Use DSTuple objects for State depsCasey Dahlin2008-10-081-16/+49
| | | | | State dependencies are now pairings of Dependency objects and the States which resolve them
* Rename StatePattern to DependencyCasey Dahlin2008-10-081-16/+17
| | | | StatePattern is now called Dependency
* Change State#to_s and add State#to_s_colorCasey Dahlin2008-10-081-1/+18
| | | | | | | The State#to_s method has been modified to only display the direct class name and not the full module name, and to display parameters. Also, to_s_color has been added which uses tty color escapes to color its output according to the state's status.
* Replace active property with status propertyCasey Dahlin2008-10-081-13/+15
| | | | | | The State#active attribute, which could be either true or false, is now the State#status attribute, which can be any of up, down, rising, or dropping. This added specificity has allowed some consistency fixes.
* Add some trace pointsCasey Dahlin2008-10-071-1/+3
| | | | A few tweaks to debug output
* Fix dependency issue with dropping.Casey Dahlin2008-10-071-7/+7
| | | | | A dropping state now holds its dependencies until after running the falling edge, but shuts down its dependents before.
* Add State::release to compliment State::holdCasey Dahlin2008-10-071-1/+7
| | | | | State::release can be called to release all states of a type. Also State::hold and State::release both now return a list of states they attempted to act on.
* Yet another use of self.class.depends where @deps belongsCasey Dahlin2008-10-071-1/+1
| | | | | referral to self.class.depends left over from when actual deps were stored there.
* Fix another missing inject argumentCasey Dahlin2008-10-071-1/+1
| | | | | Array#inject had no argument in State#params, again leading to problems when running against a single-element array.
* Run service drop task /after/ state changeCasey Dahlin2008-10-071-1/+2
| | | | For synchronization, delay dropping the class until after the state has changed.
* State#hold and State#release now return selfCasey Dahlin2008-10-071-1/+5
| | | | | State#hold and State#release now return the receiver. Also, State#release no longer calls a nonexistent method on the hold set.
* Fix some behaviors of State#check_depsCasey Dahlin2008-10-071-2/+5
| | | | | | State#check_deps now returns as soon as it has found a missing dep. The raised ConsistencyFault now has a message, and the self-stripping of methods that dead states perform no longer throws exceptions.
* Added to_s and eql?Casey Dahlin2008-10-071-0/+21
| | | | Classes now have to_s methods and eql? methods which are identical to ==
* Added trace methodCasey Dahlin2008-10-071-0/+7
| | | | Added a new trace method to output debuginfo
* Added missing deps attribute to StateCasey Dahlin2008-10-031-0/+1
| | | | Code had assumed State had a deps attribute. It now does.
* Add static hold method to StateCasey Dahlin2008-10-031-0/+5
| | | | State::hold now holds all states of the given type
* Fix type check in StatePattern#initializeCasey Dahlin2008-10-031-1/+1
| | | | The check for inheritance was in the wrong direction
* Add default empty params for Hold#initializeCasey Dahlin2008-10-031-1/+1
| | | | The params argument to Hold#initialize now has a default value
* Make State#rise use local dependency infoCasey Dahlin2008-10-031-1/+1
| | | | | State#rise was looking at class-level deps, which is incorrect and which caused an error since class-level deps aren't State objects.
* Add initial values to inject callsCasey Dahlin2008-10-031-2/+2
| | | | | Injecting with no prepend argument can cause nil to be returned where not expected.
* Rename respond_to to react_toCasey Dahlin2008-10-031-2/+2
| | | | respond_to? is an API method in ruby
* Fix depsolving logic to handle depless servicesCasey Dahlin2008-10-031-5/+13
| | | | Services with no dependencies no longer cause failure
* Depsolve new types on creationCasey Dahlin2008-10-031-0/+1
| | | | As soon as a type exists, try to bring it up
* Add implementation of productCasey Dahlin2008-10-031-0/+11
| | | | Ruby 1.8.6 doesn't have Array#product, so add it
* Fix use of legacy @params var in StateCasey Dahlin2008-10-031-3/+3
| | | | | | Make sure state isn't using @params anywhere. Also a minor format fix in the params method
* Make params a methodCasey Dahlin2008-10-031-4/+15
| | | | The params attribute is now a method that aggregates parameters on demand
* Fix hash function for StateCasey Dahlin2008-10-031-1/+1
| | | | State hash function now will match for states that should be equivalent
* Update a commentCasey Dahlin2008-10-031-1/+1
| | | | Fix comment for release method
* Trigger depsolving at appropriate timesCasey Dahlin2008-10-021-0/+2
| | | | A state rising or falling now causes dep resolution