github.com/justinjmoses/evergreen@v0.0.0-20170530173719-1d50e381ff0d/rest/data/interface.go (about) 1 package data 2 3 import ( 4 "github.com/evergreen-ci/evergreen/auth" 5 "github.com/evergreen-ci/evergreen/model" 6 "github.com/evergreen-ci/evergreen/model/host" 7 "github.com/evergreen-ci/evergreen/model/task" 8 ) 9 10 // Connector is an interface that contains all of the methods which 11 // connect to the service layer of evergreen. These methods abstract the link 12 // between the service and the API layers, allowing for changes in the 13 // service architecture without forcing changes to the API. 14 type Connector interface { 15 // Get and Set SuperUsers provide access to the list of API super users. 16 GetSuperUsers() []string 17 SetSuperUsers([]string) 18 19 // Get and Set URL provide access to the main url string of the API. 20 GetURL() string 21 SetURL(string) 22 23 // Get and Set Prefix provide access to the prefix that prepends all of the 24 // URL paths. 25 GetPrefix() string 26 SetPrefix(string) 27 28 // FindTaskById is a method to find a specific task given its ID. 29 FindTaskById(string) (*task.Task, error) 30 FindTasksByIds([]string) ([]task.Task, error) 31 SetTaskPriority(*task.Task, int64) error 32 SetTaskActivated(string, string, bool) error 33 ResetTask(string, string, *model.Project) error 34 35 // FindTasksByBuildId is a method to find a set of tasks which all have the same 36 // BuildId. It takes the buildId being queried for as its first parameter, 37 // as well as a taskId and limit for paginating through the results. 38 // It returns a list of tasks which match. 39 FindTasksByBuildId(string, string, string, int, int) ([]task.Task, error) 40 41 // FindByProjectAndCommit is a method to find a set of tasks which ran as part of 42 // certain version in a project. It takes the projectId, commit hash, and a taskId 43 // for paginating through the results. 44 FindTasksByProjectAndCommit(string, string, string, string, int, int) ([]task.Task, error) 45 46 // FindTestsByTaskId is a methodd to find a set of tests that correspond to 47 // a given task. It takes a taskId, testName to start from, test status to filter, 48 // limit, and sort to provide additional control over the results. 49 FindTestsByTaskId(string, string, string, int, int) ([]task.TestResult, error) 50 51 // FindUserById is a method to find a specific user given its ID. 52 FindUserById(string) (auth.APIUser, error) 53 54 // FindHostsById is a method to find a sorted list of hosts given an ID to 55 // start from. 56 FindHostsById(string, string, int, int) ([]host.Host, error) 57 58 // FetchContext is a method to fetch a context given a series of identifiers. 59 FetchContext(string, string, string, string, string) (model.Context, error) 60 }