mirror of https://github.com/Squidex/squidex.git
4 changed files with 65 additions and 41 deletions
@ -1,29 +0,0 @@ |
|||||
// ==========================================================================
|
|
||||
// AzureStorageException.cs
|
|
||||
// Squidex Headless CMS
|
|
||||
// ==========================================================================
|
|
||||
// Copyright (c) Squidex Group
|
|
||||
// All rights reserved.
|
|
||||
// ==========================================================================
|
|
||||
|
|
||||
using System; |
|
||||
using Microsoft.WindowsAzure.Storage; |
|
||||
|
|
||||
namespace Squidex.Infrastructure.Azure.Storage |
|
||||
{ |
|
||||
[Serializable] |
|
||||
public class AzureStorageException : StorageException |
|
||||
{ |
|
||||
public AzureStorageException() |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
public AzureStorageException(string message) : base(message) |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
public AzureStorageException(string message, Exception inner) : base(message, inner) |
|
||||
{ |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,55 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Squidex.Infrastructure.CQRS.Events; |
||||
|
using StackExchange.Redis; |
||||
|
|
||||
|
namespace Squidex.Infrastructure.Redis.EventStore |
||||
|
{ |
||||
|
public class RedisEventStore : IEventStore, IExternalSystem |
||||
|
{ |
||||
|
private readonly Lazy<IConnectionMultiplexer> redisClient; |
||||
|
|
||||
|
public RedisEventStore(Lazy<IConnectionMultiplexer> redis) |
||||
|
{ |
||||
|
this.redisClient = redis; |
||||
|
} |
||||
|
|
||||
|
public Task<IReadOnlyList<StoredEvent>> GetEventsAsync(string streamName) |
||||
|
{ |
||||
|
var db = redisClient.Value.GetDatabase(); |
||||
|
|
||||
|
|
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
|
||||
|
public Task AppendEventsAsync(Guid commitId, string streamName, int expectedVersion, ICollection<EventData> events) |
||||
|
{ |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
|
||||
|
public IEventSubscription CreateSubscription(string streamFilter = null, string position = null) |
||||
|
{ |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
|
||||
|
public void Connect() |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
redisClient.Value.GetStatus(); |
||||
|
|
||||
|
var db = redisClient.Value.GetDatabase(); |
||||
|
if (!db.HashExists("SquidexEventStore", 0)) |
||||
|
{ |
||||
|
db.HashSet("SquidexEventStore", new[] { new HashEntry(0, "{event data}") }); |
||||
|
} |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw new ConfigurationException($"Redis connection failed to connect to database {redisClient.Value.Configuration}", ex); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue