[Subversion] / Contextual / Contextual.txt |
No default branch
Bookmark a link to HEAD:
(view)
(download)
Bug fixes for state initialization and registry wildcard lookups.
Trim obsolete docs, add 2.3/2.4 compat docs to dev guide.
More tests, API tweaks, add a bit of docs.
Implement better scoping, by allowing states to be context managers. Also, renamed setting->value and parameter->expression. Expressions scan be scoped to services, such that a "resource" is just an "Action.expression" (i.e. an expression scoped to the nearest Action service). Instead of using 'with service_instance:', you now use 'with service_class.new():' to replace a service. The next refactoring will change keys from being functions, to being objects, allowing them to be set to either values or expressions dynamically. As a side-effect, this will drop the dependencies to both the SymbolType and ProxyTypes packages, although that's not the reason for doing it. The real reason is that it will allow things like this:: with context.new(): some_var << some_value other_var <<= lambda:some_expression # code that uses these variables as the canonical way to set variables in a context.
Another major refactoring -- merged Config and App into State, and implemented dynamic state propagation that eliminates the need to explicitly define ServiceAreas the way the PEAK core does. This new system is 100% lock-free and thread-safe (assuming that your own code is, too!) and has a smaller, friendlier API than the previous half-dozen attempts. The core state management system is now rock-solid, but there are a few minor areas where protocol changes may occur. See the "TODO" section in README.txt for details.
Implemented EigenValue-style write-until-read immutability for Config objects. This new algorithm is actually thread-safe without needing any locks, by using the atomic properties of dictionaries, and by detecting conflicts *after* a write attempt is made. In the event of a race between two or more threads, it's nondeterministic who will "win", but there will be exactly one winner and all other writers will fail. Proof (informal): writes are copied into buffer[key] snapshot[key] is never modified except via setdefault -- therefore it can only ever have *one* value when snapshot[key] is set, its value comes from buffer[key]; thus, snapshot[key] is always *some* (indeterminately chosen) setting that was set by writing to the mapping, or by computing a default value. once a write is completed, snapshot.get(key, value_written) is used to verify that snapshot[key] is either *empty* OR a value that is the same as or equal to the value written. If the value is different, some other writer's value was read first, and our write is in conflict. If the value is the same, then our write was "successful", in that there is a *chance* it will be the end value of the setting. In other words, a succesful write does *not* necessarily mean that the written value is or will be "the" value. It is still possible to have non-deterministic behavior if multiple threads are simultaneously writing to the same Config, but it will not corrupt the Config or violate the "only one value is ever seen by readers" invariant. If precedence of an individual setting value matters, you must serialze the writes, but unserialized writes will not cause inconsistent behavior. This is a sufficient guarantee to allow e.g. configuration file loaders to be written.
Simplified App-switching API, added App[] delegation to its config, and add more docs.
Misc. cleanups, more API doc and tests
Major API overhaul. Service classes now act like peak.binding.Singletons, in that the class itself is a proxy for the current instance. This eliminates the need for two names to refer to the "same" object. Settings are now created with decorators, the module is peak.context instead of peak.util.context, and many many other changes. And there are still more to come, but mostly additions and some tweaks to how the App context works.
More work on docs
Begin re-org of tests/doc
Make README testable, add new files that 'context.txt' will be refactored into. Add 'context.replaces()' class decorator to make it easier to define an alternative service implementation.
cvs-admin@eby-sarna.com Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |