You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sy...@apache.org on 2014/12/31 22:33:07 UTC
[1/2] lucenenet git commit: Rename
Repository: lucenenet
Updated Branches:
refs/heads/master 355f09dad -> 4128cedfe
Rename
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/f3a5a564
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/f3a5a564
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/f3a5a564
Branch: refs/heads/master
Commit: f3a5a564f1e69e29b4ee0fe88ede0f4969c9e637
Parents: 355f09d
Author: Itamar Syn-Hershko <it...@code972.com>
Authored: Wed Dec 31 23:21:49 2014 +0200
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Wed Dec 31 23:21:49 2014 +0200
----------------------------------------------------------------------
src/Lucene.Net.Core/Store/FSDirectory.cs | 40 +++++++++++++--------------
1 file changed, 20 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f3a5a564/src/Lucene.Net.Core/Store/FSDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/FSDirectory.cs b/src/Lucene.Net.Core/Store/FSDirectory.cs
index aaa278f..25c5c1e 100644
--- a/src/Lucene.Net.Core/Store/FSDirectory.cs
+++ b/src/Lucene.Net.Core/Store/FSDirectory.cs
@@ -114,7 +114,7 @@ namespace Lucene.Net.Store
[Obsolete("this constant is no longer used since Lucene 4.5.")]
public const int DEFAULT_READ_CHUNK_SIZE = 8192;
- protected internal readonly DirectoryInfo Directory_Renamed; // The underlying filesystem directory
+ protected internal readonly DirectoryInfo directory; // The underlying filesystem directory
protected internal readonly ISet<string> StaleFiles = new HashSet<string>(); // Files written, but not yet sync'ed
private int ChunkSize = DEFAULT_READ_CHUNK_SIZE;
@@ -133,7 +133,7 @@ namespace Lucene.Net.Store
return file;
}
- public FSDirectory(DirectoryInfo dir)
+ protected FSDirectory(DirectoryInfo dir)
: this(dir, null)
{
}
@@ -151,7 +151,7 @@ namespace Lucene.Net.Store
{
lockFactory = new NativeFSLockFactory();
}
- Directory_Renamed = GetCanonicalPath(path);
+ directory = GetCanonicalPath(path);
if (File.Exists(path.FullName))
{
@@ -226,10 +226,10 @@ namespace Lucene.Net.Store
// if the lock factory has no lockDir set, use the this directory as lockDir
if (dir == null)
{
- lf.LockDir = Directory_Renamed;
+ lf.LockDir = directory;
lf.LockPrefix = null;
}
- else if (dir.FullName.Equals(Directory_Renamed.FullName))
+ else if (dir.FullName.Equals(directory.FullName))
{
lf.LockPrefix = null;
}
@@ -296,7 +296,7 @@ namespace Lucene.Net.Store
public override string[] ListAll()
{
EnsureOpen();
- return ListAll(Directory_Renamed);
+ return ListAll(directory);
}
/// <summary>
@@ -304,7 +304,7 @@ namespace Lucene.Net.Store
public override bool FileExists(string name)
{
EnsureOpen();
- return File.Exists(Path.Combine(Directory_Renamed.FullName, name));
+ return File.Exists(Path.Combine(directory.FullName, name));
}
/// <summary>
@@ -312,7 +312,7 @@ namespace Lucene.Net.Store
public override long FileLength(string name)
{
EnsureOpen();
- FileInfo file = new FileInfo(Path.Combine(Directory_Renamed.FullName, name));
+ FileInfo file = new FileInfo(Path.Combine(directory.FullName, name));
long len = file.Length;
if (len == 0 && !file.Exists)
{
@@ -329,7 +329,7 @@ namespace Lucene.Net.Store
public override void DeleteFile(string name)
{
EnsureOpen();
- FileInfo file = new FileInfo(Path.Combine(Directory_Renamed.FullName, name));
+ FileInfo file = new FileInfo(Path.Combine(directory.FullName, name));
try
{
file.Delete();
@@ -353,19 +353,19 @@ namespace Lucene.Net.Store
protected internal virtual void EnsureCanWrite(string name)
{
- if (!Directory_Renamed.Exists)
+ if (!directory.Exists)
{
try
{
- Directory_Renamed.Create();
+ directory.Create();
}
catch
{
- throw new System.IO.IOException("Cannot create directory: " + Directory_Renamed);
+ throw new System.IO.IOException("Cannot create directory: " + directory);
}
}
- FileInfo file = new FileInfo(Path.Combine(Directory_Renamed.FullName, name));
+ FileInfo file = new FileInfo(Path.Combine(directory.FullName, name));
if (file.Exists) // delete existing, if any
{
try
@@ -390,7 +390,7 @@ namespace Lucene.Net.Store
ISet<string> toSync = new HashSet<string>(names);
toSync.IntersectWith(StaleFiles);
- foreach (string name in toSync)
+ foreach (var name in toSync)
{
Fsync(name);
}
@@ -399,7 +399,7 @@ namespace Lucene.Net.Store
// (otherwise it can happen that the directory does not yet exist)!
if (toSync.Count > 0)
{
- IOUtils.Fsync(Directory_Renamed.FullName, true);
+ IOUtils.Fsync(directory.FullName, true);
}
StaleFiles.ExceptWith(toSync);
@@ -413,7 +413,7 @@ namespace Lucene.Net.Store
string dirName; // name to be hashed
try
{
- dirName = Directory_Renamed.FullName;
+ dirName = directory.FullName;
}
catch (System.IO.IOException e)
{
@@ -446,7 +446,7 @@ namespace Lucene.Net.Store
get
{
EnsureOpen();
- return Directory_Renamed;
+ return directory;
}
}
@@ -454,7 +454,7 @@ namespace Lucene.Net.Store
/// For debug output. </summary>
public override string ToString()
{
- return this.GetType().Name + "@" + Directory_Renamed + " lockFactory=" + LockFactory;
+ return this.GetType().Name + "@" + directory + " lockFactory=" + LockFactory;
}
/// <summary>
@@ -495,7 +495,7 @@ namespace Lucene.Net.Store
{
this.Parent = parent;
this.Name = name;
- File = new FileStream(Path.Combine(parent.Directory_Renamed.FullName, name), FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read);
+ File = new FileStream(Path.Combine(parent.directory.FullName, name), FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read);
IsOpen = true;
}
@@ -555,7 +555,7 @@ namespace Lucene.Net.Store
/// <param name="name"></param>
protected void Fsync(String name, bool isDir = false)
{
- IOUtils.Fsync(Path.Combine(Directory_Renamed.FullName, name), false);
+ IOUtils.Fsync(Path.Combine(directory.FullName, name), false);
}
}
}
\ No newline at end of file
[2/2] lucenenet git commit: Cleanup
Posted by sy...@apache.org.
Cleanup
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/4128cedf
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/4128cedf
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/4128cedf
Branch: refs/heads/master
Commit: 4128cedfef26b451f03385e453f716a37dacdad2
Parents: f3a5a56
Author: Itamar Syn-Hershko <it...@code972.com>
Authored: Wed Dec 31 23:32:55 2014 +0200
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Wed Dec 31 23:32:55 2014 +0200
----------------------------------------------------------------------
src/Lucene.Net.Core/Store/Directory.cs | 2 ++
src/Lucene.Net.Core/Store/SimpleFSDirectory.cs | 18 ++++++++----------
2 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4128cedf/src/Lucene.Net.Core/Store/Directory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/Directory.cs b/src/Lucene.Net.Core/Store/Directory.cs
index 3d1aa7f..7c341a1 100644
--- a/src/Lucene.Net.Core/Store/Directory.cs
+++ b/src/Lucene.Net.Core/Store/Directory.cs
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
+using System.IO;
+using Lucene.Net.Index;
namespace Lucene.Net.Store
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4128cedf/src/Lucene.Net.Core/Store/SimpleFSDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/SimpleFSDirectory.cs b/src/Lucene.Net.Core/Store/SimpleFSDirectory.cs
index 424a771..186913d 100644
--- a/src/Lucene.Net.Core/Store/SimpleFSDirectory.cs
+++ b/src/Lucene.Net.Core/Store/SimpleFSDirectory.cs
@@ -58,31 +58,28 @@ namespace Lucene.Net.Store
public override IndexInput OpenInput(string name, IOContext context)
{
EnsureOpen();
- FileInfo path = new FileInfo(Path.Combine(Directory.FullName, name));
- FileStream raf = new FileStream(path.FullName, FileMode.Open, FileAccess.Read, FileShare.Read);
+ var path = new FileInfo(Path.Combine(Directory.FullName, name));
+ var raf = new FileStream(path.FullName, FileMode.Open, FileAccess.Read, FileShare.Read);
return new SimpleFSIndexInput("SimpleFSIndexInput(path=\"" + path.FullName + "\")", raf, context);
}
public override IndexInputSlicer CreateSlicer(string name, IOContext context)
{
EnsureOpen();
- FileInfo file = new FileInfo(Path.Combine(Directory.FullName, name));
- FileStream descriptor = new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.Read);
+ var file = new FileInfo(Path.Combine(Directory.FullName, name));
+ var descriptor = new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.Read);
return new IndexInputSlicerAnonymousInnerClassHelper(this, context, file, descriptor);
}
private class IndexInputSlicerAnonymousInnerClassHelper : IndexInputSlicer
{
- private readonly SimpleFSDirectory OuterInstance;
-
- private IOContext Context;
- private FileInfo File;
- private FileStream Descriptor;
+ private readonly IOContext Context;
+ private readonly FileInfo File;
+ private readonly FileStream Descriptor;
public IndexInputSlicerAnonymousInnerClassHelper(SimpleFSDirectory outerInstance, IOContext context, FileInfo file, FileStream descriptor)
: base(outerInstance)
{
- this.OuterInstance = outerInstance;
this.Context = context;
this.File = file;
this.Descriptor = descriptor;
@@ -101,6 +98,7 @@ namespace Lucene.Net.Store
return new SimpleFSIndexInput("SimpleFSIndexInput(" + sliceDescription + " in path=\"" + File.FullName + "\" slice=" + offset + ":" + (offset + length) + ")", Descriptor, offset, length, BufferedIndexInput.BufferSize(Context));
}
+ [Obsolete]
public override IndexInput OpenFullSlice()
{
try