Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Database"/> class.
        /// </summary>
        /// <param name="node">The storage node to send messages to.</param>
        public Database(StorageNode node)
        {
            _node = node;
            var chunkMaintenanceThread = new Thread(RunMaintenanceThread);

            chunkMaintenanceThread.Start();
        }
Exemple #2
0
        /// <summary>
        /// The main method of the program.
        /// </summary>
        private static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            StorageNodeSettings settings;

            if (File.Exists("config.xml"))
            {
                settings = new StorageNodeSettings(File.ReadAllText("config.xml"));
            }
            else
            {
                Logger.Log("\"config.xml\" not found, creating with the defaults.", LogLevel.Warning);
                settings = new StorageNodeSettings();
                File.WriteAllText("config.xml", settings.ToString());
            }

            Logger.Init(string.Empty, "Storage", settings.LogLevel, true);

            _node = new StorageNode(settings);
            _node.Run();

            Logger.Shutdown();
        }