expose locking provider in the server container

This commit is contained in:
Robin Appelman 2015-05-04 14:02:27 +02:00
parent 2c86cc821c
commit cdf7f91259
2 changed files with 26 additions and 0 deletions

View File

@ -43,6 +43,7 @@ use OC\Command\AsyncBus;
use OC\Diagnostics\NullQueryLogger;
use OC\Diagnostics\EventLogger;
use OC\Diagnostics\QueryLogger;
use OC\Lock\MemcacheLockingProvider;
use OC\Mail\Mailer;
use OC\Memcache\ArrayCache;
use OC\Http\Client\ClientService;
@ -420,6 +421,13 @@ class Server extends SimpleContainer implements IServerContainer {
$this->getLogger()
);
});
$this->registerService('LockingProvider', function (Server $c) {
/** @var \OC\Memcache\Factory $memcacheFactory */
$memcacheFactory = $c->getMemCacheFactory();
return new MemcacheLockingProvider(
$memcacheFactory->createDistributed('lock')
);
});
}
/**
@ -908,4 +916,14 @@ class Server extends SimpleContainer implements IServerContainer {
public function getTrustedDomainHelper() {
return $this->query('TrustedDomainHelper');
}
/**
* Get the locking provider
*
* @return \OCP\Lock\ILockingProvider
* @since 8.1.0
*/
public function getLockingProvider() {
return $this->query('LockingProvider');
}
}

View File

@ -413,4 +413,12 @@ interface IServerContainer {
* @since 8.1.0
*/
public function getMailer();
/**
* Get the locking provider
*
* @return \OCP\Lock\ILockingProvider
* @since 8.1.0
*/
public function getLockingProvider();
}