Esempio n. 1
0
 public void NonNullNames()
 {
     TRexCaches.DesignTopologyExistenceMapsCacheName().Should().NotBeNullOrWhiteSpace();
     TRexCaches.ImmutableNonSpatialCacheName().Should().NotBeNullOrWhiteSpace();
     TRexCaches.SpatialSubGridDirectoryCacheName(StorageMutability.Immutable).Should().NotBeNullOrWhiteSpace();
     TRexCaches.SpatialSubGridDirectoryCacheName(StorageMutability.Mutable).Should().NotBeNullOrWhiteSpace();
     TRexCaches.SpatialSubGridSegmentCacheName(StorageMutability.Immutable).Should().NotBeNullOrWhiteSpace();
     TRexCaches.SpatialSubGridSegmentCacheName(StorageMutability.Mutable).Should().NotBeNullOrWhiteSpace();
     TRexCaches.MutableNonSpatialCacheName().Should().NotBeNullOrWhiteSpace();
     TRexCaches.SegmentRetirementQueueCacheName().Should().NotBeNullOrWhiteSpace();
     TRexCaches.SiteModelMetadataCacheName().Should().NotBeNullOrWhiteSpace();
     TRexCaches.SiteModelsCacheName(StorageMutability.Immutable).Should().NotBeNullOrWhiteSpace();
     TRexCaches.SiteModelsCacheName(StorageMutability.Mutable).Should().NotBeNullOrWhiteSpace();
     TRexCaches.TAGFileBufferQueueCacheName().Should().NotBeNullOrWhiteSpace();
     TRexCaches.SiteModelChangeMapsCacheName().Should().NotBeNullOrWhiteSpace();
     TRexCaches.ProductionDataExistenceMapCacheName(StorageMutability.Immutable).Should().NotBeNullOrWhiteSpace();
     TRexCaches.ProductionDataExistenceMapCacheName(StorageMutability.Mutable).Should().NotBeNullOrWhiteSpace();
 }
Esempio n. 2
0
        /// <summary>
        /// Create the cache that holds the per project, per machine, change maps driven by TAG file ingest
        /// Note: This machine based information is distinguished from that in the non-spatial cache in that
        /// it is partitioned, rather than replicated.
        /// </summary>
        private void InstantiateSiteModelMachinesChangeMapsCacheReference()
        {
            immutableTRexGrid.GetOrCreateCache <ISiteModelMachineAffinityKey, ISerialisedByteArrayWrapper>(new CacheConfiguration
            {
                Name = TRexCaches.SiteModelChangeMapsCacheName(),
                KeepBinaryInStore = true,
                CacheMode         = CacheMode.Partitioned,

                // TODO: No backups for now
                Backups        = 0,
                DataRegionName = DataRegions.IMMUTABLE_NONSPATIAL_DATA_REGION,

                // Configure the function that maps the change maps to nodes in the grid
                // Note: This cache uses an affinity function that assigns data for a site model onto a single node.
                // For the purposes of the immutable grid, it is helpful for a node to contain all change maps for a single
                // site model as this simplifies the process of updating those change maps in response to messages from production data ingest
                AffinityFunction = new ProjectBasedSpatialAffinityFunction(),

                AtomicityMode = CacheAtomicityMode.Transactional
            });
        }
Esempio n. 3
0
        public void dumpKeysToFile(StorageMutability mutability, string fileName)
        {
            try
            {
                var ignite = DIContext.Obtain <ITRexGridFactory>()?.Grid(mutability);

                if (ignite == null)
                {
                    Console.WriteLine($@"----> No ignite reference for {TRexGrids.GridName(mutability)} grid");
                    return;
                }

                using (var outFile = new FileStream(fileName, FileMode.Create))
                {
                    using (var writer = new StreamWriter(outFile)
                    {
                        NewLine = "\r\n"
                    })
                    {
                        if (mutability == StorageMutability.Immutable)
                        {
                            Console.WriteLine($"----> Writing keys for {TRexCaches.ImmutableNonSpatialCacheName()}");
                            try
                            {
                                writeKeys(TRexCaches.ImmutableNonSpatialCacheName(), writer, ignite.GetCache <INonSpatialAffinityKey, ISerialisedByteArrayWrapper>(TRexCaches.ImmutableNonSpatialCacheName()));
                            }
                            catch (Exception E)
                            {
                                writer.WriteLine($"Exception occurred: {E.Message}");
                            }

                            Console.WriteLine($"----> Writing keys for {TRexCaches.DesignTopologyExistenceMapsCacheName()}");
                            try
                            {
                                writeKeys(TRexCaches.DesignTopologyExistenceMapsCacheName(), writer, ignite.GetCache <INonSpatialAffinityKey, ISerialisedByteArrayWrapper>(TRexCaches.DesignTopologyExistenceMapsCacheName()));
                            }
                            catch (Exception E)
                            {
                                writer.WriteLine($"Exception occurred: {E.Message}");
                            }

                            Console.WriteLine($"----> Writing keys for {TRexCaches.SpatialSubGridDirectoryCacheName(StorageMutability.Immutable)}");
                            try
                            {
                                WriteKeysSpatial(TRexCaches.SpatialSubGridDirectoryCacheName(StorageMutability.Immutable), writer, ignite.GetCache <ISubGridSpatialAffinityKey, ISerialisedByteArrayWrapper>(TRexCaches.SpatialSubGridDirectoryCacheName(StorageMutability.Immutable)));
                            }
                            catch (Exception E)
                            {
                                writer.WriteLine($"Exception occurred: {E.Message}");
                            }

                            Console.WriteLine($"----> Writing keys for {TRexCaches.SpatialSubGridSegmentCacheName(StorageMutability.Immutable)}");
                            try
                            {
                                WriteKeysSpatial(TRexCaches.SpatialSubGridSegmentCacheName(StorageMutability.Immutable), writer, ignite.GetCache <ISubGridSpatialAffinityKey, ISerialisedByteArrayWrapper>(TRexCaches.SpatialSubGridSegmentCacheName(StorageMutability.Immutable)));
                            }
                            catch (Exception E)
                            {
                                writer.WriteLine($"Exception occurred: {E.Message}");
                            }

                            Console.WriteLine($"----> Writing keys for {TRexCaches.SiteModelChangeMapsCacheName()}");
                            try
                            {
                                writeSiteModelChangeMapQueueKeys(TRexCaches.SiteModelChangeMapsCacheName(), writer, ignite.GetCache <ISiteModelMachineAffinityKey, ISerialisedByteArrayWrapper>(TRexCaches.SiteModelChangeMapsCacheName()));
                            }
                            catch (Exception E)
                            {
                                writer.WriteLine($"Exception occurred: {E.Message}");
                            }
                        }

                        if (mutability == StorageMutability.Mutable)
                        {
                            Console.WriteLine($"----> Writing keys for {TRexCaches.MutableNonSpatialCacheName()}");
                            try
                            {
                                writeKeys(TRexCaches.MutableNonSpatialCacheName(), writer, ignite.GetCache <INonSpatialAffinityKey, ISerialisedByteArrayWrapper>(TRexCaches.MutableNonSpatialCacheName()));
                            }
                            catch (Exception E)
                            {
                                writer.WriteLine($"Exception occurred: {E.Message}");
                            }

                            Console.WriteLine($"----> Writing keys for {TRexCaches.SpatialSubGridDirectoryCacheName(StorageMutability.Mutable)}");
                            try
                            {
                                WriteKeysSpatial(TRexCaches.SpatialSubGridDirectoryCacheName(StorageMutability.Mutable), writer, ignite.GetCache <ISubGridSpatialAffinityKey, ISerialisedByteArrayWrapper>(TRexCaches.SpatialSubGridDirectoryCacheName(StorageMutability.Mutable)));
                            }
                            catch (Exception E)
                            {
                                writer.WriteLine($"Exception occurred: {E.Message}");
                            }

                            Console.WriteLine($"----> Writing keys for {TRexCaches.SpatialSubGridSegmentCacheName(StorageMutability.Mutable)}");
                            try
                            {
                                WriteKeysSpatial(TRexCaches.SpatialSubGridSegmentCacheName(StorageMutability.Mutable), writer, ignite.GetCache <ISubGridSpatialAffinityKey, ISerialisedByteArrayWrapper>(TRexCaches.SpatialSubGridSegmentCacheName(StorageMutability.Mutable)));
                            }
                            catch (Exception E)
                            {
                                writer.WriteLine($"Exception occurred: {E.Message}");
                            }


                            Console.WriteLine($"----> Writing keys for {TRexCaches.TAGFileBufferQueueCacheName()}");
                            try
                            {
                                writeTAGFileBufferQueueKeys(TRexCaches.TAGFileBufferQueueCacheName(), writer, ignite.GetCache <ITAGFileBufferQueueKey, TAGFileBufferQueueItem>(TRexCaches.TAGFileBufferQueueCacheName()));
                            }
                            catch (Exception E)
                            {
                                writer.WriteLine($"Exception occurred: {E.Message}");
                            }

                            Console.WriteLine($"----> Writing keys for {TRexCaches.SegmentRetirementQueueCacheName()}");
                            try
                            {
                                writeSegmentRetireeQueueKeys(TRexCaches.SegmentRetirementQueueCacheName(), writer, ignite.GetCache <ISegmentRetirementQueueKey, SegmentRetirementQueueItem>(TRexCaches.SegmentRetirementQueueCacheName()));
                            }
                            catch (Exception E)
                            {
                                writer.WriteLine($"Exception occurred: {E.Message}");
                            }
                        }
                    }
                }
            }
            catch (Exception ee)
            {
                Console.WriteLine(ee.ToString());
            }
        }