From 421148f7937e0a9059414e6ef8ec01052c3d6d73 Mon Sep 17 00:00:00 2001 From: Matt Keeler Date: Fri, 3 Jan 2020 15:51:19 -0500 Subject: [PATCH] Move Session.CheckIDs into OSS only code. (#6993) --- agent/structs/structs.go | 16 ---------------- agent/structs/structs_oss.go | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/agent/structs/structs.go b/agent/structs/structs.go index 43a664b18..e9a293e8d 100644 --- a/agent/structs/structs.go +++ b/agent/structs/structs.go @@ -1932,22 +1932,6 @@ type ServiceCheck struct { Namespace string } -// CheckIDs returns the IDs for all checks associated with a session, regardless of type -func (s *Session) CheckIDs() []types.CheckID { - // Merge all check IDs into a single slice, since they will be handled the same way - checks := make([]types.CheckID, 0, len(s.Checks)+len(s.NodeChecks)+len(s.ServiceChecks)) - checks = append(checks, s.Checks...) - - for _, c := range s.NodeChecks { - checks = append(checks, types.CheckID(c)) - } - - for _, c := range s.ServiceChecks { - checks = append(checks, types.CheckID(c.ID)) - } - return checks -} - func (s *Session) UnmarshalJSON(data []byte) (err error) { type Alias Session aux := &struct { diff --git a/agent/structs/structs_oss.go b/agent/structs/structs_oss.go index 7bdac5f6d..71a58142b 100644 --- a/agent/structs/structs_oss.go +++ b/agent/structs/structs_oss.go @@ -6,6 +6,7 @@ import ( "hash" "github.com/hashicorp/consul/acl" + "github.com/hashicorp/consul/types" ) var emptyEnterpriseMeta = EnterpriseMeta{} @@ -91,3 +92,19 @@ func (cid *CheckID) String() string { func (_ *HealthCheck) Validate() error { return nil } + +// CheckIDs returns the IDs for all checks associated with a session, regardless of type +func (s *Session) CheckIDs() []types.CheckID { + // Merge all check IDs into a single slice, since they will be handled the same way + checks := make([]types.CheckID, 0, len(s.Checks)+len(s.NodeChecks)+len(s.ServiceChecks)) + checks = append(checks, s.Checks...) + + for _, c := range s.NodeChecks { + checks = append(checks, types.CheckID(c)) + } + + for _, c := range s.ServiceChecks { + checks = append(checks, types.CheckID(c.ID)) + } + return checks +}