-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Poonam Jadhav <[email protected]>
- Loading branch information
1 parent
fad929b
commit 55bef47
Showing
10 changed files
with
90 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package reporting | ||
|
||
import ( | ||
"sync" | ||
|
||
"github.com/hashicorp/go-hclog" | ||
) | ||
|
||
type ReportingManager struct { | ||
logger hclog.Logger | ||
server ServerDelegate | ||
EntDeps | ||
sync.RWMutex | ||
} | ||
|
||
const ( | ||
SystemMetadataReportingProcessID = "reporting-process-id" | ||
) | ||
|
||
//go:generate mockery --name ServerDelegate --inpackage | ||
type ServerDelegate interface { | ||
GetSystemMetadata(key string) (string, error) | ||
SetSystemMetadataKey(key, val string) error | ||
IsLeader() bool | ||
} | ||
|
||
func NewReportingManager(logger hclog.Logger, deps EntDeps, server ServerDelegate) *ReportingManager { | ||
rm := &ReportingManager{ | ||
logger: logger.Named("reporting"), | ||
server: server, | ||
} | ||
err := rm.initEnterpriseReporting(deps) | ||
if err != nil { | ||
rm.logger.Error("Error initializing reporting manager", "error", err) | ||
return nil | ||
} | ||
return rm | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//go:build !consulent | ||
// +build !consulent | ||
|
||
package reporting | ||
|
||
type EntDeps struct{} | ||
|
||
func (rm *ReportingManager) initEnterpriseReporting(entDeps EntDeps) error { | ||
// no op | ||
return nil | ||
} | ||
|
||
func (rm *ReportingManager) StartReportingAgent() error { | ||
// no op | ||
return nil | ||
} | ||
|
||
func (rm *ReportingManager) StopReportingAgent() error { | ||
// no op | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters