예제 #1
0
        private static void RunServer()
        {
            Console.WriteLine("Starting server on port 3001, type exit to quit");
            MemstateSettings config = new MemstateSettings();

            config.StorageProvider = typeof(InMemoryStorageProvider).FullName;
            config.LoggerFactory.AddConsole((category, level) => true);
            var engine = new EngineBuilder(config).Build <KeyValueStore <int> >();
            var server = new MemstateServer <KeyValueStore <int> >(config, engine);

            server.Start();
            while (Console.ReadLine() != "exit")
            {
                Console.WriteLine("Type exit to quit");
            }
            server.Stop();
            Console.WriteLine("Server stopped, hit enter to terminate");
            Console.ReadLine();
        }
예제 #2
0
        private static Task RunServer()
        {
            Console.WriteLine("Starting server on port 3001, type exit to quit");
            var settings = new MemstateSettings
            {
                FileSystem = new InMemoryFileSystem()
            };

            settings.LoggerFactory.AddConsole((category, level) => true);
            var engine = new EngineBuilder(settings).Build <KeyValueStore <int> >();
            var server = new MemstateServer <KeyValueStore <int> >(settings, engine);

            server.Start();
            while (Console.ReadLine() != "exit")
            {
                Console.WriteLine("Type exit to quit");
            }
            server.Stop();
            Console.WriteLine("Server stopped, hit enter to terminate");
            Console.ReadLine();

            return(Task.CompletedTask);
        }
예제 #3
0
 public Task Stop()
 {
     return(Task.WhenAll(
                _server.Stop(),
                StopWebConsole()));
 }
예제 #4
0
 private static void Stop <T>(MemstateServer <T> server) where T : class
 {
     server.Stop();
 }