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

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

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

            container.Create();
            return(container);
        }
예제 #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);
        }
예제 #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));
         };
 }
예제 #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);
        }
예제 #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;
 }
예제 #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));
        }
예제 #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");
 }
예제 #12
0
파일: Bootstrapper.cs 프로젝트: trbngr/m-r
 static Bootstrapper()
 {
     var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "app_data");
     var storageDirectory = new DirectoryInfo(path);
     storageConfig = new FileStorageConfig(storageDirectory, "simplecqrs");
 }
예제 #13
0
        public static NuclearStorage CreateNuclear(this FileStorageConfig config, IDocumentStrategy strategy)
        {
            var factory = new FileDocumentStore(config.FullPath, strategy);

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

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