public FileEventStoreManager(string rootDirectory) { if (null == rootDirectory) { throw new ArgumentNullException("rootDirectory"); } _rootDirectory = rootDirectory; if (!Directory.Exists(rootDirectory)) { Directory.CreateDirectory(rootDirectory); } var info = new DirectoryInfo(rootDirectory); foreach (var child in info.GetDirectories()) { if (EventStoreId.IsValid(child.Name) != EventStoreId.Rule.Valid) { Log.Info("Skipping invalid folder {0} (invalid name)", child.Name); continue; } var container = EventStoreId.Parse(child.Name); if (FileEventStore.ExistsValid(rootDirectory, container)) { var writer = FileEventStore.OpenExistingForWriting(rootDirectory, container); _stores.Add(container.Name, writer); } else { Log.Info("Skipping invalid folder {0} (can't open)", child.Name); } } }
public static bool TryGetContainerName ( AzureStoreConfiguration config, CloudBlobDirectory dir, out EventStoreId container) { var topic = dir.Uri.ToString().Remove(0, dir.Container.Uri.ToString().Length).Trim('/'); container = null; if (EventStoreId.IsValid(topic) != EventStoreId.Rule.Valid) { return(false); } container = EventStoreId.Parse(topic); return(IsValid(config, container)); }
public bool Execute(CommandProcessorContext context, CancellationToken token, string[] args) { if (args.Length != 1) { context.Log.Error("Container name expected"); return(false); } var isValid = EventStoreId.IsValid(args[0]); if (isValid != EventStoreId.Rule.Valid) { context.Log.Error("Container name is invalid: {0}", isValid); return(false); } context.Log.Info("Switching to container '{0}'", args[0]); context.Client.UseEventStore(args[0]); return(true); }
void Should(EventStoreId.Rule validity, string asdAsd) { Assert.AreEqual(validity, EventStoreId.IsValid(asdAsd), asdAsd); }