Example #1
0
        public static void Default()
        {
            var verify = new ThreadedQueueProcessorParameters
            {
                PreservePartitioning = true,
                MinThreads           = 4,
                MaxThreads           = 8,
                MaxThreadsPerClient  = null,
                BoostBarrier         = 4
            };

            var send = new ThreadedQueueProcessorParameters
            {
                MinThreads           = 4,
                MaxThreads           = 100,
                MaxThreadsPerClient  = 2,
                BoostBarrier         = 2,
                PreservePartitioning = true
            };

            var unzip = new ThreadedQueueProcessorParameters
            {
                MinThreads           = 4,
                MaxThreads           = 8,
                MaxThreadsPerClient  = 1,
                BoostBarrier         = 4,
                PreservePartitioning = true
            };

            var perms = new Dictionary <string, DfsPermissions>
            {
                { "Realm", DfsPermissions.All },
                { "Shard", DfsPermissions.Shard }
            };

            Dfs = new DfsServerConfiguration
            {
                WebServerUrl        = "http://localhost:52357",
                Port                = 0xAceF,
                Path                = "E:\\Ace-Dfs-Store\\",
                ShareSaveInterval   = 30_000,
                PingInterval        = 10_000,
                FileTransferTimeout = 60_000,
                SendQueue           = send,
                VerifyQueue         = verify,
                UnzipQueue          = unzip,
                RolePermissions     = perms
            };
            Dfs.ExternalWebServerUrl = Dfs.WebServerUrl;
        }
Example #2
0
            internal static void Test(ThreadedQueueProcessorParameters args, int count, int size, int delayMin = 50, int delayMax = 120)
            {
                var counters = new int[count];
                var p        = Get(args, counters);

                p.Initialize();
                var tasks = new List <Task>();

                for (int i = 0; i < count; i++)
                {
                    tasks.Add(Task.Factory.StartNew((a) => Pipe(p, (int)a, size, delayMin, delayMax), i));
                }
                Task.WaitAll(tasks.ToArray());
                while (p.Pending != 0)
                {
                    Console.WriteLine($"Pending {p.Pending}, {p.Threads}T");
                    Thread.Sleep(50);
                }
                for (int i = 0; i < count; i++)
                {
                    Debug.Assert(counters[i] == size);
                }
                Console.WriteLine("OK");
            }
Example #3
0
 internal static ThreadedQueueProcessor <DummyWorkItem> Get(ThreadedQueueProcessorParameters args, int[] counters)
 {
     return(new ThreadedQueueProcessor <DummyWorkItem>(args, new DummyWorker(counters)));
 }