mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-04 08:27:27 +08:00
[NET-546] Move ee code to ee package, unify ee status and terminology (#2538)
* Move ee code to ee package and unify ee status to IsPro * Consolidate naming for paid/professional/enterprise version as "pro". Notes: - Changes image tags - Changes build tags - Changes package names - Doesn't change links to docs that mention "ee" - Doesn't change parameters sent to PostHog that mention "ee" * Revert docker image tag being -pro, back to -ee * Revert go build tag being pro, back to ee * Add build tags for some ee content * [2] Revert go build tag being pro, back to ee * Fix test workflow * Add a json tag to be backwards compatible with frontend "IsEE" check * Add a json tag for the serverconfig struct for IsEE * Ammend json tag to Is_EE * fix ee tags --------- Co-authored-by: Abhishek Kondur <abhi281342@gmail.com>
This commit is contained in:

committed by
GitHub

parent
31fcc8cd6d
commit
1a1ba1ccf4
@@ -1,39 +1,18 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/gravitl/netmaker/database"
|
||||
"github.com/gravitl/netmaker/models"
|
||||
)
|
||||
|
||||
// GetMetrics - gets the metrics
|
||||
func GetMetrics(nodeid string) (*models.Metrics, error) {
|
||||
var DeleteMetrics = func(string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var UpdateMetrics = func(string, *models.Metrics) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var GetMetrics = func(string) (*models.Metrics, error) {
|
||||
var metrics models.Metrics
|
||||
record, err := database.FetchRecord(database.METRICS_TABLE_NAME, nodeid)
|
||||
if err != nil {
|
||||
if database.IsEmptyRecord(err) {
|
||||
return &metrics, nil
|
||||
}
|
||||
return &metrics, err
|
||||
}
|
||||
err = json.Unmarshal([]byte(record), &metrics)
|
||||
if err != nil {
|
||||
return &metrics, err
|
||||
}
|
||||
return &metrics, nil
|
||||
}
|
||||
|
||||
// UpdateMetrics - updates the metrics of a given client
|
||||
func UpdateMetrics(nodeid string, metrics *models.Metrics) error {
|
||||
data, err := json.Marshal(metrics)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return database.Insert(nodeid, string(data), database.METRICS_TABLE_NAME)
|
||||
}
|
||||
|
||||
// DeleteMetrics - deletes metrics of a given node
|
||||
func DeleteMetrics(nodeid string) error {
|
||||
return database.DeleteRecord(database.METRICS_TABLE_NAME, nodeid)
|
||||
}
|
||||
|
Reference in New Issue
Block a user