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 2015/05/02 19:37:25 UTC
[3/3] lucenenet git commit: use appropriate filestream share mode
use appropriate filestream share mode
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/ef7a7ad8
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/ef7a7ad8
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/ef7a7ad8
Branch: refs/heads/master
Commit: ef7a7ad88668ef87a880aed2d1f9e4bff6ccae21
Parents: ff6f242
Author: Laimonas Simutis <la...@gmail.com>
Authored: Fri May 1 21:26:14 2015 -0400
Committer: Laimonas Simutis <la...@gmail.com>
Committed: Fri May 1 21:26:14 2015 -0400
----------------------------------------------------------------------
src/Lucene.Net.Core/Store/MMapDirectory.cs | 18 ++++++------------
src/Lucene.Net.Core/Store/NIOFSDirectory.cs | 4 ++--
2 files changed, 8 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ef7a7ad8/src/Lucene.Net.Core/Store/MMapDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/MMapDirectory.cs b/src/Lucene.Net.Core/Store/MMapDirectory.cs
index 2e2d8ab..b59ad88 100644
--- a/src/Lucene.Net.Core/Store/MMapDirectory.cs
+++ b/src/Lucene.Net.Core/Store/MMapDirectory.cs
@@ -198,23 +198,17 @@ namespace Lucene.Net.Store
public override IndexInput OpenInput(string name, IOContext context)
{
EnsureOpen();
- FileInfo file = new FileInfo(Path.Combine(Directory.FullName, name));
+ var file = new FileInfo(Path.Combine(Directory.FullName, name));
- FileStream c = new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.Read);
+ var c = new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete);
- return new MMapIndexInput(this, "MMapIndexInput(path=\"" + file.ToString() + "\")", c);
+ return new MMapIndexInput(this, "MMapIndexInput(path=\"" + file + "\")", c);
}
public override IndexInputSlicer CreateSlicer(string name, IOContext context)
{
- EnsureOpen();
- FileInfo file = new FileInfo(Path.Combine(Directory.FullName, name));
-
- FileStream c = new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.Read);
-
- var full = new MMapIndexInput(this, "MMapIndexInputSlicer(path=\"" + file.ToString() + "\")", c);
+ var full = (MMapIndexInput)OpenInput(name, context);
- //MMapIndexInput full = (MMapIndexInput)OpenInput(name, context);
return new IndexInputSlicerAnonymousInnerClassHelper(this, full);
}
@@ -222,9 +216,9 @@ namespace Lucene.Net.Store
{
private readonly MMapDirectory OuterInstance;
- private Lucene.Net.Store.MMapDirectory.MMapIndexInput Full;
+ private MMapIndexInput Full;
- public IndexInputSlicerAnonymousInnerClassHelper(MMapDirectory outerInstance, Lucene.Net.Store.MMapDirectory.MMapIndexInput full)
+ public IndexInputSlicerAnonymousInnerClassHelper(MMapDirectory outerInstance, MMapIndexInput full)
: base(outerInstance)
{
this.OuterInstance = outerInstance;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ef7a7ad8/src/Lucene.Net.Core/Store/NIOFSDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/NIOFSDirectory.cs b/src/Lucene.Net.Core/Store/NIOFSDirectory.cs
index 682c8a8..42fa5e6 100644
--- a/src/Lucene.Net.Core/Store/NIOFSDirectory.cs
+++ b/src/Lucene.Net.Core/Store/NIOFSDirectory.cs
@@ -80,7 +80,7 @@ namespace Lucene.Net.Store
//File path = new File(Directory, name);
FileInfo path = new FileInfo(Path.Combine(Directory.FullName, name));
//path.Create();
- FileStream fc = new FileStream(path.FullName, FileMode.Open, FileAccess.Read, FileShare.Read);//FileChannel.open(path.toPath(), StandardOpenOption.READ);
+ FileStream fc = new FileStream(path.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete);//FileChannel.open(path.toPath(), StandardOpenOption.READ);
return new NIOFSIndexInput("NIOFSIndexInput(path=\"" + path + "\")", fc, context);
//return new NIOFSIndexInput(new FileInfo(Path.Combine(Directory.FullName, name)), context, ReadChunkSize);
}
@@ -91,7 +91,7 @@ namespace Lucene.Net.Store
//File path = new File(Directory, name);
//FileStream descriptor = FileChannel.open(path.toPath(), StandardOpenOption.READ);
FileInfo path = new FileInfo(Path.Combine(Directory.FullName, name));
- FileStream fc = new FileStream(path.FullName, FileMode.Open, FileAccess.Read, FileShare.Read);
+ FileStream fc = new FileStream(path.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete);
return new IndexInputSlicerAnonymousInnerClassHelper(this, context, path, fc);
}