示例#1
0
文件: Engine.cs 项目: quanhb/OrigoDB
        protected Engine(Model model, EngineConfiguration config)
        {
            _config = config;

            _synchronizer = _config.CreateSynchronizer();
            _authorizer   = _config.CreateAuthorizer();
            Configure(model);

            if (_config.SnapshotBehavior == SnapshotBehavior.AfterRestore)
            {
                _log.Info("Starting snaphot job on threadpool");

                ThreadPool.QueueUserWorkItem(_ => CreateSnapshot());

                //Give the snapshot thread a chance to start and aquire the readlock
                Thread.Sleep(TimeSpan.FromMilliseconds(10));
            }

            if (_config.PersistenceMode == PersistenceMode.SnapshotPerTransaction)
            {
                CommandExecuted += (s, e) => CreateSnapshot();
            }


            Core.Config.Engines.AddEngine(config.Location.OfJournal, this);
        }
示例#2
0
        protected Engine(Model model, EngineConfiguration config)
        {
            _config = config;

            _synchronizer = _config.CreateSynchronizer();
            _authorizer   = _config.CreateAuthorizer();

            IsolatedReturnTypes.AddRange(_config.IsolatedTypes);
            _config.Isolation.Commands.SetFormatter(_config.CreateFormatter(FormatterUsage.Messages));
            _config.Isolation.ReturnValues.SetFormatter(_config.CreateFormatter(FormatterUsage.Results));

            Configure(model);

            if (_config.SnapshotBehavior == SnapshotBehavior.AfterRestore)
            {
                Logger.Info("Starting snaphot job on threadpool");

                ThreadPool.QueueUserWorkItem(_ => CreateSnapshot());

                //Give the snapshot thread a chance to start and aquire the readlock
                Thread.Sleep(TimeSpan.FromMilliseconds(10));
            }

            if (_config.PersistenceMode == PersistenceMode.SnapshotPerTransaction)
            {
                CommandExecuted += (s, e) => CreateSnapshot();
            }

            model.Starting(this);
            Core.Config.Engines.AddEngine(config.JournalPath, this);
        }
示例#3
0
 protected Kernel(EngineConfiguration config, Model model)
 {
     Synchronizer = config.CreateSynchronizer();
     _model       = model;
     Isolation    = config.Isolation;
 }
示例#4
0
文件: Kernel.cs 项目: quanhb/OrigoDB
 protected Kernel(EngineConfiguration config, Model model)
 {
     _resultFormatter = config.CreateFormatter(FormatterUsage.Results);
     _synchronizer    = config.CreateSynchronizer();
     _model           = model;
 }