# following section headers. |
# following section headers. |
|
|
load.settings.from = "peak.config.config_components.do_include" |
load.settings.from = "peak.config.config_components.do_include" |
provide.utilities = "peak.config.config_components.provide_utility" |
|
load.on.demand = "peak.config.config_components.on_demand" |
load.on.demand = "peak.config.config_components.on_demand" |
|
component.factories = "peak.config.config_components.register_factory" |
|
|
|
# "Provide Utilities" is DEPRECATED |
|
provide.utilities = "peak.config.config_components.provide_utility" |
|
|
|
|
[peak.config.loaders] |
[peak.config.loaders] |
|
|
|
|
|
|
|
|
|
|
|
|
[Load on Demand] |
[Load on Demand] |
|
|
# Settings in load-on-demand sections are evaluated once and *only* once, |
# Settings in load-on-demand sections are evaluated once and *only* once, |
|
|
|
|
|
|
[Provide Utilities] |
[Component Factories] |
|
|
|
# "Component Factories" sections define utility by mapping from an import |
|
# string for an interface (or other configuration key, to an expression |
|
# that returns the factory (or an import string thereof). |
|
|
|
# Factories described here are not actually registered with the configuration |
|
# map until the module named on the left side of the '=' is first imported. If |
|
# the module is already imported when a "Component Factories" section is |
|
# processed, then registration takes place immediately. |
|
|
|
# Keys listed here are registered twice, like this: |
|
# key = importString(key) |
|
# pMap.registerProvider(config.FactoryFor(key), config.ruleForExpr(value)) |
|
# pMap.registerProvider(key, config.CreateViaFactory(key)) |
|
|
|
# This means that looking up a key listed here will use a 'CreateViaFactory' |
|
# rule to invoke the factory once and return that result for all subsequent |
|
# lookups. Looking up 'config.FactoryFor(key)' will return the factory listed |
|
# here on the right side of the '=' sign. Thus, using 'binding.Make(key)' will |
|
# create a private instance of the desired component, and 'binding.Obtain(key)' |
|
# will retrieve a shared instance. |
|
|
|
# Note, by the way, that the items named on the left of the '=' do not have to |
|
# be interfaces, although that is the most common usage. They may be any |
|
# object that supports 'config.IConfigKey'. |
|
|
# "Provide Utilities" sections define utilities by mapping from an import |
|
# string for an interface, to an expression defining the Provider. |
|
# |
|
# Note that unlike property sections, code in "Provide utilities" sections is |
|
# executed immediately to create a provider rule, not on-demand when the |
|
# utility is actually requested, so you should avoid code that does unnecessary |
|
# importing. You'll notice that most providers shown here do their imports |
|
# inside of lambdas within config.provideInstance() or |
|
# config.instancePerComponent() calls. |
|
|
|
# This first provider associates a default transaction service with the |
|
# nearest AppConfig above the object that the service is wanted for. It |
|
# creates a TransactionService instance with that config as its parent |
|
# component. |
|
|
|
peak.storage.interfaces.ITransactionService = |
peak.storage.interfaces.ITransactionService = |
config.provideInstance('peak.storage.transactions.TransactionService') |
'peak.storage.transactions.TransactionService' |
|
|
# Some similar services for peak.running: |
peak.running.interfaces.ISignalManager = 'peak.running.process.SignalManager' |
|
peak.running.interfaces.IMainLoop = 'peak.running.scheduler.MainLoop' |
|
peak.running.interfaces.ITaskQueue = 'peak.running.daemons.TaskQueue' |
|
peak.running.interfaces.IBasicReactor = 'peak.running.scheduler.getReactor' |
|
peak.running.interfaces.ITwistedReactor = 'peak.running.scheduler.getTwisted' |
|
|
peak.running.interfaces.ISignalManager = |
|
config.provideInstance('peak.running.process.SignalManager') |
|
|
|
peak.running.interfaces.IMainLoop = |
|
config.provideInstance('peak.running.scheduler.MainLoop') |
|
|
|
peak.running.interfaces.ITaskQueue = |
|
config.provideInstance('peak.running.daemons.TaskQueue') |
|
|
|
peak.running.interfaces.IBasicReactor = |
|
config.provideInstance('peak.running.scheduler.getReactor') |
|
|
|
peak.running.interfaces.ITwistedReactor = |
|
config.provideInstance('peak.running.scheduler.getTwisted') |
|
|
|
|
|
|
|