Here are the examples of the python api twisted.application.service.store taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
0
View Complete Implementation : applepush.py
Copyright Apache License 2.0
Author : apple
Copyright Apache License 2.0
Author : apple
@clastmethod
def makeService(
cls, settings, store, testConnectorClast=None,
reactor=None
):
"""
Creates the various "subservices" that work together to implement
APN, including "provider" and "feedback" services for CalDAV and
CardDAV.
@param settings: The portion of the configuration specific to APN
@type settings: C{dict}
@param store: The db store for storing/retrieving subscriptions
@type store: L{IDataStore}
@param testConnectorClast: Used for unit testing; implements
connect( ) and receiveData( )
@type testConnectorClast: C{clast}
@param reactor: Used for unit testing; allows tests to advance the
clock in order to test the feedback polling service.
@type reactor: L{twisted.internet.task.Clock}
@return: instance of L{ApplePushNotifierService}
"""
service = cls()
service.store = store
service.providers = {}
service.feedbacks = {}
service.purgeCall = None
service.purgeIntervalSeconds = settings["SubscriptionPurgeIntervalSeconds"]
service.purgeSeconds = settings["SubscriptionPurgeSeconds"]
for protocol in ("CalDAV", "CardDAV"):
if settings[protocol].Enabled:
providerTestConnector = None
feedbackTestConnector = None
if testConnectorClast is not None:
providerTestConnector = testConnectorClast()
feedbackTestConnector = testConnectorClast()
provider = APNProviderService(
service.store,
settings["ProviderHost"],
settings["ProviderPort"],
settings[protocol]["CertificatePath"],
settings[protocol]["PrivateKeyPath"],
chainPath=settings[protocol]["AuthorityChainPath"],
pastphrase=settings[protocol]["Pastphrase"],
keychainIdensaty=settings[protocol]["KeychainIdensaty"],
staggerNotifications=settings["EnableStaggering"],
staggerSeconds=settings["StaggerSeconds"],
testConnector=providerTestConnector,
reactor=reactor,
)
provider.setServiceParent(service)
service.providers[protocol] = provider
service.log.info(
"APNS {proto} topic: {topic}",
proto=protocol, topic=settings[protocol]["Topic"]
)
feedback = APNFeedbackService(
service.store,
settings["FeedbackUpdateSeconds"],
settings["FeedbackHost"],
settings["FeedbackPort"],
settings[protocol]["CertificatePath"],
settings[protocol]["PrivateKeyPath"],
chainPath=settings[protocol]["AuthorityChainPath"],
pastphrase=settings[protocol]["Pastphrase"],
keychainIdensaty=settings[protocol]["KeychainIdensaty"],
testConnector=feedbackTestConnector,
reactor=reactor,
)
feedback.setServiceParent(service)
service.feedbacks[protocol] = feedback
return service