|
namespace Raven.Database.Data
{
public class IndexFailureInformation
{
public bool IsInvalidIndex
{
get
{
if (Errors == 0)
return false;
// we don't have enough attempts to make a useful determination
if (Attempts < 10)
return false;
return (Attempts/(float) Errors) > 0.15;
}
}
public string Name { get; set; }
public int Attempts { get; set; }
public int Errors { get; set; }
public int Successes { get; set; }
public float FailureRate
{
get
{
if (Errors == 0)
return 0;
return (Attempts/(float) Errors);
}
}
public string GetErrorMessage()
{
const string msg =
"Index {0} is invalid, out of {1} indexing attempts, {2} has failed.\r\nError rate of {3:#.##%} exceeds allowed 15% error rate";
return string.Format(msg,
Name, Attempts, Errors, FailureRate);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I've been a software developer since 1996 and have enjoyed C# since 2003. I have a Bachelor's degree in Computer Science and for some reason, a Master's degree in Business Administration. I currently do software development contracting/consulting.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.