public async Task <List <string> > GetTriggerGroupNames(GroupMatcher <TriggerKey> matcher)
        {
            var regex = matcher.ToBsonRegularExpression().ToRegex();

            return(await Collection.Distinct(trigger => trigger.Id.Group,
                                             trigger => trigger.Id.InstanceName == InstanceName && regex.IsMatch(trigger.Id.Group))
                   .ToListAsync().ConfigureAwait(false));
        }
Exemple #2
0
 public List <JobKey> GetJobsKeys(GroupMatcher <JobKey> matcher)
 {
     return
         (Collection.Find(FilterBuilder.And(
                              FilterBuilder.Eq(detail => detail.Id.InstanceName, InstanceName),
                              FilterBuilder.Regex(detail => detail.Id.Group, matcher.ToBsonRegularExpression())))
          .Project(detail => detail.Id.GetJobKey())
          .ToList());
 }
Exemple #3
0
        public IEnumerable <string> GetTriggerGroupNames(GroupMatcher <TriggerKey> matcher)
        {
            var regex = matcher.ToBsonRegularExpression().ToRegex();

            return(Collection.AsQueryable()
                   .Where(trigger => trigger.Id.InstanceName == InstanceName && regex.IsMatch(trigger.Id.Group))
                   .Select(trigger => trigger.Id.Group)
                   .Distinct());
        }
        public void DeletePausedTriggerGroup(GroupMatcher <TriggerKey> matcher)
        {
            var regex = matcher.ToBsonRegularExpression().ToRegex();

            Collection.DeleteMany(group => group.Id.InstanceName == InstanceName && regex.IsMatch(group.Id.Group));
        }
 public async Task DeletePausedTriggerGroup(GroupMatcher <TriggerKey> matcher)
 {
     var regex = matcher.ToBsonRegularExpression().ToRegex();
     await Collection.DeleteManyAsync(group => group.Id.InstanceName == InstanceName && regex.IsMatch(group.Id.Group)).ConfigureAwait(false);
 }
Exemple #6
0
 public async Task <List <JobKey> > GetJobsKeys(GroupMatcher <JobKey> matcher)
 {
     return
         (await Collection.Find(FilterBuilder.And(
                                    FilterBuilder.Eq(detail => detail.Id.InstanceName, InstanceName),
                                    FilterBuilder.Regex(detail => detail.Id.Group, matcher.ToBsonRegularExpression())))
          .Project(detail => detail.Id.GetJobKey())
          .ToListAsync().ConfigureAwait(false));
 }
Exemple #7
0
 public List <TriggerKey> GetTriggerKeys(GroupMatcher <TriggerKey> matcher)
 {
     return(Collection.Find(FilterBuilder.And(
                                FilterBuilder.Eq(trigger => trigger.Id.InstanceName, InstanceName),
                                FilterBuilder.Regex(trigger => trigger.Id.Group, matcher.ToBsonRegularExpression())))
            .Project(trigger => trigger.Id.GetTriggerKey())
            .ToList());
 }
Exemple #8
0
 public long UpdateTriggersStates(GroupMatcher <TriggerKey> matcher, Models.TriggerState newState,
                                  params Models.TriggerState[] oldStates)
 {
     return(Collection.UpdateMany(FilterBuilder.And(
                                      FilterBuilder.Eq(trigger => trigger.Id.InstanceName, InstanceName),
                                      FilterBuilder.Regex(trigger => trigger.Id.Group, matcher.ToBsonRegularExpression()),
                                      FilterBuilder.In(trigger => trigger.State, oldStates)),
                                  UpdateBuilder.Set(trigger => trigger.State, newState)).ModifiedCount);
 }
        public async Task <long> UpdateTriggersStates(GroupMatcher <TriggerKey> matcher, Models.TriggerState newState,
                                                      params Models.TriggerState[] oldStates)
        {
            var result = await Collection.UpdateManyAsync(FilterBuilder.And(
                                                              FilterBuilder.Eq(trigger => trigger.Id.InstanceName, InstanceName),
                                                              FilterBuilder.Regex(trigger => trigger.Id.Group, matcher.ToBsonRegularExpression()),
                                                              FilterBuilder.In(trigger => trigger.State, oldStates)),
                                                          UpdateBuilder.Set(trigger => trigger.State, newState)).ConfigureAwait(false);

            return(result.ModifiedCount);
        }