Exemple #1
0
        public static FileTapeContainer CreateTape(this FileStorageConfig config)
        {
            var factory = new FileTapeContainer(config.FullPath);

            factory.InitializeForWriting();
            return(factory);
        }
        public static FileAppendOnlyStore CreateAppendOnlyStore(this FileStorageConfig cfg, string name)
        {
            var store = new FileAppendOnlyStore(new DirectoryInfo(Path.Combine(cfg.FullPath, name)));

            store.Initialize();
            return(store);
        }
Exemple #3
0
        public static IStreamingRoot CreateStreaming(this FileStorageConfig config)
        {
            var path      = config.FullPath;
            var container = new FileStreamingContainer(path);

            container.Create();
            return(container);
        }
Exemple #4
0
        public static FileTapeStorageFactory CreateTape(this FileStorageConfig config, string subfolder = "tapes")
        {
            var path    = Path.Combine(config.FullPath, subfolder);
            var factory = new FileTapeStorageFactory(path);

            factory.InitializeForWriting();
            return(factory);
        }
Exemple #5
0
        public static NuclearStorage CreateNuclear(this FileStorageConfig self, Action <DefaultAtomicStorageStrategyBuilder> config)
        {
            var strategyBuilder = new DefaultAtomicStorageStrategyBuilder();

            config(strategyBuilder);
            var strategy = strategyBuilder.Build();

            return(CreateNuclear(self, strategy));
        }
 static Action<ImmutableEnvelope> BuildRouter(FileStorageConfig storage, IEnvelopeStreamer streamer)
 {
     return envelope =>
         {
             var target = (envelope.DeliverOnUtc < DateTime.UtcNow ? "process" : "timer");
             Console.WriteLine("Routed to " + target);
             storage.CreateQueueWriter(target).PutMessage(streamer.SaveEnvelopeData(envelope));
         };
 }
Exemple #7
0
        public static FilePartitionInbox CreateInbox(this FileStorageConfig cfg, string name, Func <uint, TimeSpan> decay = null)
        {
            var reader = new StatelessFileQueueReader(Path.Combine(cfg.FullPath, name), name);

            var waiter = decay ?? DecayEvil.BuildExponentialDecay(250);
            var inbox  = new FilePartitionInbox(new[] { reader, }, waiter);

            inbox.Init();
            return(inbox);
        }
Exemple #8
0
 public static FileStorageConfig CreateConfig(string fullPath, string optionalName = null, bool reset = false)
 {
     var folder = new DirectoryInfo(fullPath);
     var config = new FileStorageConfig(folder, optionalName ?? folder.Name);
     if (reset)
     {
         config.Reset();
     }
     return config;
 }
Exemple #9
0
        public static FileQueueWriter CreateQueueWriter(this FileStorageConfig cfg, string queueName)
        {
            var full = Path.Combine(cfg.Folder.FullName, queueName);

            if (!Directory.Exists(full))
            {
                Directory.CreateDirectory(full);
            }
            return
                (new FileQueueWriter(new DirectoryInfo(full), queueName));
        }
Exemple #10
0
        public static FileStorageConfig CreateConfig(string fullPath, string optionalName = null, bool reset = false)
        {
            var folder = new DirectoryInfo(fullPath);
            var config = new FileStorageConfig(folder, optionalName ?? folder.Name);

            if (reset)
            {
                config.Reset();
            }
            return(config);
        }
 public void Setup()
 {
     var tmpPath = Path.GetTempPath();
     _configPath = Path.Combine(tmpPath, "lokad-cqrs-test", Guid.NewGuid().ToString());
     _config = new FileStorageConfig(new DirectoryInfo(_configPath), "testaccount");
 }
Exemple #12
0
 static Bootstrapper()
 {
     var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "app_data");
     var storageDirectory = new DirectoryInfo(path);
     storageConfig = new FileStorageConfig(storageDirectory, "simplecqrs");
 }
Exemple #13
0
        public static NuclearStorage CreateNuclear(this FileStorageConfig config, IDocumentStrategy strategy)
        {
            var factory = new FileDocumentStore(config.FullPath, strategy);

            return(new NuclearStorage(factory));
        }
Exemple #14
0
 public static IStreamingContainer CreateStreaming(this FileStorageConfig config, string subfolder)
 {
     return(config.CreateStreaming(subfolder).Create());
 }
Exemple #15
0
 public static NuclearStorage CreateNuclear(this FileStorageConfig config)
 {
     return(CreateNuclear(config, builder => { }));
 }
Exemple #16
0
 public static IDocumentStore CreateDocumentStore(this FileStorageConfig config, IDocumentStrategy strategy)
 {
     return(new FileDocumentStore(config.FullPath, strategy));
 }
Exemple #17
0
        public static NuclearStorage CreateNuclear(this FileStorageConfig config, IAtomicStorageStrategy strategy)
        {
            var factory = new FileAtomicStorageFactory(config.FullPath, strategy);

            return(new NuclearStorage(factory));
        }
Exemple #18
0
 public static SimpleMessageSender CreateSimpleSender(this FileStorageConfig account, IEnvelopeStreamer streamer, string queueName)
 {
     return(new SimpleMessageSender(streamer, CreateQueueWriter(account, queueName)));
 }
Exemple #19
0
 public static FileTapeContainer CreateTape(this FileStorageConfig config, string subfolder)
 {
     return(CreateTape(config.SubFolder(subfolder)));
 }