Ejemplo n.º 1
0
        public void BarrierCollectionOpensAllContainedBarriersWhenOpened()
        {
            var bc         = new BarrierCollection(false, Tangle, Tangle);
            var fOperation = Tangle.Add(1, 1);

            Scheduler.WaitFor(bc);
            Assert.IsFalse(fOperation.Completed);
            bc.Open();
            Scheduler.WaitFor(fOperation);
            Assert.AreEqual(1, Tangle.Count);
        }
Ejemplo n.º 2
0
        public IEnumerator <object> Move(string targetFilename, ActivityIndicator activities)
        {
            // Wait for any pending operations running against the tangles
            var cb = new BarrierCollection(true, Tangles);

            using (activities.AddItem("Waiting for database to be idle"))
                yield return(cb);

            foreach (var tangle in Tangles)
            {
                tangle.Dispose();
            }

            Tangles.Clear();

            var f = Future.RunInThread(() => {
                File.Delete(_TokenFilePath);

                if (File.Exists(targetFilename))
                {
                    File.Delete(targetFilename);
                }

                Storage.Folder = targetFilename;

                MakeTokenFile(targetFilename);

                _Filename = targetFilename;
            });

            using (activities.AddItem("Moving database"))
                yield return(f);

            var failed = f.Failed;

            yield return(CreateTangles());

            if (failed)
                throw f.Error; }
Ejemplo n.º 3
0
        public IEnumerator<object> Move(string targetFilename, ActivityIndicator activities)
        {
            // Wait for any pending operations running against the tangles
            var cb = new BarrierCollection(true, Tangles);
            using (activities.AddItem("Waiting for database to be idle"))
                yield return cb;

            foreach (var tangle in Tangles)
                tangle.Dispose();

            Tangles.Clear();

            var f = Future.RunInThread(() => {
                File.Delete(_TokenFilePath);

                if (File.Exists(targetFilename))
                    File.Delete(targetFilename);

                Storage.Folder = targetFilename;

                MakeTokenFile(targetFilename);

                _Filename = targetFilename;
            });

            using (activities.AddItem("Moving database"))
                yield return f;

            var failed = f.Failed;

            yield return CreateTangles();

            if (failed)
                throw f.Error;
        }
Ejemplo n.º 4
0
        public void BarrierCollectionOpensAllContainedBarriersWhenOpened()
        {
            var bc = new BarrierCollection(false, Tangle, Tangle);
            var fOperation = Tangle.Add(1, 1);

            Scheduler.WaitFor(bc);
            Assert.IsFalse(fOperation.Completed);
            bc.Open();
            Scheduler.WaitFor(fOperation);
            Assert.AreEqual(1, Tangle.Count);
        }