Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt to restore index (map-only right now) from previously stored …
…segment file.
- Loading branch information
Arkadiusz Palinski
committed
Feb 11, 2013
1 parent
4ce686c
commit 1c2b8d2
Showing
10 changed files
with
303 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="IndexCommitPoint.cs" company="Hibernating Rhinos LTD"> | ||
// Copyright (c) Hibernating Rhinos LTD. All rights reserved. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
using System; | ||
|
||
namespace Raven.Database.Indexing | ||
{ | ||
public class IndexCommitPoint | ||
{ | ||
public Guid LastIndexedETag { get; set; } | ||
|
||
public IndexSegmentsInfo SegmentsInfo { get; set; } | ||
|
||
public DateTime TimeStamp { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="IndexSegmentsInfo.cs" company="Hibernating Rhinos LTD"> | ||
// Copyright (c) Hibernating Rhinos LTD. All rights reserved. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Raven.Database.Indexing | ||
{ | ||
public class IndexSegmentsInfo | ||
{ | ||
public long Generation { get; set; } | ||
|
||
public string CurrentSegmentFileName { get; set; } | ||
|
||
public ICollection<string> ReferencedFiles { get; set; } | ||
|
||
public bool IsIndexCorrupted { get; set; } | ||
|
||
protected bool Equals(IndexSegmentsInfo other) | ||
{ | ||
var theSameNumberOfItems = ReferencedFiles.Count == other.ReferencedFiles.Count; | ||
var theSameReferencedFiles = true; | ||
|
||
if (theSameNumberOfItems) | ||
{ | ||
if (ReferencedFiles.Any(file => other.ReferencedFiles.Contains(file) == false)) | ||
theSameReferencedFiles = false; | ||
} | ||
else | ||
theSameReferencedFiles = false; | ||
|
||
return theSameReferencedFiles && | ||
Generation == other.Generation && | ||
string.Equals(CurrentSegmentFileName, other.CurrentSegmentFileName) && | ||
IsIndexCorrupted.Equals(other.IsIndexCorrupted); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
unchecked | ||
{ | ||
var hashCode = Generation.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ (CurrentSegmentFileName != null ? CurrentSegmentFileName.GetHashCode() : 0); | ||
hashCode = (hashCode * 397) ^ (ReferencedFiles != null ? ReferencedFiles.GetHashCode() : 0); | ||
hashCode = (hashCode * 397) ^ IsIndexCorrupted.GetHashCode(); | ||
return hashCode; | ||
} | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) return false; | ||
if (ReferenceEquals(this, obj)) return true; | ||
if (obj.GetType() != this.GetType()) return false; | ||
return Equals((IndexSegmentsInfo) obj); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.