Exemplo n.º 1
0
 /// <summary>
 /// Retrieves the compressed logset size for a given request, in bytes.
 /// </summary>
 /// <returns>Compressed logset size of remote logset.</returns>
 public long?GetLogsetCompressedSize()
 {
     try
     {
         // If we have a hash match we need to know what kind of logset this is..
         LogsetMetadata metadata = GetMetadata();
         return(metadata.TargetCompressedSize);
     }
     catch (Exception ex)
     {
         Log.ErrorFormat("Error retrieving compressed logset size: {0}", ex);
         return(null);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Retrieves the logset type for a given request.
        /// </summary>
        /// <returns>Logset type of remote logset.</returns>
        public string GetLogsetType()
        {
            try
            {
                // If we have a hash match we need to know what kind of logset this is..
                LogsetMetadata metadata = GetMetadata();
                if (!String.IsNullOrWhiteSpace(metadata.LogsetType))
                {
                    return(metadata.LogsetType);
                }
            }
            catch (Exception ex)
            {
                Log.ErrorFormat("Error retrieving logset type: {0}", ex);
            }

            return(RequestConstants.UNKNOWN_LOGSET_TYPE);
        }
Exemplo n.º 3
0
        public void WritePreProcessingMetadata()
        {
            Log.Debug("Writing Logshark metadata to Mongo database..");
            var metadataTimer = logsharkRequest.RunContext.CreateTimer("Write Metadata", "Pre-processing");

            var metadata = new LogsetMetadata(logsharkRequest);

            try
            {
                logsetMetadataCollection.ReplaceOne(GetMetadataDocumentQuery(), metadata.ToBsonDocument(), new UpdateOptions {
                    IsUpsert = true
                });
            }
            catch (Exception ex)
            {
                throw new ProcessingException(String.Format("Failed to write pre-processing logset metadata to MongoDB: {0}", ex.Message), ex);
            }
            finally
            {
                metadataTimer.Stop();
            }
        }