Ejemplo n.º 1
0
        public void OnSequenceChange(SequenceActions sequenceAction, StoredPlayerMove move)
        {
            //Type | Time | Player | Direction
            switch (sequenceAction)
            {
            case SequenceActions.NewMoveAdded:
                //Type | Time | Player | Direction
                _textWriter.WriteLine("{0},{1},{2},{3}", sequenceAction, GetTimeReadable(), move.PlayerTags, move.Direction);
                break;

            case SequenceActions.MoveRemoved:
                //Type | Time | Player | Direction
                _textWriter.WriteLine("{0},{1},{2},{3}", sequenceAction, GetTimeReadable(), move.PlayerTags, move.Direction);
                break;

            case SequenceActions.SequenceStarted:
                //Type | Time
                _textWriter.WriteLine("{0},{1}", sequenceAction, GetTimeReadable());
                break;

            case SequenceActions.SequenceEnded:
                _textWriter.WriteLine("{0},{1}", sequenceAction, GetTimeReadable());
                break;

            case SequenceActions.MovePerformed:
                _textWriter.WriteLine("{0},{1},{2},{3}", sequenceAction, GetTimeReadable(), move.PlayerTags, move.Direction);
                _nrOfMoves++;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(sequenceAction), sequenceAction, null);
            }
        }
Ejemplo n.º 2
0
        public RavenFileSystem(InMemoryRavenConfiguration systemConfiguration, string name, TransportState recievedTransportState = null)
        {
            this.Name = name;
            this.systemConfiguration = systemConfiguration;

            var storageType = systemConfiguration.FileSystem.DefaultStorageTypeName;

            storage      = CreateTransactionalStorage(storageType, systemConfiguration);
            search       = new IndexStorage(systemConfiguration.FileSystem.IndexStoragePath, systemConfiguration.Settings);
            sigGenerator = new SigGenerator();
            var replicationHiLo = new SynchronizationHiLo(storage);
            var sequenceActions = new SequenceActions(storage);

            transportState        = recievedTransportState ?? new TransportState();
            notificationPublisher = new NotificationPublisher(transportState);
            fileLockManager       = new FileLockManager();
            storage.Initialize();
            search.Initialize();
            var uuidGenerator = new UuidGenerator(sequenceActions);

            historian  = new Historian(storage, replicationHiLo, uuidGenerator);
            BufferPool = new BufferPool(1024 * 1024 * 1024, 65 * 1024);
            conflictArtifactManager = new ConflictArtifactManager(storage, search);
            conflictDetector        = new ConflictDetector();
            conflictResolver        = new ConflictResolver(storage, new CompositionContainer(systemConfiguration.Catalog));
            synchronizationTask     = new SynchronizationTask(storage, sigGenerator, notificationPublisher, systemConfiguration);
            storageOperationsTask   = new StorageOperationsTask(storage, search, notificationPublisher);
            metricsCounters         = new MetricsCountersManager();

            AppDomain.CurrentDomain.ProcessExit  += ShouldDispose;
            AppDomain.CurrentDomain.DomainUnload += ShouldDispose;
        }
Ejemplo n.º 3
0
 public void NotifySequenceObservers(SequenceActions sequenceAction, StoredPlayerMove move)
 {
     foreach (ISequenceObserver observer in _sequenceObservers)
     {
         observer.OnSequenceChange(sequenceAction, move);
     }
 }
Ejemplo n.º 4
0
        public void Initialize()
        {
            this.storage.Initialize();

            var replicationHiLo = new SynchronizationHiLo(storage);
            var sequenceActions = new SequenceActions(storage);
            var uuidGenerator   = new UuidGenerator(sequenceActions);

            this.historian = new Historian(storage, replicationHiLo, uuidGenerator);

            this.search.Initialize(this);
        }
Ejemplo n.º 5
0
        public void Initialize()
        {
            storage.Initialize(FileCodecs);

            var replicationHiLo = new SynchronizationHiLo(storage);
            var sequenceActions = new SequenceActions(storage);
            var uuidGenerator   = new UuidGenerator(sequenceActions);

            historian = new Historian(storage, replicationHiLo, uuidGenerator);

            search.Initialize(this);

            InitializeTriggersExceptIndexCodecs();
            SecondStageInitialization();
        }
Ejemplo n.º 6
0
        public RavenFileSystem(InMemoryRavenConfiguration systemConfiguration, TransportState transportState, string name)
        {
            this.Name = name;
            this.systemConfiguration = systemConfiguration;

            var storageType = systemConfiguration.DefaultFileSystemStorageTypeName;

            if (string.Equals(InMemoryRavenConfiguration.VoronTypeName, storageType, StringComparison.OrdinalIgnoreCase) == false)
            {
                if (Directory.Exists(systemConfiguration.FileSystemDataDirectory) &&
                    Directory.EnumerateFileSystemEntries(systemConfiguration.FileSystemDataDirectory).Any())
                {
                    throw new InvalidOperationException(
                              string.Format(
                                  "We do not allow to run on a storage engine other then Voron, while we are in the early pre-release phase of RavenDB 3.0. You are currently running on {0}",
                                  storageType));
                }

                Trace.WriteLine("Forcing filesystem to run on Voron - pre release behavior only, mind " + Path.GetFileName(Path.GetDirectoryName(systemConfiguration.FileSystemDataDirectory)));
                storageType = InMemoryRavenConfiguration.VoronTypeName;
            }

            storage      = CreateTransactionalStorage(storageType, systemConfiguration);
            search       = new IndexStorage(systemConfiguration.FileSystemIndexStoragePath, systemConfiguration.Settings);
            sigGenerator = new SigGenerator();
            var replicationHiLo = new SynchronizationHiLo(storage);
            var sequenceActions = new SequenceActions(storage);

            this.transportState   = transportState;
            notificationPublisher = new NotificationPublisher(transportState);
            fileLockManager       = new FileLockManager();
            storage.Initialize();
            search.Initialize();
            var uuidGenerator = new UuidGenerator(sequenceActions);

            historian  = new Historian(storage, replicationHiLo, uuidGenerator);
            BufferPool = new BufferPool(1024 * 1024 * 1024, 65 * 1024);
            conflictArtifactManager = new ConflictArtifactManager(storage, search);
            conflictDetector        = new ConflictDetector();
            conflictResolver        = new ConflictResolver();
            synchronizationTask     = new SynchronizationTask(storage, sigGenerator, notificationPublisher, systemConfiguration);
            storageOperationsTask   = new StorageOperationsTask(storage, search, notificationPublisher);
            metricsCounters         = new MetricsCountersManager();

            AppDomain.CurrentDomain.ProcessExit  += ShouldDispose;
            AppDomain.CurrentDomain.DomainUnload += ShouldDispose;
        }
Ejemplo n.º 7
0
        public void OnSequenceChange(SequenceActions sequenceAction, StoredPlayerMove move)
        {
            switch (sequenceAction)
            {
            case SequenceActions.NewMoveAdded:
                AddMove(move);
                break;

            case SequenceActions.MoveRemoved:
                RemoveMove(move);
                break;

            case SequenceActions.SequenceStarted:
                float delay = GameHandler.Current.delayBetweenMoves;
                StartCoroutine(ClearSequence(delay));
                break;
            }
        }
Ejemplo n.º 8
0
    public void OnSequenceChange(SequenceActions sequenceAction, StoredPlayerMove move)
    {
        switch (sequenceAction)
        {
        case SequenceActions.NewMoveAdded:
            break;

        case SequenceActions.MoveRemoved:
            break;

        case SequenceActions.SequenceStarted:
            _oldString = "";
            break;

        default:
            throw new ArgumentOutOfRangeException(nameof(sequenceAction), sequenceAction, null);
        }
    }
Ejemplo n.º 9
0
 public void NotifySequenceObservers(SequenceActions sequenceAction, StoredPlayerMove move)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 10
0
 public void OnSequenceChange(SequenceActions sequenceAction, StoredPlayerMove move)
 {
     StartCoroutine(PopulateMap(0.5f));
 }