Exemple #1
0
        public bool DeleteRule(SnapshotRule rule, bool deleteSnapshots)
        {
            rule.Enabled = false;

            if (deleteSnapshots)
            {
                using (var vss = new VssClient(new VssHost()))
                {
                    vss.Initialize(VssSnapshotContext.All, VssBackupType.Incremental);
                    PruningMgr.Instance.DeleteAllForRule(vss, rule);
                }
            }

            bool ret = RulesMap.TryRemove(rule.Id, out SnapshotRule value);

            if (!ret)
            {
                return(false);
            }

            VssScheduler.CreateAllTriggers(Rules);

            SaveRules();

            return(ret);
        }
Exemple #2
0
        public void AddOrUpdateRule(SnapshotRule newRule)
        {
            SnapshotRule oldRule = RulesMap.SafeGet(newRule.Id);

            if (oldRule != null)
            {
                newRule.CopyProperties(oldRule);
            }

            else
            {
                RulesMap[newRule.Id] = newRule;
            }

            SaveRules();

            VssScheduler.CreateAllTriggers(Rules);
        }
Exemple #3
0
        public void LoadRules(IList <SnapshotRule> rules)
        {
            RulesMap = rules.ToConcurrentDictionary(k => k.Id);

            VssScheduler.CreateAllTriggers(Rules);
        }