Exemplo n.º 1
0
        private IList <LockRecord> GetRequestedLocks(HighlyAvailableGraphDatabase master)
        {
            Tracers             tracers    = master.DependencyResolver.resolveDependency(typeof(Tracers));
            RecordingLockTracer lockTracer = ( RecordingLockTracer )tracers.LockTracer;

            return(lockTracer.RequestedLocks);
        }
Exemplo n.º 2
0
 public void Install(IBusDevice device)
 {
     if (!Tracers.ContainsKey(device) && !Devices.Contains(device))
     {
         Devices.Insert(0, device);
     }
 }
Exemplo n.º 3
0
        private static KernelTransactions NewKernelTransactions(Locks locks, StorageEngine storageEngine, TransactionCommitProcess commitProcess, bool testKernelTransactions)
        {
            LifeSupport life = new LifeSupport();

            life.Start();

            TransactionIdStore transactionIdStore = mock(typeof(TransactionIdStore));

            when(transactionIdStore.LastCommittedTransaction).thenReturn(new TransactionId(0, 0, 0));

            Tracers tracers = new Tracers("null", NullLog.Instance, new Monitors(), mock(typeof(JobScheduler)), _clock);
            StatementLocksFactory statementLocksFactory = new SimpleStatementLocksFactory(locks);

            StatementOperationParts statementOperations = mock(typeof(StatementOperationParts));
            KernelTransactions      transactions;

            if (testKernelTransactions)
            {
                transactions = CreateTestTransactions(storageEngine, commitProcess, transactionIdStore, tracers, statementLocksFactory, statementOperations, _clock, _databaseAvailabilityGuard);
            }
            else
            {
                transactions = CreateTransactions(storageEngine, commitProcess, transactionIdStore, tracers, statementLocksFactory, statementOperations, _clock, _databaseAvailabilityGuard);
            }
            transactions.Start();
            return(transactions);
        }
Exemplo n.º 4
0
        private void projectileMotion(float p1, int p2)
        {
            int   dAngle = Aimer.instance.angle;
            int   power  = Aimer.instance.power;
            float angle  = (float)getAngle(dAngle);
            int   Xpos   = (int)(Game.round.me.x);

            count++;
            if (count > 5)
            {
                count = 0;
                Tracers.Clear();
            }

            if (dAngle <= 180)
            {
                Proj       p      = new Proj();
                TracerLine tracer = Tracers.CreateLine(p, Color.red);

                for (int i = 1; i <= 1000 - Xpos; i += increment)
                {
                    float t = i / (float)((power + powerSalt[power]) * Mathf.Cos(angle));
                    float Y = (float)(((power + powerSalt[power]) * Mathf.Sin(angle)) * t - (0.5 * g * t * t));

                    Vector3 point = new Vector3(Map.toWorldX((float)i + Xpos), Map.toWorldY(Game.round.me.y + Y));
                    tracer.line.points3.Add(point);

                    if (Game.round.me.y + Y < 0)
                    {
                        break;//round has gone off bottom of screen
                    }
                }
                tracer.line.Draw3D();
            }
            else
            {
                Proj       p      = new Proj();
                TracerLine tracer = Tracers.CreateLine(p, Color.red);
                for (int i = 1; i < Xpos; i += increment)
                {
                    float t = i / (float)((power + powerSalt[power]) * Mathf.Cos(angle));
                    float Y = (float)(((power + powerSalt[power]) * Mathf.Sin(angle)) * t - (0.5 * g * t * t));

                    Vector3 point = new Vector3(Map.toWorldX((float)Xpos - i), Map.toWorldY(Game.round.me.y + Y));
                    tracer.line.points3.Add(point);

                    if (Game.round.me.y + Y < 0)
                    {
                        break;//round has gone off bottom of screen
                    }
                }
                tracer.line.Draw3D();
            }
        }
Exemplo n.º 5
0
 public void Uninstall(IBusDevice device)
 {
     if (Tracers.ContainsKey(device))
     {
         var tracer = Tracers[device];
         Tracers.Remove(device);
         Devices.Remove(tracer);
     }
     else
     {
         Devices.Remove(device);
     }
 }
Exemplo n.º 6
0
        internal ModularDatabaseCreationContext(string databaseName, PlatformModule platformModule, DatabaseEditionContext editionContext, Procedures procedures, GraphDatabaseFacade facade)
        {
            this._databaseName = databaseName;
            this._config       = platformModule.Config;
            DatabaseIdContext idContext = editionContext.IdContext;

            this._idGeneratorFactory = idContext.IdGeneratorFactory;
            this._idController       = idContext.IdController;
            this._databaseLayout     = platformModule.StoreLayout.databaseLayout(databaseName);
            this._logService         = platformModule.Logging;
            this._scheduler          = platformModule.JobScheduler;
            this._globalDependencies = platformModule.Dependencies;
            this._tokenHolders       = editionContext.CreateTokenHolders();
            this._tokenNameLookup    = new NonTransactionalTokenNameLookup(_tokenHolders);
            this._locks = editionContext.CreateLocks();
            this._statementLocksFactory    = editionContext.CreateStatementLocksFactory();
            this._schemaWriteGuard         = editionContext.SchemaWriteGuard;
            this._transactionEventHandlers = new TransactionEventHandlers(facade);
            this._monitors = new Monitors(platformModule.Monitors);
            this._indexingServiceMonitor = _monitors.newMonitor(typeof(IndexingService.Monitor));
            this._physicalLogMonitor     = _monitors.newMonitor(typeof(LogFileCreationMonitor));
            this._fs = platformModule.FileSystem;
            this._transactionStats = editionContext.CreateTransactionMonitor();
            this._databaseHealth   = new DatabaseHealth(platformModule.PanicEventGenerator, _logService.getInternalLog(typeof(DatabaseHealth)));
            this._transactionHeaderInformationFactory = editionContext.HeaderInformationFactory;
            this._commitProcessFactory  = editionContext.CommitProcessFactory;
            this._autoIndexing          = new InternalAutoIndexing(platformModule.Config, _tokenHolders.propertyKeyTokens());
            this._indexConfigStore      = new IndexConfigStore(_databaseLayout, _fs);
            this._explicitIndexProvider = new DefaultExplicitIndexProvider();
            this._pageCache             = platformModule.PageCache;
            this._constraintSemantics   = editionContext.ConstraintSemantics;
            this._tracers    = platformModule.Tracers;
            this._procedures = procedures;
            this._ioLimiter  = editionContext.IoLimiter;
            this._clock      = platformModule.Clock;
            this._databaseAvailabilityGuard    = editionContext.CreateDatabaseAvailabilityGuard(_clock, _logService, _config);
            this._databaseAvailability         = new DatabaseAvailability(_databaseAvailabilityGuard, _transactionStats, platformModule.Clock, AwaitActiveTransactionDeadlineMillis);
            this._coreAPIAvailabilityGuard     = new CoreAPIAvailabilityGuard(_databaseAvailabilityGuard, editionContext.TransactionStartTimeout);
            this._accessCapability             = editionContext.AccessCapability;
            this._storeCopyCheckPointMutex     = new StoreCopyCheckPointMutex();
            this._recoveryCleanupWorkCollector = platformModule.RecoveryCleanupWorkCollector;
            this._databaseInfo               = platformModule.DatabaseInfo;
            this._versionContextSupplier     = platformModule.VersionContextSupplier;
            this._collectionsFactorySupplier = platformModule.CollectionsFactorySupplier;
            this._kernelExtensionFactories   = platformModule.KernelExtensionFactories;
            this._watcherServiceFactory      = editionContext.WatcherServiceFactory;
            this._facade          = facade;
            this._engineProviders = platformModule.EngineProviders;
        }
Exemplo n.º 7
0
        public ITracer InstallTraced(IBusDevice device)
        {
            if (Tracers.ContainsKey(device))
            {
                return(Tracers[device]);
            }

            if (Devices.Contains(device))
            {
                Devices.Remove(device);
            }

            var tracer = new DeviceTracer(device);

            Tracers[device] = tracer;
            Devices.Insert(0, tracer);
            return(tracer);
        }
Exemplo n.º 8
0
 public KernelTransactions(Config config, StatementLocksFactory statementLocksFactory, ConstraintIndexCreator constraintIndexCreator, StatementOperationParts statementOperations, SchemaWriteGuard schemaWriteGuard, TransactionHeaderInformationFactory txHeaderFactory, TransactionCommitProcess transactionCommitProcess, AuxiliaryTransactionStateManager auxTxStateManager, TransactionHooks hooks, TransactionMonitor transactionMonitor, AvailabilityGuard databaseAvailabilityGuard, Tracers tracers, StorageEngine storageEngine, Procedures procedures, TransactionIdStore transactionIdStore, SystemNanoClock clock, AtomicReference <CpuClock> cpuClockRef, AtomicReference <HeapAllocation> heapAllocationRef, AccessCapability accessCapability, AutoIndexing autoIndexing, ExplicitIndexStore explicitIndexStore, VersionContextSupplier versionContextSupplier, CollectionsFactorySupplier collectionsFactorySupplier, ConstraintSemantics constraintSemantics, SchemaState schemaState, IndexingService indexingService, TokenHolders tokenHolders, string currentDatabaseName, Dependencies dataSourceDependencies)
 {
     if (!InstanceFieldsInitialized)
     {
         InitializeInstanceFields();
         InstanceFieldsInitialized = true;
     }
     this._config = config;
     this._statementLocksFactory  = statementLocksFactory;
     this._constraintIndexCreator = constraintIndexCreator;
     this._statementOperations    = statementOperations;
     this._schemaWriteGuard       = schemaWriteGuard;
     this._transactionHeaderInformationFactory = txHeaderFactory;
     this._transactionCommitProcess            = transactionCommitProcess;
     this._auxTxStateManager         = auxTxStateManager;
     this._hooks                     = hooks;
     this._transactionMonitor        = transactionMonitor;
     this._databaseAvailabilityGuard = databaseAvailabilityGuard;
     this._tracers                   = tracers;
     this._storageEngine             = storageEngine;
     this._procedures                = procedures;
     this._transactionIdStore        = transactionIdStore;
     this._cpuClockRef               = cpuClockRef;
     this._heapAllocationRef         = heapAllocationRef;
     this._accessCapability          = accessCapability;
     this._autoIndexing              = autoIndexing;
     this._explicitIndexStore        = explicitIndexStore;
     this._indexingService           = indexingService;
     this._tokenHolders              = tokenHolders;
     this._currentDatabaseName       = currentDatabaseName;
     this._dataSourceDependencies    = dataSourceDependencies;
     this._versionContextSupplier    = versionContextSupplier;
     this._clock                     = clock;
     DoBlockNewTransactions();
     this._collectionsFactorySupplier = collectionsFactorySupplier;
     this._constraintSemantics        = constraintSemantics;
     this._schemaState = schemaState;
 }
Exemplo n.º 9
0
        private PageCacheTracer GetPageCacheTracer(GraphDatabaseService db)
        {
            Tracers tracers = (( GraphDatabaseAPI )db).DependencyResolver.resolveDependency(typeof(Tracers));

            return(tracers.PageCacheTracer);
        }
Exemplo n.º 10
0
        // Update
        //
        // functions
        //  - Get and send input states to the InputHandler
        //  - Check collisions for all my MY projectiles and enemies
        //  - Log any collisions for my projectiles and ME
        //  - Check collisions for all enemies/projectiles and ME
        //  - Log my HP if hit
        //      - Check if I die and do anything I gotta
        //  - Update my position if I'm moving
        //      - collide with platforms below me
        //  - Log my position is I'm moving
        //
        // returns
        //
        protected override void Update(GameTime gameTime)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            Cursor.Pos = new Vector2(Mouse.GetState().Position.X, Mouse.GetState().Position.Y);

            ReadInput(Mouse.GetState(), Keyboard.GetState());
            HandleInput();

            if (gameStarted)
            {
                CheckEvents();

                foreach (Skeleton s in Enemies)
                {
                    s.Update(Stage, KillZones);
                }

                foreach (Doot p in Projectiles)
                {
                    p.Update(KillZones);
                }
                Projectiles.RemoveAll(p => p.Marked);

                foreach (PickUp p in PickUps)
                {
                    p.Update();
                }
                PickUps.RemoveAll(p => p.Marked);

                foreach (Tracer t in Tracers)
                {
                    t.Update();
                }
                Tracers.RemoveAll(p => p.Opacity <= 0);

                foreach (Platform p in Platforms)
                {
                    p.Update();
                }
                Platforms.RemoveAll(p => p.Opacity <= 0);

                if (boss != null && boss.Active)
                {
                    boss.Update();
                }

                player.Update(Platforms, KillZones, PickUps);

                boss.UpdateHPBar();
            }

            foreach (SpriteText s in Text)
            {
                s.Move(gameTime);
            }
            Text.RemoveAll(s => s.Opacity <= 0);

            Cursor.Animate();

            base.Update(gameTime);
        }
Exemplo n.º 11
0
 internal TestKernelTransactions(StatementLocksFactory statementLocksFactory, ConstraintIndexCreator constraintIndexCreator, StatementOperationParts statementOperations, SchemaWriteGuard schemaWriteGuard, TransactionHeaderInformationFactory txHeaderFactory, TransactionCommitProcess transactionCommitProcess, AuxiliaryTransactionStateManager auxTxStateManager, TransactionHooks hooks, TransactionMonitor transactionMonitor, AvailabilityGuard databaseAvailabilityGuard, Tracers tracers, StorageEngine storageEngine, Procedures procedures, TransactionIdStore transactionIdStore, SystemNanoClock clock, AccessCapability accessCapability, AutoIndexing autoIndexing, VersionContextSupplier versionContextSupplier, TokenHolders tokenHolders, Dependencies dataSourceDependencies) : base(Config.defaults(), statementLocksFactory, constraintIndexCreator, statementOperations, schemaWriteGuard, txHeaderFactory, transactionCommitProcess, auxTxStateManager, hooks, transactionMonitor, databaseAvailabilityGuard, tracers, storageEngine, procedures, transactionIdStore, clock, new AtomicReference <CpuClock>(CpuClock.NOT_AVAILABLE), new AtomicReference <HeapAllocation>(HeapAllocation.NOT_AVAILABLE), accessCapability, autoIndexing, mock(typeof(ExplicitIndexStore)), versionContextSupplier, ON_HEAP, new StandardConstraintSemantics(), mock(typeof(SchemaState)), mock(typeof(IndexingService)), tokenHolders, DEFAULT_DATABASE_NAME, dataSourceDependencies)
 {
 }
Exemplo n.º 12
0
 private static TestKernelTransactions CreateTestTransactions(StorageEngine storageEngine, TransactionCommitProcess commitProcess, TransactionIdStore transactionIdStore, Tracers tracers, StatementLocksFactory statementLocksFactory, StatementOperationParts statementOperations, SystemNanoClock clock, AvailabilityGuard databaseAvailabilityGuard)
 {
     return(new TestKernelTransactions(statementLocksFactory, null, statementOperations, null, DEFAULT, commitProcess, mock(typeof(AuxiliaryTransactionStateManager)), new TransactionHooks(), mock(typeof(TransactionMonitor)), databaseAvailabilityGuard, tracers, storageEngine, new Procedures(), transactionIdStore, clock, new CanWrite(), AutoIndexing.UNSUPPORTED, EmptyVersionContextSupplier.EMPTY, mockedTokenHolders(), new Dependencies()));
 }
Exemplo n.º 13
0
 private static KernelTransactions CreateTransactions(StorageEngine storageEngine, TransactionCommitProcess commitProcess, TransactionIdStore transactionIdStore, Tracers tracers, StatementLocksFactory statementLocksFactory, StatementOperationParts statementOperations, SystemNanoClock clock, AvailabilityGuard databaseAvailabilityGuard)
 {
     return(new KernelTransactions(Config.defaults(), statementLocksFactory, null, statementOperations, null, DEFAULT, commitProcess, mock(typeof(AuxiliaryTransactionStateManager)), new TransactionHooks(), mock(typeof(TransactionMonitor)), databaseAvailabilityGuard, tracers, storageEngine, new Procedures(), transactionIdStore, clock, new AtomicReference <CpuClock>(CpuClock.NOT_AVAILABLE), new AtomicReference <HeapAllocation>(HeapAllocation.NOT_AVAILABLE), new CanWrite(), AutoIndexing.UNSUPPORTED, mock(typeof(ExplicitIndexStore)), EmptyVersionContextSupplier.EMPTY, ON_HEAP, mock(typeof(ConstraintSemantics)), mock(typeof(SchemaState)), mock(typeof(IndexingService)), mockedTokenHolders(), DEFAULT_DATABASE_NAME, new Dependencies()));
 }
Exemplo n.º 14
0
        protected internal virtual PageCache CreatePageCache(FileSystemAbstraction fileSystem, Config config, LogService logging, Tracers tracers, VersionContextSupplier versionContextSupplier, JobScheduler jobScheduler)
        {
            Log pageCacheLog = logging.GetInternalLog(typeof(PageCache));
            ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory(fileSystem, config, tracers.PageCacheTracer, tracers.PageCursorTracerSupplier, pageCacheLog, versionContextSupplier, jobScheduler);
            PageCache pageCache = pageCacheFactory.OrCreatePageCache;

            if (config.Get(GraphDatabaseSettings.dump_configuration))
            {
                pageCacheFactory.DumpConfiguration();
            }
            return(pageCache);
        }
Exemplo n.º 15
0
        public PlatformModule(File providedStoreDir, Config config, DatabaseInfo databaseInfo, GraphDatabaseFacadeFactory.Dependencies externalDependencies)
        {
            this.DatabaseInfo      = databaseInfo;
            this.DataSourceManager = new DataSourceManager(config);
            Dependencies           = new Dependencies();
            Dependencies.satisfyDependency(databaseInfo);

            Clock = Dependencies.satisfyDependency(CreateClock());
            Life  = Dependencies.satisfyDependency(CreateLife());

            this.StoreLayout = StoreLayout.of(providedStoreDir);

            config.AugmentDefaults(GraphDatabaseSettings.neo4j_home, StoreLayout.storeDirectory().Path);
            this.Config = Dependencies.satisfyDependency(config);

            FileSystem = Dependencies.satisfyDependency(CreateFileSystemAbstraction());
            Life.add(new FileSystemLifecycleAdapter(FileSystem));

            // Component monitoring
            Monitors = externalDependencies.Monitors() == null ? new Monitors() : externalDependencies.Monitors();
            Dependencies.satisfyDependency(Monitors);

            JobScheduler = Life.add(Dependencies.satisfyDependency(CreateJobScheduler()));
            StartDeferredExecutors(JobScheduler, externalDependencies.DeferredExecutors());

            // Cleanup after recovery, used by GBPTree, added to life in NeoStoreDataSource
            RecoveryCleanupWorkCollector = new GroupingRecoveryCleanupWorkCollector(JobScheduler);
            Dependencies.satisfyDependency(RecoveryCleanupWorkCollector);

            // Database system information, used by UDC
            UsageData = new UsageData(JobScheduler);
            Dependencies.satisfyDependency(Life.add(UsageData));

            // If no logging was passed in from the outside then create logging and register
            // with this life
            Logging = Dependencies.satisfyDependency(CreateLogService(externalDependencies.UserLogProvider()));

            config.Logger = Logging.getInternalLog(typeof(Config));

            Life.add(Dependencies.satisfyDependency(new StoreLockerLifecycleAdapter(CreateStoreLocker())));

            (new JvmChecker(Logging.getInternalLog(typeof(JvmChecker)), new JvmMetadataRepository())).checkJvmCompatibilityAndIssueWarning();

            string desiredImplementationName = config.Get(GraphDatabaseSettings.tracer);

            Tracers = Dependencies.satisfyDependency(new Tracers(desiredImplementationName, Logging.getInternalLog(typeof(Tracers)), Monitors, JobScheduler, Clock));
            Dependencies.satisfyDependency(Tracers.pageCacheTracer);
            Dependencies.satisfyDependency(FirstImplementor(typeof(LogRotationMonitor), Tracers.transactionTracer, LogRotationMonitor.NULL));
            Dependencies.satisfyDependency(FirstImplementor(typeof(CheckPointerMonitor), Tracers.checkPointTracer, CheckPointerMonitor.NULL));

            VersionContextSupplier = CreateCursorContextSupplier(config);

            CollectionsFactorySupplier = CreateCollectionsFactorySupplier(config, Life);

            Dependencies.satisfyDependency(VersionContextSupplier);
            PageCache = Dependencies.satisfyDependency(CreatePageCache(FileSystem, config, Logging, Tracers, VersionContextSupplier, JobScheduler));

            Life.add(new PageCacheLifecycle(PageCache));

            DiagnosticsManager = Life.add(Dependencies.satisfyDependency(new DiagnosticsManager(Logging.getInternalLog(typeof(DiagnosticsManager)))));
            SystemDiagnostics.registerWith(DiagnosticsManager);

            Dependencies.satisfyDependency(DataSourceManager);

            KernelExtensionFactories = externalDependencies.KernelExtensions();
            EngineProviders          = externalDependencies.ExecutionEngines();
            GlobalKernelExtensions   = Dependencies.satisfyDependency(new GlobalKernelExtensions(new SimpleKernelContext(StoreLayout.storeDirectory(), databaseInfo, Dependencies), KernelExtensionFactories, Dependencies, KernelExtensionFailureStrategies.fail()));

            UrlAccessRule = Dependencies.satisfyDependency(URLAccessRules.combined(externalDependencies.UrlAccessRules()));

            ConnectorPortRegister = new ConnectorPortRegister();
            Dependencies.satisfyDependency(ConnectorPortRegister);

            EventHandlers       = new KernelEventHandlers(Logging.getInternalLog(typeof(KernelEventHandlers)));
            PanicEventGenerator = new DatabasePanicEventGenerator(EventHandlers);

            PublishPlatformInfo(Dependencies.resolveDependency(typeof(UsageData)));
        }