Exemplo n.º 1
0
   public RyuContainer(
    RyuContainer parent, 
    IActivator activator
 )
       : this(parent, activator, new ConcurrentDictionary<Type, RyuType>())
   {
   }
 public ChronokeeperService GetChronokeeperService(RyuContainer ryu) {
    var remoteChronokeeperConfiguration = ryu.Get<RemoteChronokeeperConfiguration>();
    var networkingProxy = ryu.Get<INetworkingProxy>();
    var endpoint = networkingProxy.CreateEndPoint(remoteChronokeeperConfiguration.Host, remoteChronokeeperConfiguration.Port);
    var serviceClientFactory = ryu.Get<ServiceClientFactory>();
    var serviceClient = serviceClientFactory.Remote(endpoint.ToIPEndPoint());
    return serviceClient.GetService<ChronokeeperService>();
 }
 private PlatformNetworkingResources ConstructPlatformNetworkingResources(RyuContainer ryu) {
    var configuration = ryu.Get<PlatformConfiguration>();
    var serviceClientFactory = ryu.Get<ServiceClientFactory>();
    var serviceClient = serviceClientFactory.Local(configuration.ServicePort, ClusteringRole.HostOrGuest);
    return new PlatformNetworkingResourcesImpl {
       LocalServiceClient = serviceClient
    };
 }
 private CacheFactory ConstructCacheFactory(RyuContainer ryu) {
    var networkingResources = ryu.Get<HydarNetworkingResources>();
    return new CacheFactoryImpl(
       ryu.Get<GuidHelper>(),
       ryu.Get<ServiceClientFactory>(),
       networkingResources.LocalServiceClient,
       networkingResources.LocalCourierClient,
       ryu.Get<ILocalManagementServer>(),
       ryu.Get<ReceivedMessageFactory>(),
       ryu.Get<IPofContext>()
    );
 }
      public NestResult Start(IEggParameters parameters) {
         host = parameters?.Host;

         InitializeLogging();

         ryu = new RyuFactory().Create();
         var clusteringConfiguration = new ClusteringConfigurationImpl(IPAddress.Loopback, kZileanServicePort, ClusteringRole.HostOnly);
         ryu.Set<ClusteringConfiguration>(clusteringConfiguration);
         ryu.Setup();
         ryu.Touch<ItzWartyProxiesRyuPackage>();
         ryu.Touch<ServicesRyuPackage>();
         ryu.Touch<ZileanImplRyuPackage>();
         return NestResult.Success;
      }
 public static ChronokeeperServiceImpl CreateChronokeeperServiceImpl(RyuContainer ryu) {
    var configuration = ryu.Get<ChronokeeperServiceConfiguration>();
    var timeProxy = ryu.Get<TimeProxy>();
    var workers = Util.Generate(
       configuration.WorkerCount,
       workerId => (ChronokeeperWorker)new ChronokeeperWorkerImpl(
          new ChronokeeperWorkerConfigurationImpl {
             DatacenterId = configuration.DatacenterId,
             WorkerId = workerId
          }, timeProxy
       )
    );
    return new ChronokeeperServiceImpl(workers);
 }
 private Gamepad ConstructGamepad(RyuContainer ryu)
 {
     var gamepad = new RemoteGamepad();
      const int kPort = 21337;
      var courierClientFactory = ryu.Get<CourierClientFactory>();
      var courierClient = courierClientFactory.CreateUdpCourierClient(kPort,
     new CourierClientConfiguration {
        Identifier = Guid.NewGuid()
     });
      ryu.Set(courierClient);
      courierClient.RegisterPayloadHandler<GamepadStateDto>(x => gamepad.Update(x.Payload));
      Console.WriteLine("Constructed courier client");
      return gamepad;
 }
      private HydarNetworkingResources ConstructHydarNetworkingResources(RyuContainer ryu) {
         var hydarConfiguration = ryu.Get<HydarConfiguration>();

         // Initialize Dargon.Services
         var serviceClientFactory = ryu.Get<ServiceClientFactory>();
         var serviceClient = serviceClientFactory.Local(hydarConfiguration.ServicePort, ClusteringRole.HostOnly);

         // Initialize Dargon.Courier
         var courierClientFactory = ryu.Get<CourierClientFactory>();
         var courierClient = courierClientFactory.CreateUdpCourierClient(hydarConfiguration.CourierPort);

         return new HydarNetworkingResourcesImpl {
            LocalServiceClient = serviceClient,
            LocalCourierClient = courierClient
         };
      }
 public RemoteChronokeeperConfiguration GetRemoteChronokeeperConfiguration(RyuContainer ryu) {
    var configurationFactory = ryu.Get<RemoteChronokeeperConfigurationFactory>();
    return configurationFactory.Create();
 }
 private CacheDispatcher ConstructCacheDispatcher(RyuContainer ryu) {
    var networkingResources = ryu.Get<HydarNetworkingResources>();
    MessageRouter messageRouter = networkingResources.LocalCourierClient;
    return new CacheDispatcherImpl(messageRouter);
 }
Exemplo n.º 11
0
 public DargonClientEgg()
 {
     InitializeLogging();
      ryu = new RyuFactory().Create();
      ((RyuContainerImpl)ryu).SetLoggerEnabled(true);
 }
      public CorePlatformEgg() {
         ryu = new RyuFactory().Create();
//         ((RyuContainerImpl)ryu).SetLoggerEnabled(true);
      }
 public WebendApplicationEgg() {
    this.ryu = new RyuFactory().Create();
    ((RyuContainerImpl)ryu).SetLoggerEnabled(true);
 }
 public CoreDaemonApplicationEgg()
 {
     ryu = new RyuFactory().Create();
      ((RyuContainerImpl)ryu).SetLoggerEnabled(true);
 }
 private ChronokeeperServiceConfiguration CreateChronokeeperServiceConfiguration(RyuContainer ryu) {
    return new ChronokeeperServiceConfigurationImpl {
       DatacenterId = 0,
       WorkerCount = 1 << ChronokeeperWorkerImpl.kWorkerBits
    };
 }
Exemplo n.º 16
0
 public RyuContainer(RyuContainer parent, IActivator activator, ConcurrentDictionary<Type, RyuType> ryuTypesByType)
 {
     this.parent = parent;
      this.activator = activator;
      this.ryuTypesByType = ryuTypesByType;
 }