Permalink
Browse files

Merge branch 'master' of https://github.com/enyim/EnyimMemcached

  • Loading branch information...
2 parents 273b301 + 08283d6 commit d3e8d6595f9afb107eed7a86d2cc836e31ff4d7a @johnzablocki johnzablocki committed Aug 17, 2012
Showing with 160 additions and 15,346 deletions.
  1. +6 −0 .nuget/NuGet.Config
  2. BIN .nuget/NuGet.exe
  3. +71 −0 .nuget/NuGet.targets
  4. +0 −4 DemoApp/DemoApp.csproj
  5. +2 −7 DemoApp/Program.cs
  6. +7 −4 Enyim.Caching.Tests/Enyim.Caching.Tests.csproj
  7. +2 −0 Enyim.Caching.Tests/MemcachedClientGetTests.cs
  8. +2 −0 Enyim.Caching.Tests/MemcachedClientStoreTests.cs
  9. +6 −11 Enyim.Caching.sln
  10. +2 −0 Enyim.Caching/Enyim.Caching.csproj
  11. +1 −2 Enyim.Caching/Memcached/MemcachedNode.cs
  12. +1 −1 Enyim.Caching/Memcached/Protocol/Binary/BinarySingleItemOperation.cs
  13. +1 −1 Enyim.Caching/Memcached/Protocol/Binary/DeleteOperation.cs
  14. +1 −1 Enyim.Caching/Memcached/Protocol/Binary/GetOperation.cs
  15. +1 −1 Enyim.Caching/Memcached/Protocol/Binary/MutatorOperation.cs
  16. +1 −1 Enyim.Caching/Memcached/Protocol/Binary/StoreOperation.cs
  17. +13 −0 Enyim.Caching/Memcached/Results/Extensions/OperationResultExtensions.cs
  18. +4 −2 Enyim.Caching/Memcached/Results/Helpers/ResultHelper.cs
  19. +10 −8 ...basePerformanceMonitorFactory.cs → Enyim.Caching/Memcached/Results/StatusCodes/StatusCodeEnums.cs
  20. +6 −12 ...nfiguration/BucketPortType.cs → Enyim.Caching/Memcached/Results/StatusCodes/StatusCodeMessages.cs
  21. +1 −1 Enyim.Caching/MemcachedClient.Results.cs
  22. +7 −8 Enyim.Caching/MemcachedClient.cs
  23. +0 −45 Membase/BasicMembaseOperationFactory.cs
  24. +0 −276 Membase/BucketConfigListener.cs
  25. +0 −32 Membase/Changes.mdown
  26. +0 −28 Membase/Config.transform
  27. +0 −92 Membase/ConfigHelper.cs
  28. +0 −44 Membase/Configuration/DefaultPerformanceMonitorFactory.cs
  29. +0 −75 Membase/Configuration/IMembaseClientConfiguration.cs
  30. +0 −293 Membase/Configuration/MembaseClientConfiguration.cs
  31. +0 −169 Membase/Configuration/MembaseClientSection.cs
  32. +0 −119 Membase/Configuration/ServersElement.cs
  33. +0 −42 Membase/Configuration/UriElement.cs
  34. +0 −68 Membase/Configuration/UriElementCollection.cs
  35. +0 −85 Membase/Configuration/UriValidator.cs
  36. +0 −28 Membase/Demo.config
  37. +0 −218 Membase/Deserialization.cs
  38. +0 −15 Membase/IMembaseOperationFactory.cs
  39. +0 −13 Membase/IMembaseServerPool.cs
  40. +0 −91 Membase/Membase.csproj
  41. +0 −19 Membase/Membase.nuspec
  42. +0 −464 Membase/MembaseClient.cs
  43. +0 −577 Membase/MembasePool.cs
  44. +0 −564 Membase/MessageStreamListener.cs
  45. +0 −11 Membase/OperationInterfaces.cs
  46. +0 −88 Membase/Operations/GetAndTouchOperation.cs
  47. +0 −240 Membase/Operations/SyncOperation.cs
  48. +0 −65 Membase/Operations/TouchOperation.cs
  49. +0 −35 Membase/Properties/AssemblyInfo.cs
  50. +0 −359 Membase/VBucketAwareOperationFactory.cs
  51. +0 −116 Membase/WebClientWithTimeout.cs
  52. +2 −27 MemcachedTest/ConfigTest.cs
  53. +7 −12 MemcachedTest/KetamaTest.cs
  54. +0 −47 MemcachedTest/MembaseClientTest.cs
  55. +0 −41 MemcachedTest/MembaseMemcachedBucketTest.cs
  56. +0 −6 MemcachedTest/MemcachedTest.csproj
  57. +4 −8 TestApp/Program.cs
  58. +0 −4 TestApp/TestApp.csproj
  59. +2 −2 build/properties.ps1
  60. BIN packages/NUnit.2.6.0.12054/NUnit.2.6.0.12054.nupkg
  61. BIN packages/NUnit.2.6.0.12054/lib/nunit.framework.dll
  62. +0 −10,845 packages/NUnit.2.6.0.12054/lib/nunit.framework.xml
  63. +0 −15 packages/NUnit.2.6.0.12054/license.txt
  64. +0 −4 packages/repositories.config
View
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <solution>
+ <add key="disableSourceControlIntegration" value="true" />
+ </solution>
+</configuration>
View
Binary file not shown.
View
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
+
+ <!-- Windows specific commands -->
+ <NuGetToolsPath Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
+ <PackagesConfig Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
+ <PackagesDir Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>
+
+ <!-- We need to launch nuget.exe with the mono command if we're not on windows -->
+ <NuGetToolsPath Condition=" '$(OS)' != 'Windows_NT'">$(SolutionDir).nuget</NuGetToolsPath>
+ <PackagesConfig Condition=" '$(OS)' != 'Windows_NT' ">packages.config</PackagesConfig>
+ <PackagesDir Condition=" '$(OS)' != 'Windows_NT'">$(SolutionDir)packages</PackagesDir>
+
+ <!-- NuGet command -->
+ <NuGetExePath>$(NuGetToolsPath)\nuget.exe</NuGetExePath>
+ <NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
+ <NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
+
+ <PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
+
+ <!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
+ <PackageSources>""</PackageSources>
+
+ <!-- Enable the restore command to run before builds -->
+ <RestorePackages Condition="$(RestorePackages) == ''">false</RestorePackages>
+
+ <!-- Property that enables building a package from a project -->
+ <BuildPackage Condition="$(BuildPackage) == ''">false</BuildPackage>
+
+ <!-- Commands -->
+ <RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)"</RestoreCommand>
+ <BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
+
+ <!-- Make the build depend on restore packages -->
+ <BuildDependsOn Condition="$(RestorePackages) == 'true'">
+ RestorePackages;
+ $(BuildDependsOn);
+ </BuildDependsOn>
+
+ <!-- Make the build depend on restore packages -->
+ <BuildDependsOn Condition="$(BuildPackage) == 'true'">
+ $(BuildDependsOn);
+ BuildPackage;
+ </BuildDependsOn>
+ </PropertyGroup>
+
+ <Target Name="CheckPrerequisites">
+ <!-- Raise an error if we're unable to locate nuget.exe -->
+ <Error Condition="!Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
+ </Target>
+
+ <Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
+ <Exec Command="$(RestoreCommand)"
+ Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
+
+ <Exec Command="$(RestoreCommand)"
+ LogStandardErrorAsError="true"
+ Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
+ </Target>
+
+ <Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
+ <Exec Command="$(BuildCommand)"
+ Condition=" '$(OS)' != 'Windows_NT' " />
+
+ <Exec Command="$(BuildCommand)"
+ LogStandardErrorAsError="true"
+ Condition=" '$(OS)' == 'Windows_NT' " />
+ </Target>
+</Project>
View
@@ -39,10 +39,6 @@
<Project>{D438C0B3-A168-40B8-BDDD-61F0939DFF35}</Project>
<Name>Enyim.Caching</Name>
</ProjectReference>
- <ProjectReference Include="..\Membase\Membase.csproj">
- <Project>{708A2350-A26C-444D-B975-8164263951A7}</Project>
- <Name>Membase</Name>
- </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
View
@@ -1,13 +1,8 @@
using System;
-using System.Collections.Generic;
-using System.Text;
-using Enyim.Caching;
-using Enyim.Caching.Memcached;
using System.Net;
+using Enyim.Caching;
using Enyim.Caching.Configuration;
-using Membase;
-using Membase.Configuration;
-using System.Threading;
+using Enyim.Caching.Memcached;
namespace DemoApp
{
@@ -12,6 +12,8 @@
<AssemblyName>Enyim.Caching.Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
+ <RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -31,7 +33,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
- <Reference Include="nunit.framework, Version=2.6.0.12051, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
+ <Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.0.12054\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
@@ -53,15 +55,16 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
- <ItemGroup>
<ProjectReference Include="..\Enyim.Caching\Enyim.Caching.csproj">
<Project>{D438C0B3-A168-40B8-BDDD-61F0939DFF35}</Project>
<Name>Enyim.Caching</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
@@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using NUnit.Framework;
+using Enyim.Caching.Memcached.Results.StatusCodes;
namespace Enyim.Caching.Tests
{
@@ -28,6 +29,7 @@ public void When_Getting_Item_For_Invalid_Key_HasValue_Is_False_And_Result_Is_No
var key = GetUniqueKey("get");
var getResult = _Client.ExecuteGet(key);
+ Assert.That(getResult.StatusCode, Is.EqualTo((int)StatusCodeEnums.NotFound), "Invalid status code");
GetAssertFail(getResult);
}
@@ -5,6 +5,7 @@
using NUnit.Framework;
using Enyim.Caching.Memcached;
using Enyim.Caching.Memcached.Results;
+using Enyim.Caching.Memcached.Results.StatusCodes;
namespace Enyim.Caching.Tests
{
@@ -36,6 +37,7 @@ public void When_Storing_Item_With_Existing_Key_And_StoreMode_Add_Result_Is_Not_
public void When_Storing_Item_With_New_Key_And_StoreMode_Replace_Result_Is_Not_Successful()
{
var result = Store(StoreMode.Replace);
+ Assert.That(result.StatusCode, Is.EqualTo((int)StatusCodeEnums.NotFound), "Invalid status code");
StoreAssertFail(result);
}
View
@@ -13,16 +13,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MemcachedTest", "MemcachedT
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoApp", "DemoApp\DemoApp.csproj", "{7225B6E0-A1FB-4F64-A5C5-1F640E21C90B}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Membase", "Membase\Membase.csproj", "{708A2350-A26C-444D-B975-8164263951A7}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "TestApp\TestApp.csproj", "{607B1927-A964-48B2-AEA3-6810D10A6831}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Enyim.Caching.Log4NetAdapter", "Enyim.Caching.Log4NetAdapter\Enyim.Caching.Log4NetAdapter.csproj", "{9D3F12E6-6BDD-4DED-8B25-D877780640B4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Enyim.Caching.NLogAdapter", "Enyim.Caching.NLogAdapter\Enyim.Caching.NLogAdapter.csproj", "{C96760B1-7CAD-4983-9FAD-EB00CD7A9FC6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Enyim.Caching.Tests", "Enyim.Caching.Tests\Enyim.Caching.Tests.csproj", "{5A048FA9-6025-4E06-B3CC-D6F2BEE7DA46}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{9E7035F9-BB9F-4B3C-9D6D-DF2D5BF4AA80}"
+ ProjectSection(SolutionItems) = preProject
+ .nuget\NuGet.exe = .nuget\NuGet.exe
+ .nuget\NuGet.targets = .nuget\NuGet.targets
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -39,13 +41,6 @@ Global
{7225B6E0-A1FB-4F64-A5C5-1F640E21C90B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7225B6E0-A1FB-4F64-A5C5-1F640E21C90B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7225B6E0-A1FB-4F64-A5C5-1F640E21C90B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {708A2350-A26C-444D-B975-8164263951A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {708A2350-A26C-444D-B975-8164263951A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {708A2350-A26C-444D-B975-8164263951A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {708A2350-A26C-444D-B975-8164263951A7}.Release|Any CPU.Build.0 = Release|Any CPU
- {607B1927-A964-48B2-AEA3-6810D10A6831}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {607B1927-A964-48B2-AEA3-6810D10A6831}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {607B1927-A964-48B2-AEA3-6810D10A6831}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9D3F12E6-6BDD-4DED-8B25-D877780640B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9D3F12E6-6BDD-4DED-8B25-D877780640B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9D3F12E6-6BDD-4DED-8B25-D877780640B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -273,6 +273,8 @@
<Compile Include="Memcached\Results\IStoreOperationResult.cs" />
<Compile Include="Memcached\Results\MutateOperationResult.cs" />
<Compile Include="Memcached\Results\OperationResultBase.cs" />
+ <Compile Include="Memcached\Results\StatusCodes\StatusCodeEnums.cs" />
+ <Compile Include="Memcached\Results\StatusCodes\StatusCodeMessages.cs" />
<Compile Include="Memcached\Results\StoreOperationResult.cs" />
<Compile Include="Memcached\Results\TextOperationResult.cs" />
<Compile Include="Memcached\ServerStats.cs">
@@ -529,8 +529,7 @@ protected virtual IPooledSocketResult ExecuteOperation(IOperation op)
}
else
{
- result.InnerResult = readResult;
- result.Fail("Failed to read response, see inner result for details");
+ readResult.Combine(result);
}
return result;
}
@@ -37,7 +37,7 @@ protected internal override IOperationResult ReadResponse(PooledSocket socket)
if (! (responseResult = this.ProcessResponse(response)).Success)
{
result.InnerResult = responseResult;
- result.Fail("Failed to process response, see StatusCode or InnerResult for details");
+ responseResult.Combine(result);
}
return result;
@@ -38,7 +38,7 @@ protected override IOperationResult ProcessResponse(BinaryResponse response)
}
else
{
- var message = ResultHelper.ProcessResponseData("Delete failed for key " + Key, response.Data);
+ var message = ResultHelper.ProcessResponseData(response.Data);
return result.Fail(message);
}
}
@@ -52,7 +52,7 @@ protected override IOperationResult ProcessResponse(BinaryResponse response)
log.DebugFormat("Get failed for key '{0}'. Reason: {1}", this.Key, Encoding.ASCII.GetString(response.Data.Array, response.Data.Offset, response.Data.Count));
#endif
- var message = ResultHelper.ProcessResponseData("Get failed for key " + Key, response.Data);
+ var message = ResultHelper.ProcessResponseData(response.Data);
return result.Fail(message);
}
@@ -69,7 +69,7 @@ protected override IOperationResult ProcessResponse(BinaryResponse response)
return result.Pass();
}
- var message = ResultHelper.ProcessResponseData("Mutate failed for key " + Key, response.Data);
+ var message = ResultHelper.ProcessResponseData(response.Data);
return result.Fail(message);
}
@@ -69,7 +69,7 @@ protected override IOperationResult ProcessResponse(BinaryResponse response)
}
else
{
- var message = ResultHelper.ProcessResponseData("Store failed for key " + Key, response.Data);
+ var message = ResultHelper.ProcessResponseData(response.Data);
return result.Fail(message);
}
}
@@ -57,6 +57,19 @@ public static IOperationResult PassOrFail(this IOperationResult source, bool suc
{
return success ? Pass(source) : Fail(source, message, ex);
}
+
+ /// <summary>
+ /// Combine will attempt to minimize the depth of InnerResults and maintain status codes
+ /// </summary>
+ /// <param name="target"></param>
+ public static void Combine(this IOperationResult source, IOperationResult target)
+ {
+ target.Message = source.Message;
+ target.Success = source.Success;
+ target.Exception = source.Exception;
+ target.StatusCode = source.StatusCode ?? target.StatusCode;
+ target.InnerResult = source.InnerResult ?? source;
+ }
}
}
@@ -10,14 +10,16 @@ namespace Enyim.Caching.Memcached.Results.Helpers
public static class ResultHelper
{
- public static string ProcessResponseData(string message, ArraySegment<byte> data)
+ public static string ProcessResponseData(ArraySegment<byte> data, string message = "")
{
if (data != null && data.Count > 0)
{
try
{
- return message + ": " + Encoding.ASCII.GetString(data.Array, data.Offset, data.Count);
+ return message +
+ (! string.IsNullOrEmpty(message) ? ": " : "") +
+ Encoding.ASCII.GetString(data.Array, data.Offset, data.Count);
}
catch (Exception ex)
{
@@ -1,21 +1,23 @@
using System;
using System.Collections.Generic;
-using System.Net;
-using Enyim.Caching.Configuration;
-using Enyim.Caching.Memcached;
+using System.Linq;
+using System.Text;
-namespace Membase.Configuration
+namespace Enyim.Caching.Memcached.Results.StatusCodes
{
- public interface IMembasePerformanceMonitorFactory: IProvider
+ public enum StatusCodeEnums
{
- IPerformanceMonitor Create(string bucket);
+ Success = 0,
+ NotFound
}
}
#region [ License information ]
/* ************************************************************
*
- * Copyright (c) 2010 Attila Kiskó, enyim.com
+ * @author Couchbase <info@couchbase.com>
+ * @copyright 2012 Couchbase, Inc.
+ * @copyright 2012 Attila Kiskó, enyim.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,4 +32,4 @@ public interface IMembasePerformanceMonitorFactory: IProvider
* limitations under the License.
*
* ************************************************************/
-#endregion
+#endregion
@@ -3,26 +3,20 @@
using System.Linq;
using System.Text;
-namespace Membase.Configuration
+namespace Enyim.Caching.Memcached.Results.StatusCodes
{
- public enum BucketPortType
+ public static class StatusCodeMessages
{
- /// <summary>
- /// Connect to the nodes using moxy
- /// </summary>
- Proxy,
-
- /// <summary>
- /// Connect to the nodes directly using the Memcached port
- /// </summary>
- Direct
+ public const string NOT_FOUND = "Not found";
}
}
#region [ License information ]
/* ************************************************************
*
- * Copyright (c) 2010 Attila Kiskó, enyim.com
+ * @author Couchbase <info@couchbase.com>
+ * @copyright 2012 Couchbase, Inc.
+ * @copyright 2012 Attila Kiskó, enyim.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -174,7 +174,7 @@ public IGetOperationResult<T> ExecuteGet<T>(string key)
}
return result;
}
- result.Fail("Get failed. See InnerException or StatusCode for details");
+ tryGetResult.Combine(result);
return result;
}
Oops, something went wrong.

0 comments on commit d3e8d65

Please sign in to comment.