Navigation Menu

Skip to content

Commit

Permalink
- swapped in latest Rx (1.0,10605)
Browse files Browse the repository at this point in the history
- removed some overly spammydebug logging
- exposed manual merge call on FirkinDictionary
  • Loading branch information
sdether committed Jun 27, 2011
1 parent 9442ebd commit 4815af2
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 30 deletions.
4 changes: 1 addition & 3 deletions Firkin.Reactive.Test/Firkin.Reactive.Test.csproj
Expand Up @@ -43,9 +43,7 @@
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.CoreEx, Version=1.0.2856.102, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Observable, Version=1.0.0.102, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Reactive, Version=1.0.2856.102, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Reactive, Version=1.0.10605.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
Expand Down
1 change: 1 addition & 0 deletions Firkin.Reactive.Test/TIObservableFirkinHash.cs
Expand Up @@ -19,6 +19,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reactive;
using System.Threading;
using Droog.Firkin;
using Droog.Firkin.Test;
Expand Down
4 changes: 1 addition & 3 deletions Firkin.Reactive/Firkin.Reactive.csproj
Expand Up @@ -35,9 +35,7 @@
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.CoreEx, Version=1.0.2856.102, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Observable, Version=1.0.0.102, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Reactive, Version=1.0.2856.102, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Reactive, Version=1.0.10605.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
Expand Down
27 changes: 8 additions & 19 deletions Firkin.Reactive/ObservableFirkinHash.cs
Expand Up @@ -18,28 +18,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Subjects;
using Droog.Firkin;
using Droog.Firkin.Serialization;

namespace Firkin.Reactive {
public class ObservableFirkinHash<TKey> : FirkinHash<TKey>, IObservableFirkinHash<TKey> {

//--- Types ---
private class DisposableClosure : IDisposable {
private readonly Action _dispose;

public DisposableClosure(Action dispose) {
_dispose = dispose;
}

public void Dispose() {
_dispose();
}
}


//--- Fields ---
private Subject<FirkinHashChange<TKey>> _observable = new Subject<FirkinHashChange<TKey>>();
private readonly Subject<FirkinHashChange<TKey>> _observable = new Subject<FirkinHashChange<TKey>>();

//--- Constructors ---
public ObservableFirkinHash(string storeDirectory)
Expand Down Expand Up @@ -78,14 +65,16 @@ public ObservableFirkinHash(string storeDirectory, long maxFileSize, IByteArrayS

private void OnNext(FirkinHashChange<TKey> value) {
CheckDisposed();
_observable.OnNext(value);
lock(_observable) {
_observable.OnNext(value);
}
}



private void OnCompleted() {
CheckDisposed();
_observable.OnCompleted();
lock(_observable) {
_observable.OnCompleted();
}
}
}
}
4 changes: 1 addition & 3 deletions Firkin.Test.Perf/Firkin.Test.Perf.csproj
Expand Up @@ -48,9 +48,7 @@
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.CoreEx, Version=1.0.2856.102, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Observable, Version=1.0.0.102, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Reactive, Version=1.0.2856.102, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Reactive, Version=1.0.10605.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
Expand Down
1 change: 1 addition & 0 deletions Firkin.Test.Perf/TAsync.cs
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reactive.Linq;
using System.Threading;
using NUnit.Framework;

Expand Down
1 change: 1 addition & 0 deletions Firkin.Test.Perf/TStackoverflow.cs
Expand Up @@ -20,6 +20,7 @@
using System.Configuration;
using System.IO;
using System.Linq;
using System.Reactive;
using System.Xml;
using System.Xml.Serialization;
using Droog.Firkin.Test.Perf.Stackoverflow;
Expand Down
4 changes: 4 additions & 0 deletions Firkin/FirkinDictionary.cs
Expand Up @@ -133,6 +133,10 @@ public class FirkinDictionary<TKey, TValue> : IDictionary<TKey, TValue>, IDispos
get { return this.Select(x => x.Value).ToList(); }
}

public void Merge() {
_hash.Merge();
}

private MemoryStream GetStream(TValue value) {
var stream = new MemoryStream();
_valueSerializer.Serialize(stream, value);
Expand Down
4 changes: 2 additions & 2 deletions Firkin/FirkinHash.cs
Expand Up @@ -42,7 +42,7 @@ private class MergePair {
public IFirkinActiveFile Data;
public IFirkinHintFile Hint;
}

//--- Class Fields ---
protected static readonly ILog _log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

Expand Down Expand Up @@ -230,8 +230,8 @@ private class MergePair {
} else {
newIndex[key] = pair.Value;
}
_log.DebugFormat("added entries from file {0}: {1}", file.FileId, newIndex.Count);
}
_log.DebugFormat("added entries from file {0}: {1}", file.FileId, newIndex.Count);
}

// swap out index and file list
Expand Down

0 comments on commit 4815af2

Please sign in to comment.