Skip to content

Commit 671533e

Browse files
committed
[core] Role query support with globbing in Environment
1 parent adc523f commit 671533e

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

core/environment/environment.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,16 @@
2727
package environment
2828

2929
import (
30-
"sync"
31-
"github.com/pborman/uuid"
32-
"github.com/looplab/fsm"
3330
"errors"
34-
"github.com/sirupsen/logrus"
35-
"github.com/AliceO2Group/Control/common/logger"
31+
"sync"
3632
"time"
33+
34+
"github.com/AliceO2Group/Control/common/logger"
3735
"github.com/AliceO2Group/Control/core/workflow"
36+
"github.com/gobwas/glob"
37+
"github.com/looplab/fsm"
38+
"github.com/pborman/uuid"
39+
"github.com/sirupsen/logrus"
3840
)
3941

4042
var log = logger.New(logrus.StandardLogger(),"env")
@@ -159,6 +161,12 @@ func (env *Environment) Workflow() workflow.Role {
159161
return env.workflow
160162
}
161163

164+
func (env *Environment) QueryRoles(pathSpec string) (rs []workflow.Role) {
165+
g := glob.MustCompile(pathSpec, workflow.PATH_SEPARATOR_RUNE)
166+
rs = env.workflow.GlobFilter(g)
167+
return
168+
}
169+
162170
func (env *Environment) GetPath() string {
163171
return ""
164172
}

0 commit comments

Comments
 (0)