Skip to content

Commit

Permalink
Changed the Operations namespace to Protocol. Also made all op classe…
Browse files Browse the repository at this point in the history
…s public to allow extensibility.
  • Loading branch information
enyim committed Aug 11, 2010
1 parent 10234b9 commit acea69b
Show file tree
Hide file tree
Showing 44 changed files with 156 additions and 171 deletions.
4 changes: 2 additions & 2 deletions Enyim.Caching/Configuration/MemcachedClientConfiguration.cs
Expand Up @@ -3,7 +3,7 @@
using System.Net;
using Enyim.Caching.Memcached;
using Enyim.Reflection;
using Enyim.Caching.Memcached.Operations.Binary;
using Enyim.Caching.Memcached.Protocol.Binary;

namespace Enyim.Caching.Configuration
{
Expand Down Expand Up @@ -112,7 +112,7 @@ IServerPool IMemcachedClientConfiguration.CreatePool()
{
switch (this.Protocol)
{
case MemcachedProtocol.Text: return new DefaultServerPool(this, new Memcached.Operations.Text.TextOperationFactory());
case MemcachedProtocol.Text: return new DefaultServerPool(this, new Memcached.Protocol.Text.TextOperationFactory());
case MemcachedProtocol.Binary: return new BinaryPool(this);
}

Expand Down
4 changes: 2 additions & 2 deletions Enyim.Caching/Configuration/MemcachedClientSection.cs
Expand Up @@ -131,8 +131,8 @@ IServerPool IMemcachedClientConfiguration.CreatePool()
{
switch (this.Protocol)
{
case MemcachedProtocol.Text: return new DefaultServerPool(this, new Memcached.Operations.Text.TextOperationFactory());
case MemcachedProtocol.Binary: return new Enyim.Caching.Memcached.Operations.Binary.BinaryPool(this);
case MemcachedProtocol.Text: return new DefaultServerPool(this, new Memcached.Protocol.Text.TextOperationFactory());
case MemcachedProtocol.Binary: return new Enyim.Caching.Memcached.Protocol.Binary.BinaryPool(this);
}

throw new ArgumentOutOfRangeException("Unknown protocol: " + (int)this.Protocol);
Expand Down
2 changes: 1 addition & 1 deletion Enyim.Caching/Configuration/ProviderElement.cs
Expand Up @@ -83,7 +83,7 @@ public T CreateInstance()
if (type == null)
return null;

return (T)FastActivator2.Create(type);
return (T)FastActivator.Create(type);
}

return factoryInstance.Create();
Expand Down
65 changes: 33 additions & 32 deletions Enyim.Caching/Enyim.Caching.csproj
Expand Up @@ -99,40 +99,41 @@
<Compile Include="Memcached\Authentication\PlainTextAuthenticator.cs" />
<Compile Include="Memcached\IOperationFactory.cs" />
<Compile Include="Memcached\OperationInterfaces.cs" />
<Compile Include="Memcached\Operations\Binary\BinaryOperationFactory.cs" />
<Compile Include="Memcached\Operations\Binary\BinaryNode.cs" />
<Compile Include="Memcached\Operations\Binary\BinaryPool.cs" />
<Compile Include="Memcached\Operations\Binary\SaslContinue.cs" />
<Compile Include="Memcached\Operations\Binary\SaslStart.cs" />
<Compile Include="Memcached\Operations\MultiItemOperation.cs" />
<Compile Include="Memcached\Operations\Text\TextOperationFactory.cs" />
<Compile Include="Memcached\Operations\Text\ConcateOperation.cs" />
<Compile Include="Memcached\Operations\Text\StoreOperationBase.cs" />
<Compile Include="Memcached\Operations\Text\MutatorOperation.cs">
<Compile Include="Memcached\Protocol\Binary\BinaryOperationFactory.cs" />
<Compile Include="Memcached\Protocol\Binary\BinaryNode.cs" />
<Compile Include="Memcached\Protocol\Binary\BinaryPool.cs" />
<Compile Include="Memcached\Protocol\Binary\SaslStep.cs" />
<Compile Include="Memcached\Protocol\Binary\SaslContinue.cs" />
<Compile Include="Memcached\Protocol\Binary\SaslStart.cs" />
<Compile Include="Memcached\Protocol\MultiItemOperation.cs" />
<Compile Include="Memcached\Protocol\Text\TextOperationFactory.cs" />
<Compile Include="Memcached\Protocol\Text\ConcateOperation.cs" />
<Compile Include="Memcached\Protocol\Text\StoreOperationBase.cs" />
<Compile Include="Memcached\Protocol\Text\MutatorOperation.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Memcached\Operations\Text\DeleteOperation.cs">
<Compile Include="Memcached\Protocol\Text\DeleteOperation.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Memcached\Operations\Text\FlushOperation.cs">
<Compile Include="Memcached\Protocol\Text\FlushOperation.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Memcached\Operations\Text\GetHelper.cs">
<Compile Include="Memcached\Protocol\Text\GetHelper.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Memcached\Operations\Text\GetOperation.cs">
<Compile Include="Memcached\Protocol\Text\GetOperation.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Memcached\Operations\Text\MultiGetOperation.cs">
<Compile Include="Memcached\Protocol\Text\MultiGetOperation.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Memcached\Operations\Text\StatsOperation.cs">
<Compile Include="Memcached\Protocol\Text\StatsOperation.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Memcached\Operations\Text\StoreOperation.cs">
<Compile Include="Memcached\Protocol\Text\StoreOperation.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Memcached\Operations\Text\TextSocketHelper.cs">
<Compile Include="Memcached\Protocol\Text\TextSocketHelper.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Memcached\Locators\VBucketNodeLocatorFactory.cs" />
Expand All @@ -144,10 +145,10 @@
<Compile Include="Memcached\ISaslAuthenticationProvider.cs" />
<Compile Include="Memcached\Enums.cs" />
<Compile Include="Memcached\Locators\KetamaNodeLocator.cs" />
<Compile Include="Memcached\Operations\Binary\ConcatOperation.cs" />
<Compile Include="Memcached\Operations\Binary\MultiGetOperation.cs" />
<Compile Include="Memcached\Operations\Binary\FlushOperation.cs" />
<Compile Include="Memcached\Operations\Binary\StatsOperation.cs" />
<Compile Include="Memcached\Protocol\Binary\ConcatOperation.cs" />
<Compile Include="Memcached\Protocol\Binary\MultiGetOperation.cs" />
<Compile Include="Memcached\Protocol\Binary\FlushOperation.cs" />
<Compile Include="Memcached\Protocol\Binary\StatsOperation.cs" />
<Compile Include="HashCodeCombiner.cs" />
<Compile Include="InterlockedQueue.cs" />
<Compile Include="Memcached\CommandNotSupportedException.cs" />
Expand All @@ -160,16 +161,16 @@
<Compile Include="Memcached\KeyTransformers\SHA1KeyTransformer.cs" />
<Compile Include="Memcached\KeyTransformers\TigerHashKeyTransformer.cs" />
<Compile Include="Memcached\MemcachedNode.cs" />
<Compile Include="Memcached\Operations\Binary\BinaryRequest.cs" />
<Compile Include="Memcached\Operations\Binary\BinaryResponse.cs" />
<Compile Include="Memcached\Operations\Binary\BinaryConverter.cs" />
<Compile Include="Memcached\Operations\Binary\MutatorOperation.cs" />
<Compile Include="Memcached\Operations\Binary\DeleteOperation.cs" />
<Compile Include="Memcached\Operations\Binary\GetOperation.cs" />
<Compile Include="Memcached\Operations\Binary\OpCode.cs" />
<Compile Include="Memcached\Operations\Binary\StoreOperation.cs" />
<Compile Include="Memcached\Operations\ItemOperation.cs" />
<Compile Include="Memcached\Operations\Operation.cs" />
<Compile Include="Memcached\Protocol\Binary\BinaryRequest.cs" />
<Compile Include="Memcached\Protocol\Binary\BinaryResponse.cs" />
<Compile Include="Memcached\Protocol\Binary\BinaryConverter.cs" />
<Compile Include="Memcached\Protocol\Binary\MutatorOperation.cs" />
<Compile Include="Memcached\Protocol\Binary\DeleteOperation.cs" />
<Compile Include="Memcached\Protocol\Binary\GetOperation.cs" />
<Compile Include="Memcached\Protocol\Binary\OpCode.cs" />
<Compile Include="Memcached\Protocol\Binary\StoreOperation.cs" />
<Compile Include="Memcached\Protocol\ItemOperation.cs" />
<Compile Include="Memcached\Protocol\Operation.cs" />
<Compile Include="Memcached\Locators\SingleNodeLocator.cs" />
<Compile Include="Memcached\StatItem.cs" />
<Compile Include="Memcached\Transcoders\DefaultTranscoder.cs" />
Expand Down
2 changes: 1 addition & 1 deletion Enyim.Caching/FastActivator.cs
Expand Up @@ -13,7 +13,7 @@ namespace Enyim.Reflection
/// <para>Implements a very fast object factory for dynamic object creation. Dynamically generates a factory class which will use the new() constructor of the requested type.</para>
/// <para>Much faster than using Activator at the price of the first invocation being significantly slower than subsequent calls.</para>
/// </summary>
public static class FastActivator2
public static class FastActivator
{
private static Dictionary<Type, Func<object>> factoryCache = new Dictionary<Type, Func<object>>();

Expand Down
2 changes: 1 addition & 1 deletion Enyim.Caching/Memcached/IMemcachedNode.cs
@@ -1,7 +1,7 @@
using System;
using System.Net;
using System.Collections.Generic;
using Enyim.Caching.Memcached.Operations;
using Enyim.Caching.Memcached.Protocol;

namespace Enyim.Caching.Memcached
{
Expand Down
2 changes: 1 addition & 1 deletion Enyim.Caching/Memcached/IOperationFactory.cs
@@ -1,7 +1,7 @@
using System;
using System.Net;
using System.Collections.Generic;
using Enyim.Caching.Memcached.Operations;
using Enyim.Caching.Memcached.Protocol;

namespace Enyim.Caching.Memcached
{
Expand Down
42 changes: 0 additions & 42 deletions Enyim.Caching/Memcached/IProtocolImplementation.cs

This file was deleted.

2 changes: 1 addition & 1 deletion Enyim.Caching/Memcached/MemcachedNode.cs
Expand Up @@ -6,7 +6,7 @@
using Enyim.Caching.Configuration;
using Enyim.Collections;
using System.Security;
using Enyim.Caching.Memcached.Operations.Binary;
using Enyim.Caching.Memcached.Protocol.Binary;

namespace Enyim.Caching.Memcached
{
Expand Down
2 changes: 1 addition & 1 deletion Enyim.Caching/Memcached/OperationInterfaces.cs
@@ -1,7 +1,7 @@
using System;
using System.Net;
using System.Collections.Generic;
using Enyim.Caching.Memcached.Operations;
using Enyim.Caching.Memcached.Protocol;

namespace Enyim.Caching.Memcached
{
Expand Down
@@ -1,7 +1,7 @@
using System;
using System.Text;

namespace Enyim.Caching.Memcached.Operations.Binary
namespace Enyim.Caching.Memcached.Protocol.Binary
{
internal static class BinaryConverter
{
Expand Down
Expand Up @@ -7,7 +7,7 @@
using Enyim.Collections;
using System.Security;

namespace Enyim.Caching.Memcached.Operations.Binary
namespace Enyim.Caching.Memcached.Protocol.Binary
{
/// <summary>
/// A node which is used by the BinaryPool. It implements the binary protocol's SASL auth. mechanism.
Expand Down
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;

namespace Enyim.Caching.Memcached.Operations.Binary
namespace Enyim.Caching.Memcached.Protocol.Binary
{
/// <summary>
/// Memcached client.
Expand Down
Expand Up @@ -7,7 +7,7 @@
using Enyim.Collections;
using System.Security;

namespace Enyim.Caching.Memcached.Operations.Binary
namespace Enyim.Caching.Memcached.Protocol.Binary
{
/// <summary>
/// Server pool implementing the binary protocol.
Expand Down Expand Up @@ -37,7 +37,7 @@ private static ISaslAuthenticationProvider GetProvider(IMemcachedClientConfigura
if (auth != null)
{
Type t = auth.Type;
var provider = (t == null) ? null : Enyim.Reflection.FastActivator2.Create(t) as ISaslAuthenticationProvider;
var provider = (t == null) ? null : Enyim.Reflection.FastActivator.Create(t) as ISaslAuthenticationProvider;

if (provider != null)
{
Expand Down
Expand Up @@ -3,7 +3,7 @@
using System.Text;
using System.Threading;

namespace Enyim.Caching.Memcached.Operations.Binary
namespace Enyim.Caching.Memcached.Protocol.Binary
{
internal class BinaryRequest
{
Expand Down
@@ -1,7 +1,7 @@
using System;
using System.Text;

namespace Enyim.Caching.Memcached.Operations.Binary
namespace Enyim.Caching.Memcached.Protocol.Binary
{
internal class BinaryResponse
{
Expand Down
Expand Up @@ -2,12 +2,12 @@
using System.Collections.Generic;
using System.Text;

namespace Enyim.Caching.Memcached.Operations.Binary
namespace Enyim.Caching.Memcached.Protocol.Binary
{
/// <summary>
/// Implements append/prepend.
/// </summary>
internal class ConcatOperation : ItemOperation, IConcatOperation
public class ConcatOperation : SingleItemOperation, IConcatOperation
{
private ArraySegment<byte> data;
private ConcatenationMode mode;
Expand Down
@@ -1,8 +1,8 @@
using System.Collections.Generic;

namespace Enyim.Caching.Memcached.Operations.Binary
namespace Enyim.Caching.Memcached.Protocol.Binary
{
internal class DeleteOperation : ItemOperation, IDeleteOperation
public class DeleteOperation : SingleItemOperation, IDeleteOperation
{
public DeleteOperation(string key) : base(key) { }

Expand Down
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;

namespace Enyim.Caching.Memcached.Operations.Binary
namespace Enyim.Caching.Memcached.Protocol.Binary
{
internal class FlushOperation : Operation, IFlushOperation
public class FlushOperation : Operation, IFlushOperation
{
public FlushOperation() { }

Expand Down
@@ -1,8 +1,8 @@
using System.Collections.Generic;

namespace Enyim.Caching.Memcached.Operations.Binary
namespace Enyim.Caching.Memcached.Protocol.Binary
{
internal class GetOperation : ItemOperation, IGetOperation
public class GetOperation : SingleItemOperation, IGetOperation
{
private CacheItem result;

Expand Down
Expand Up @@ -2,9 +2,9 @@
using System.Linq;
using System.Collections.Generic;

namespace Enyim.Caching.Memcached.Operations.Binary
namespace Enyim.Caching.Memcached.Protocol.Binary
{
internal class MultiGetOperation : MultiItemOperation, IMultiGetOperation
public class MultiGetOperation : MultiItemOperation, IMultiGetOperation
{
private static log4net.ILog log = log4net.LogManager.GetLogger(typeof(MultiGetOperation));

Expand Down
@@ -1,8 +1,8 @@
using System;

namespace Enyim.Caching.Memcached.Operations.Binary
namespace Enyim.Caching.Memcached.Protocol.Binary
{
internal class MutatorOperation : ItemOperation, IMutatorOperation
public class MutatorOperation : SingleItemOperation, IMutatorOperation
{
private ulong defaultValue;
private ulong delta;
Expand Down
@@ -1,5 +1,5 @@

namespace Enyim.Caching.Memcached.Operations.Binary
namespace Enyim.Caching.Memcached.Protocol.Binary
{
internal enum OpCode : byte
{
Expand Down Expand Up @@ -29,7 +29,7 @@ internal enum OpCode : byte
QuitQ = 0x17,
FlushQ = 0x18,
AppendQ = 0x19,
PrependQ = 0x1A,
PrependQ = 0x1A,

// SASL authentication op-codes
SaslList = 0x20,
Expand Down

0 comments on commit acea69b

Please sign in to comment.