示例#1
0
        /// <inheritdoc/>
        public override int Analyze()
        {
            Console.WriteLine($"Total number of events ingested = {m_eventCount}");
            Console.WriteLine($"Total time for event ingestion: {m_stopWatch.ElapsedMilliseconds / 1000.0} seconds");

            Console.WriteLine("\nEvent data ingested into RocksDB. Starting to ingest static graph data ...\n");

            IngestAllPips();
            Console.WriteLine($"\nAll pips ingested ... total time is: {m_stopWatch.ElapsedMilliseconds / 1000.0} seconds");

            Console.WriteLine("\nStarting to ingest PipGraph metadata");
            var xldbPipGraph = CachedGraph.PipGraph.ToPipGraph(PathTable, CachedGraph.PipTable, m_nameExpander);

            var cachedGraphKey = new GraphMetadataKey
            {
                Type = GraphMetaData.PipGraph
            };
            var keyArr   = cachedGraphKey.ToByteArray();
            var valueArr = xldbPipGraph.ToByteArray();

            WriteToDb(keyArr, valueArr, XldbDataStore.StaticGraphColumnFamilyName);
            AddToDbStorageDictionary(DBStoredTypes.GraphMetaData, keyArr.Length + valueArr.Length);

            var xldbMounts = CachedGraph.MountPathExpander.ToMountPathExpander(PathTable, m_nameExpander);

            cachedGraphKey.Type = GraphMetaData.MountPathExpander;
            keyArr   = cachedGraphKey.ToByteArray();
            valueArr = xldbMounts.ToByteArray();

            WriteToDb(keyArr, valueArr, XldbDataStore.StaticGraphColumnFamilyName);
            AddToDbStorageDictionary(DBStoredTypes.MountPathExpander, keyArr.Length + valueArr.Length);

            Console.WriteLine($"\nPipGraph metadata ingested ... total time is: {m_stopWatch.ElapsedMilliseconds / 1000.0} seconds");

            Console.WriteLine("\nStarting to ingest file and directory consumer/producer information.");

            IngestProducerConsumerInformation();
            Console.WriteLine($"\nConsumer/producer information ingested ... total time is: {m_stopWatch.ElapsedMilliseconds / 1000.0} seconds");

            foreach (var kvp in m_dBStorageStats)
            {
                var dBStorageStatsKey = new DBStorageStatsKey
                {
                    StorageType = kvp.Key
                };

                WriteToDb(dBStorageStatsKey.ToByteArray(), kvp.Value.ToByteArray());
            }

            // Write the Xldb version file to the Xldb directory
            File.WriteAllText(Path.Combine(OutputDirPath, XldbDataStore.XldbVersionFileName), XldbDataStore.XldbVersion.ToString());
            return(0);
        }
示例#2
0
        public MountPathExpander GetMountPathExpander()
        {
            Contract.Requires(m_accessor != null, "XldbDataStore is not initialized");

            var graphMetadata = new GraphMetadataKey
            {
                Type = GraphMetaData.MountPathExpander
            };

            var maybeFound = m_accessor.Use(database =>
            {
                database.TryGetValue(graphMetadata.ToByteArray(), out var mountPathExpanderData, StaticGraphColumnFamilyName);
                return(MountPathExpander.Parser.ParseFrom(mountPathExpanderData));
            });

            if (!maybeFound.Succeeded)
            {
                maybeFound.Failure.Throw();
            }

            return(maybeFound.Result);
        }