/**
  *
  */
 public function __construct()
 {
     parent::__construct();
     $adapters = ['Local' => 'Surume\\Filesystem\\Factory\\LocalFactory', 'Ftp' => 'Surume\\Filesystem\\Factory\\FtpFactory', 'Ftpd' => 'Surume\\Filesystem\\Factory\\FtpdFactory', 'Null' => 'Surume\\Filesystem\\Factory\\NullFactory', 'AwsS3v2' => 'Surume\\Filesystem\\Factory\\Aws3v2Factory', 'AwsS3v3' => 'Surume\\Filesystem\\Factory\\Aws3v3Factory', 'Rackspace' => 'Surume\\Filesystem\\Factory\\RackspaceFactory', 'Dropbox' => 'Surume\\Filesystem\\Factory\\DropboxFactory', 'Copy' => 'Surume\\Filesystem\\Factory\\CopyFactory', 'Sftp' => 'Surume\\Filesystem\\Factory\\SftpFactory', 'Zip' => 'Surume\\Filesystem\\Factory\\ZipFactory', 'WebDAV' => 'Surume\\Filesystem\\Factory\\WebDavFactory', 'Redis' => 'Surume\\Filesystem\\Factory\\RedisFactory', 'Memory' => 'Surume\\Filesystem\\Factory\\MemoryFactory'];
     foreach ($adapters as $name => $adapter) {
         $this->registerAdapter($name, $adapter);
     }
 }
Example #2
0
 /**
  * @param RuntimeInterface $runtime
  */
 public function __construct(RuntimeInterface $runtime)
 {
     parent::__construct();
     $this->runtime = $runtime;
     $handlers = ['CmdDoNothing' => 'Surume\\Runtime\\Supervisor\\Cmd\\CmdDoNothing', 'CmdEscalateManager' => 'Surume\\Runtime\\Supervisor\\Cmd\\CmdEscalateManager', 'CmdEscalateSupervisor' => 'Surume\\Runtime\\Supervisor\\Cmd\\CmdEscalateSupervisor', 'CmdLog' => 'Surume\\Runtime\\Supervisor\\Cmd\\CmdLog', 'RuntimeContinue' => 'Surume\\Runtime\\Supervisor\\Runtime\\RuntimeContinue', 'RuntimeDestroy' => 'Surume\\Runtime\\Supervisor\\Runtime\\RuntimeDestroy', 'RuntimeDestroySoft' => 'Surume\\Runtime\\Supervisor\\Runtime\\RuntimeDestroySoft', 'RuntimeDestroyHard' => 'Surume\\Runtime\\Supervisor\\Runtime\\RuntimeDestroyHard', 'RuntimeRecreate' => 'Surume\\Runtime\\Supervisor\\Runtime\\RuntimeRecreate', 'RuntimeStart' => 'Surume\\Runtime\\Supervisor\\Runtime\\RuntimeStart', 'RuntimeStop' => 'Surume\\Runtime\\Supervisor\\Runtime\\RuntimeStop', 'ContainerContinue' => 'Surume\\Runtime\\Supervisor\\Container\\ContainerContinue', 'ContainerDestroy' => 'Surume\\Runtime\\Supervisor\\Container\\ContainerDestroy', 'ContainerStart' => 'Surume\\Runtime\\Supervisor\\Container\\ContainerStart', 'ContainerStop' => 'Surume\\Runtime\\Supervisor\\Container\\ContainerStop'];
     foreach ($handlers as $handlerName => $handlerClass) {
         $this->registerHandler($handlerName, $handlerClass);
     }
 }
Example #3
0
 /**
  * @param string[] $params
  */
 public function __construct($params = [])
 {
     parent::__construct();
     foreach ($params as $paramName => $paramValue) {
         $this->bindParam($paramName, $paramValue);
     }
     $commands = ['ArchStartCommand' => 'Surume\\Console\\Client\\Command\\Arch\\ArchStartCommand', 'ArchStopCommand' => 'Surume\\Console\\Client\\Command\\Arch\\ArchStopCommand', 'ArchStatusCommand' => 'Surume\\Console\\Client\\Command\\Arch\\ArchStatusCommand', 'ProjectCreateCommand' => 'Surume\\Console\\Client\\Command\\Project\\ProjectCreateCommand', 'ProjectDestroyCommand' => 'Surume\\Console\\Client\\Command\\Project\\ProjectDestroyCommand', 'ProjectStartCommand' => 'Surume\\Console\\Client\\Command\\Project\\ProjectStartCommand', 'ProjectStopCommand' => 'Surume\\Console\\Client\\Command\\Project\\ProjectStopCommand', 'ProjectStatusCommand' => 'Surume\\Console\\Client\\Command\\Project\\ProjectStatusCommand', 'ProcessExistsCommand' => 'Surume\\Console\\Client\\Command\\Process\\ProcessExistsCommand', 'ProcessCreateCommand' => 'Surume\\Console\\Client\\Command\\Process\\ProcessCreateCommand', 'ProcessDestroyCommand' => 'Surume\\Console\\Client\\Command\\Process\\ProcessDestroyCommand', 'ProcessStartCommand' => 'Surume\\Console\\Client\\Command\\Process\\ProcessStartCommand', 'ProcessStopCommand' => 'Surume\\Console\\Client\\Command\\Process\\ProcessStopCommand', 'ThreadExistsCommand' => 'Surume\\Console\\Client\\Command\\Thread\\ThreadExistsCommand', 'ThreadCreateCommand' => 'Surume\\Console\\Client\\Command\\Thread\\ThreadCreateCommand', 'ThreadDestroyCommand' => 'Surume\\Console\\Client\\Command\\Thread\\ThreadDestroyCommand', 'ThreadStartCommand' => 'Surume\\Console\\Client\\Command\\Thread\\ThreadStartCommand', 'ThreadStopCommand' => 'Surume\\Console\\Client\\Command\\Thread\\ThreadStopCommand', 'RuntimeExistsCommand' => 'Surume\\Console\\Client\\Command\\Runtime\\RuntimeExistsCommand', 'RuntimeDestroyCommand' => 'Surume\\Console\\Client\\Command\\Runtime\\RuntimeDestroyCommand', 'RuntimeStartCommand' => 'Surume\\Console\\Client\\Command\\Runtime\\RuntimeStartCommand', 'RuntimeStopCommand' => 'Surume\\Console\\Client\\Command\\Runtime\\RuntimeStopCommand', 'ContainerDestroyCommand' => 'Surume\\Console\\Client\\Command\\Container\\ContainerDestroyCommand', 'ContainerStartCommand' => 'Surume\\Console\\Client\\Command\\Container\\ContainerStartCommand', 'ContainerStopCommand' => 'Surume\\Console\\Client\\Command\\Container\\ContainerStopCommand', 'ContainerStatusCommand' => 'Surume\\Console\\Client\\Command\\Container\\ContainerStatusCommand'];
     foreach ($commands as $alias => $class) {
         $this->registerCommand($alias, $class);
     }
 }
Example #4
0
 /**
  * @param string $name
  * @param LoopInterface $loop
  */
 public function __construct($name, LoopInterface $loop)
 {
     parent::__construct();
     $factory = $this;
     $factory->bindParam('name', $name)->bindParam('loop', $loop)->define('Surume\\Channel\\Model\\Null\\NullModel', function ($config) {
         return new NullModel();
     })->define('Surume\\Channel\\Model\\Zmq\\ZmqDealer', function ($config) use($factory) {
         return new ZmqDealer(isset($config['loop']) ? $config['loop'] : $factory->getParam('loop'), array_merge(['id' => isset($config['name']) ? $config['name'] : $factory->getParam('name'), 'type' => ZmqModel::BINDER, 'hosts' => isset($config['name']) ? $config['name'] : $factory->getParam('name')], $config));
     })->define('Surume\\Channel\\Model\\Zmq\\ZmqRouter', function ($config) use($factory) {
         return new ZmqRouter(isset($config['loop']) ? $config['loop'] : $factory->getParam('loop'), array_merge(['id' => isset($config['name']) ? $config['name'] : $factory->getParam('name'), 'type' => ZmqModel::BINDER, 'hosts' => isset($config['name']) ? $config['name'] : $factory->getParam('name')], $config));
     });
 }
Example #5
0
 /**
  * @param string $name
  * @param ChannelModelFactoryInterface $modelFactory
  * @param LoopInterface|null $loop
  */
 public function __construct($name, ChannelModelFactoryInterface $modelFactory, LoopInterface $loop = null)
 {
     parent::__construct();
     $factory = $this;
     $factory->bindParam('name', $name)->bindParam('encoder', new ChannelEncoder(new JsonParser()))->bindParam('router', function () {
         return new ChannelRouterComposite(['input' => new ChannelRouterBase(), 'output' => new ChannelRouterBase()]);
     })->bindParam('loop', $loop)->define('Surume\\Channel\\ChannelBase', function ($class, $config) use($factory, $modelFactory) {
         return new ChannelBase(isset($config['name']) ? $config['name'] : $factory->getParam('name'), $modelFactory->create($class, [$config]), $factory->getParam('router'), $factory->getParam('encoder'), isset($config['loop']) ? $config['loop'] : $factory->getParam('loop'));
     })->define('Surume\\Channel\\ChannelComposite', function ($channels = [], $config = []) use($factory) {
         return new ChannelComposite(isset($config['name']) ? $config['name'] : $factory->getParam('name'), $channels, $factory->getParam('router'), isset($config['loop']) ? $config['loop'] : $factory->getParam('loop'));
     });
 }
Example #6
0
 /**
  *
  */
 public function __construct()
 {
     parent::__construct();
     $factory = $this;
     $factory->define('Surume\\Runtime\\Container\\Manager\\ProcessManagerBase', function ($config) {
         $reflection = new ReflectionClass('Surume\\Runtime\\Container\\Manager\\ProcessManagerBase');
         return $reflection->newInstanceArgs([$config['runtime'], $config['channel'], $config['env'], $config['system'], $config['filesystem']]);
     })->define('Surume\\Runtime\\Container\\Manager\\ProcessManagerRemote', function ($config) {
         $reflection = new ReflectionClass('Surume\\Runtime\\Container\\Manager\\ProcessManagerRemote');
         return $reflection->newInstanceArgs([$config['runtime'], $config['channel'], $config['receiver']]);
     })->define('Surume\\Runtime\\Container\\Manager\\ProcessManagerNull', function ($config) {
         return new ProcessManagerNull();
     });
 }
Example #7
0
 /**
  *
  */
 public function __construct()
 {
     parent::__construct();
     $factory = $this;
     $factory->define('LibEventLoop', function () {
         return new LibEventLoop();
     })->define('LibEvLoop', function () {
         return new LibEvLoop();
     })->define('ExtEventLoop', function () {
         return new ExtEventLoop();
     })->define('StreamSelectLoop', function () {
         return new StreamSelectLoop();
     });
 }