2019-07-18 10:13:54 +00:00
|
|
|
package accounting
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2022-07-20 09:49:00 +00:00
|
|
|
"fmt"
|
2021-06-13 16:32:44 +00:00
|
|
|
"sync"
|
2019-07-18 10:13:54 +00:00
|
|
|
|
2021-06-13 16:10:15 +00:00
|
|
|
"github.com/rclone/rclone/fs/rc"
|
|
|
|
|
2019-07-28 17:47:38 +00:00
|
|
|
"github.com/rclone/rclone/fs"
|
2019-07-18 10:13:54 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const globalStats = "global_stats"
|
|
|
|
|
|
|
|
var groups *statsGroups
|
|
|
|
|
2019-12-19 09:28:35 +00:00
|
|
|
func init() {
|
|
|
|
// Init stats container
|
|
|
|
groups = newStatsGroups()
|
|
|
|
}
|
|
|
|
|
|
|
|
func rcListStats(ctx context.Context, in rc.Params) (rc.Params, error) {
|
2019-07-23 15:45:07 +00:00
|
|
|
out := make(rc.Params)
|
|
|
|
|
|
|
|
out["groups"] = groups.names()
|
|
|
|
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2019-12-19 09:28:35 +00:00
|
|
|
func init() {
|
|
|
|
rc.Add(rc.Call{
|
|
|
|
Path: "core/group-list",
|
|
|
|
Fn: rcListStats,
|
|
|
|
Title: "Returns list of stats.",
|
|
|
|
Help: `
|
|
|
|
This returns list of stats groups currently in memory.
|
2019-07-18 10:13:54 +00:00
|
|
|
|
2019-12-19 09:28:35 +00:00
|
|
|
Returns the following values:
|
|
|
|
` + "```" + `
|
|
|
|
{
|
|
|
|
"groups": an array of group names:
|
|
|
|
[
|
|
|
|
"group1",
|
|
|
|
"group2",
|
|
|
|
...
|
|
|
|
]
|
2019-07-18 10:13:54 +00:00
|
|
|
}
|
2019-12-19 09:28:35 +00:00
|
|
|
` + "```" + `
|
|
|
|
`,
|
|
|
|
})
|
2019-07-22 19:11:46 +00:00
|
|
|
}
|
|
|
|
|
2019-12-19 09:28:35 +00:00
|
|
|
func rcRemoteStats(ctx context.Context, in rc.Params) (rc.Params, error) {
|
2019-07-30 11:22:06 +00:00
|
|
|
// Check to see if we should filter by group.
|
|
|
|
group, err := in.GetString("group")
|
|
|
|
if rc.NotErrParamNotFound(err) {
|
|
|
|
return rc.Params{}, err
|
|
|
|
}
|
|
|
|
if group != "" {
|
2020-11-05 16:59:59 +00:00
|
|
|
return StatsGroup(ctx, group).RemoteStats()
|
2019-07-30 11:22:06 +00:00
|
|
|
}
|
|
|
|
|
2020-11-05 16:59:59 +00:00
|
|
|
return groups.sum(ctx).RemoteStats()
|
2019-07-30 11:22:06 +00:00
|
|
|
}
|
|
|
|
|
2019-07-18 10:13:54 +00:00
|
|
|
func init() {
|
|
|
|
rc.Add(rc.Call{
|
|
|
|
Path: "core/stats",
|
2019-12-19 09:28:35 +00:00
|
|
|
Fn: rcRemoteStats,
|
2019-07-18 10:13:54 +00:00
|
|
|
Title: "Returns stats about current transfers.",
|
|
|
|
Help: `
|
2019-07-19 08:13:17 +00:00
|
|
|
This returns all available stats:
|
2019-07-18 10:13:54 +00:00
|
|
|
|
|
|
|
rclone rc core/stats
|
|
|
|
|
2019-07-19 08:13:17 +00:00
|
|
|
If group is not provided then summed up stats for all groups will be
|
|
|
|
returned.
|
|
|
|
|
|
|
|
Parameters
|
2019-10-27 10:32:56 +00:00
|
|
|
|
2019-07-19 08:13:17 +00:00
|
|
|
- group - name of the stats group (string)
|
|
|
|
|
2019-07-18 10:13:54 +00:00
|
|
|
Returns the following values:
|
|
|
|
|
|
|
|
` + "```" + `
|
|
|
|
{
|
2021-03-15 15:50:04 +00:00
|
|
|
"bytes": total transferred bytes since the start of the group,
|
|
|
|
"checks": number of files checked,
|
|
|
|
"deletes" : number of files deleted,
|
|
|
|
"elapsedTime": time in floating point seconds since rclone was started,
|
2019-07-18 10:13:54 +00:00
|
|
|
"errors": number of errors,
|
2021-03-15 15:50:04 +00:00
|
|
|
"eta": estimated time in seconds until the group completes,
|
|
|
|
"fatalError": boolean whether there has been at least one fatal error,
|
|
|
|
"lastError": last error string,
|
|
|
|
"renames" : number of files renamed,
|
|
|
|
"retryError": boolean showing whether there has been at least one non-NoRetryError,
|
2023-07-30 04:39:01 +00:00
|
|
|
"serverSideCopies": number of server side copies done,
|
|
|
|
"serverSideCopyBytes": number bytes server side copied,
|
|
|
|
"serverSideMoves": number of server side moves done,
|
|
|
|
"serverSideMoveBytes": number bytes server side moved,
|
2021-04-07 10:23:42 +00:00
|
|
|
"speed": average speed in bytes per second since start of the group,
|
2021-03-15 15:50:04 +00:00
|
|
|
"totalBytes": total number of bytes in the group,
|
|
|
|
"totalChecks": total number of checks in the group,
|
|
|
|
"totalTransfers": total number of transfers in the group,
|
2020-07-26 10:59:50 +00:00
|
|
|
"transferTime" : total time spent on running jobs,
|
2021-03-15 15:50:04 +00:00
|
|
|
"transfers": number of transferred files,
|
2019-07-18 10:13:54 +00:00
|
|
|
"transferring": an array of currently active file transfers:
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"bytes": total transferred bytes for this file,
|
|
|
|
"eta": estimated time in seconds until file transfer completion
|
|
|
|
"name": name of the file,
|
|
|
|
"percentage": progress of the file transfer in percent,
|
2021-04-07 10:23:42 +00:00
|
|
|
"speed": average speed over the whole transfer in bytes per second,
|
|
|
|
"speedAvg": current speed in bytes per second as an exponentially weighted moving average,
|
2019-07-18 10:13:54 +00:00
|
|
|
"size": size of the file in bytes
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"checking": an array of names of currently active file checks
|
|
|
|
[]
|
|
|
|
}
|
|
|
|
` + "```" + `
|
|
|
|
Values for "transferring", "checking" and "lastError" are only assigned if data is available.
|
|
|
|
The value for "eta" is null if an eta cannot be determined.
|
2019-07-22 19:11:46 +00:00
|
|
|
`,
|
|
|
|
})
|
2019-12-19 09:28:35 +00:00
|
|
|
}
|
2019-07-22 19:11:46 +00:00
|
|
|
|
2019-12-19 09:28:35 +00:00
|
|
|
func rcTransferredStats(ctx context.Context, in rc.Params) (rc.Params, error) {
|
|
|
|
// Check to see if we should filter by group.
|
|
|
|
group, err := in.GetString("group")
|
|
|
|
if rc.NotErrParamNotFound(err) {
|
|
|
|
return rc.Params{}, err
|
|
|
|
}
|
|
|
|
|
|
|
|
out := make(rc.Params)
|
|
|
|
if group != "" {
|
2020-11-05 16:59:59 +00:00
|
|
|
out["transferred"] = StatsGroup(ctx, group).Transferred()
|
2019-12-19 09:28:35 +00:00
|
|
|
} else {
|
2020-11-05 16:59:59 +00:00
|
|
|
out["transferred"] = groups.sum(ctx).Transferred()
|
2019-12-19 09:28:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2019-07-22 19:11:46 +00:00
|
|
|
rc.Add(rc.Call{
|
|
|
|
Path: "core/transferred",
|
2019-12-19 09:28:35 +00:00
|
|
|
Fn: rcTransferredStats,
|
2019-07-22 19:11:46 +00:00
|
|
|
Title: "Returns stats about completed transfers.",
|
|
|
|
Help: `
|
|
|
|
This returns stats about completed transfers:
|
|
|
|
|
|
|
|
rclone rc core/transferred
|
|
|
|
|
|
|
|
If group is not provided then completed transfers for all groups will be
|
|
|
|
returned.
|
|
|
|
|
2019-10-16 19:11:11 +00:00
|
|
|
Note only the last 100 completed transfers are returned.
|
|
|
|
|
2019-07-22 19:11:46 +00:00
|
|
|
Parameters
|
2019-10-27 10:32:56 +00:00
|
|
|
|
2019-07-22 19:11:46 +00:00
|
|
|
- group - name of the stats group (string)
|
|
|
|
|
|
|
|
Returns the following values:
|
|
|
|
` + "```" + `
|
|
|
|
{
|
|
|
|
"transferred": an array of completed transfers (including failed ones):
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"name": name of the file,
|
|
|
|
"size": size of the file in bytes,
|
|
|
|
"bytes": total transferred bytes for this file,
|
|
|
|
"checked": if the transfer is only checked (skipped, deleted),
|
|
|
|
"timestamp": integer representing millisecond unix epoch,
|
2020-05-20 10:39:20 +00:00
|
|
|
"error": string description of the error (empty if successful),
|
2019-07-22 19:11:46 +00:00
|
|
|
"jobid": id of the job that this transfer belongs to
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2019-10-13 04:59:12 +00:00
|
|
|
` + "```" + `
|
2019-07-23 15:45:07 +00:00
|
|
|
`,
|
|
|
|
})
|
2019-12-19 09:28:35 +00:00
|
|
|
}
|
2019-07-23 15:45:07 +00:00
|
|
|
|
2019-12-19 09:28:35 +00:00
|
|
|
func rcResetStats(ctx context.Context, in rc.Params) (rc.Params, error) {
|
|
|
|
// Check to see if we should filter by group.
|
|
|
|
group, err := in.GetString("group")
|
|
|
|
if rc.NotErrParamNotFound(err) {
|
|
|
|
return rc.Params{}, err
|
|
|
|
}
|
2019-07-23 15:45:07 +00:00
|
|
|
|
2019-12-19 09:28:35 +00:00
|
|
|
if group != "" {
|
|
|
|
stats := groups.get(group)
|
2022-07-20 09:49:00 +00:00
|
|
|
if stats == nil {
|
|
|
|
return rc.Params{}, fmt.Errorf("group %q not found", group)
|
|
|
|
}
|
2019-12-19 09:28:35 +00:00
|
|
|
stats.ResetErrors()
|
2019-12-19 10:16:22 +00:00
|
|
|
stats.ResetCounters()
|
2019-12-19 09:28:35 +00:00
|
|
|
} else {
|
|
|
|
groups.reset()
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc.Params{}, nil
|
2019-07-23 15:45:07 +00:00
|
|
|
}
|
2019-07-30 11:22:06 +00:00
|
|
|
|
2019-12-19 09:28:35 +00:00
|
|
|
func init() {
|
2019-07-30 11:22:06 +00:00
|
|
|
rc.Add(rc.Call{
|
|
|
|
Path: "core/stats-reset",
|
2019-12-19 09:28:35 +00:00
|
|
|
Fn: rcResetStats,
|
2019-07-30 11:22:06 +00:00
|
|
|
Title: "Reset stats.",
|
|
|
|
Help: `
|
2019-11-14 14:35:49 +00:00
|
|
|
This clears counters, errors and finished transfers for all stats or specific
|
|
|
|
stats group if group is provided.
|
2019-07-30 11:22:06 +00:00
|
|
|
|
|
|
|
Parameters
|
2019-10-27 10:32:56 +00:00
|
|
|
|
2019-07-30 11:22:06 +00:00
|
|
|
- group - name of the stats group (string)
|
2019-07-18 10:13:54 +00:00
|
|
|
`,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-12-19 10:16:22 +00:00
|
|
|
func rcDeleteStats(ctx context.Context, in rc.Params) (rc.Params, error) {
|
|
|
|
// Group name required because we only do single group.
|
|
|
|
group, err := in.GetString("group")
|
|
|
|
if rc.NotErrParamNotFound(err) {
|
|
|
|
return rc.Params{}, err
|
|
|
|
}
|
|
|
|
|
|
|
|
if group != "" {
|
|
|
|
groups.delete(group)
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc.Params{}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
rc.Add(rc.Call{
|
|
|
|
Path: "core/stats-delete",
|
|
|
|
Fn: rcDeleteStats,
|
|
|
|
Title: "Delete stats group.",
|
|
|
|
Help: `
|
2021-08-16 09:30:01 +00:00
|
|
|
This deletes entire stats group.
|
2019-12-19 10:16:22 +00:00
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
|
|
|
- group - name of the stats group (string)
|
|
|
|
`,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-07-18 10:13:54 +00:00
|
|
|
type statsGroupCtx int64
|
|
|
|
|
|
|
|
const statsGroupKey statsGroupCtx = 1
|
|
|
|
|
|
|
|
// WithStatsGroup returns copy of the parent context with assigned group.
|
|
|
|
func WithStatsGroup(parent context.Context, group string) context.Context {
|
|
|
|
return context.WithValue(parent, statsGroupKey, group)
|
|
|
|
}
|
|
|
|
|
|
|
|
// StatsGroupFromContext returns group from the context if it's available.
|
|
|
|
// Returns false if group is empty.
|
|
|
|
func StatsGroupFromContext(ctx context.Context) (string, bool) {
|
|
|
|
statsGroup, ok := ctx.Value(statsGroupKey).(string)
|
|
|
|
if statsGroup == "" {
|
|
|
|
ok = false
|
|
|
|
}
|
|
|
|
return statsGroup, ok
|
|
|
|
}
|
|
|
|
|
|
|
|
// Stats gets stats by extracting group from context.
|
|
|
|
func Stats(ctx context.Context) *StatsInfo {
|
|
|
|
group, ok := StatsGroupFromContext(ctx)
|
|
|
|
if !ok {
|
|
|
|
return GlobalStats()
|
|
|
|
}
|
2020-11-05 16:59:59 +00:00
|
|
|
return StatsGroup(ctx, group)
|
2019-07-18 10:13:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// StatsGroup gets stats by group name.
|
2020-11-05 16:59:59 +00:00
|
|
|
func StatsGroup(ctx context.Context, group string) *StatsInfo {
|
2019-07-18 10:13:54 +00:00
|
|
|
stats := groups.get(group)
|
|
|
|
if stats == nil {
|
2020-11-05 16:59:59 +00:00
|
|
|
return NewStatsGroup(ctx, group)
|
2019-07-18 10:13:54 +00:00
|
|
|
}
|
|
|
|
return stats
|
|
|
|
}
|
|
|
|
|
|
|
|
// GlobalStats returns special stats used for global accounting.
|
|
|
|
func GlobalStats() *StatsInfo {
|
2020-11-05 16:59:59 +00:00
|
|
|
return StatsGroup(context.Background(), globalStats)
|
2019-07-18 10:13:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewStatsGroup creates new stats under named group.
|
2020-11-05 16:59:59 +00:00
|
|
|
func NewStatsGroup(ctx context.Context, group string) *StatsInfo {
|
|
|
|
stats := NewStats(ctx)
|
2019-10-29 10:13:21 +00:00
|
|
|
stats.group = group
|
2020-11-05 16:59:59 +00:00
|
|
|
groups.set(ctx, group, stats)
|
2019-07-18 10:13:54 +00:00
|
|
|
return stats
|
|
|
|
}
|
|
|
|
|
|
|
|
// statsGroups holds a synchronized map of stats
|
|
|
|
type statsGroups struct {
|
2019-07-23 15:45:07 +00:00
|
|
|
mu sync.Mutex
|
|
|
|
m map[string]*StatsInfo
|
|
|
|
order []string
|
2019-07-18 10:13:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// newStatsGroups makes a new statsGroups object
|
|
|
|
func newStatsGroups() *statsGroups {
|
|
|
|
return &statsGroups{
|
|
|
|
m: make(map[string]*StatsInfo),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// set marks the stats as belonging to a group
|
2020-11-05 16:59:59 +00:00
|
|
|
func (sg *statsGroups) set(ctx context.Context, group string, stats *StatsInfo) {
|
2019-07-18 10:13:54 +00:00
|
|
|
sg.mu.Lock()
|
|
|
|
defer sg.mu.Unlock()
|
2020-11-05 11:33:32 +00:00
|
|
|
ci := fs.GetConfig(ctx)
|
2019-07-18 10:13:54 +00:00
|
|
|
|
2019-07-23 15:45:07 +00:00
|
|
|
// Limit number of groups kept in memory.
|
2020-11-05 11:33:32 +00:00
|
|
|
if len(sg.order) >= ci.MaxStatsGroups {
|
2019-07-23 15:45:07 +00:00
|
|
|
group := sg.order[0]
|
2020-01-03 13:46:37 +00:00
|
|
|
fs.LogPrintf(fs.LogLevelDebug, nil, "Max number of stats groups reached removing %s", group)
|
2019-07-23 15:45:07 +00:00
|
|
|
delete(sg.m, group)
|
2020-11-05 11:33:32 +00:00
|
|
|
r := (len(sg.order) - ci.MaxStatsGroups) + 1
|
2019-07-23 15:45:07 +00:00
|
|
|
sg.order = sg.order[r:]
|
|
|
|
}
|
|
|
|
|
2019-12-19 10:16:22 +00:00
|
|
|
// Exclude global stats from listing
|
2019-07-23 15:45:07 +00:00
|
|
|
if group != globalStats {
|
|
|
|
sg.order = append(sg.order, group)
|
|
|
|
}
|
|
|
|
sg.m[group] = stats
|
2019-07-18 10:13:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// get gets the stats for group, or nil if not found
|
|
|
|
func (sg *statsGroups) get(group string) *StatsInfo {
|
|
|
|
sg.mu.Lock()
|
|
|
|
defer sg.mu.Unlock()
|
|
|
|
stats, ok := sg.m[group]
|
|
|
|
if !ok {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return stats
|
|
|
|
}
|
|
|
|
|
2019-07-23 15:45:07 +00:00
|
|
|
func (sg *statsGroups) names() []string {
|
|
|
|
sg.mu.Lock()
|
|
|
|
defer sg.mu.Unlock()
|
|
|
|
return sg.order
|
|
|
|
}
|
|
|
|
|
2019-12-19 09:28:35 +00:00
|
|
|
// sum returns aggregate stats that contains summation of all groups.
|
2020-11-05 16:59:59 +00:00
|
|
|
func (sg *statsGroups) sum(ctx context.Context) *StatsInfo {
|
2021-06-13 16:32:44 +00:00
|
|
|
startTime := GlobalStats().startTime
|
2019-07-18 10:13:54 +00:00
|
|
|
sg.mu.Lock()
|
|
|
|
defer sg.mu.Unlock()
|
2020-01-03 13:55:30 +00:00
|
|
|
|
2020-11-05 16:59:59 +00:00
|
|
|
sum := NewStats(ctx)
|
2019-07-18 10:13:54 +00:00
|
|
|
for _, stats := range sg.m {
|
2020-01-03 13:55:30 +00:00
|
|
|
stats.mu.RLock()
|
|
|
|
{
|
|
|
|
sum.bytes += stats.bytes
|
|
|
|
sum.errors += stats.errors
|
2021-11-04 08:24:12 +00:00
|
|
|
if sum.lastError == nil && stats.lastError != nil {
|
|
|
|
sum.lastError = stats.lastError
|
|
|
|
}
|
2020-01-03 13:55:30 +00:00
|
|
|
sum.fatalError = sum.fatalError || stats.fatalError
|
|
|
|
sum.retryError = sum.retryError || stats.retryError
|
2021-11-04 08:24:12 +00:00
|
|
|
if stats.retryAfter.After(sum.retryAfter) {
|
|
|
|
// Update the retryAfter field only if it is a later date than the current one in the sum
|
|
|
|
sum.retryAfter = stats.retryAfter
|
|
|
|
}
|
2020-01-03 13:55:30 +00:00
|
|
|
sum.checks += stats.checks
|
2021-11-04 08:24:12 +00:00
|
|
|
sum.checking.merge(stats.checking)
|
|
|
|
sum.checkQueue += stats.checkQueue
|
|
|
|
sum.checkQueueSize += stats.checkQueueSize
|
2020-01-03 13:55:30 +00:00
|
|
|
sum.transfers += stats.transfers
|
2021-11-04 08:24:12 +00:00
|
|
|
sum.transferring.merge(stats.transferring)
|
|
|
|
sum.transferQueueSize += stats.transferQueueSize
|
|
|
|
sum.renames += stats.renames
|
|
|
|
sum.renameQueue += stats.renameQueue
|
|
|
|
sum.renameQueueSize += stats.renameQueueSize
|
2020-01-03 13:55:30 +00:00
|
|
|
sum.deletes += stats.deletes
|
2020-10-28 12:54:31 +00:00
|
|
|
sum.deletedDirs += stats.deletedDirs
|
2020-01-03 13:55:30 +00:00
|
|
|
sum.inProgress.merge(stats.inProgress)
|
|
|
|
sum.startedTransfers = append(sum.startedTransfers, stats.startedTransfers...)
|
2020-09-07 15:18:52 +00:00
|
|
|
sum.oldTimeRanges = append(sum.oldTimeRanges, stats.oldTimeRanges...)
|
2021-11-04 08:24:12 +00:00
|
|
|
sum.oldDuration += stats.oldDuration
|
2021-08-14 04:56:39 +00:00
|
|
|
stats.average.mu.Lock()
|
|
|
|
sum.average.speed += stats.average.speed
|
|
|
|
stats.average.mu.Unlock()
|
2019-07-18 10:13:54 +00:00
|
|
|
}
|
2020-01-03 13:55:30 +00:00
|
|
|
stats.mu.RUnlock()
|
2019-07-18 10:13:54 +00:00
|
|
|
}
|
2021-06-13 16:32:44 +00:00
|
|
|
sum.startTime = startTime
|
2019-07-18 10:13:54 +00:00
|
|
|
return sum
|
|
|
|
}
|
2019-07-30 11:22:06 +00:00
|
|
|
|
2019-12-19 09:28:35 +00:00
|
|
|
func (sg *statsGroups) reset() {
|
2019-07-30 11:22:06 +00:00
|
|
|
sg.mu.Lock()
|
|
|
|
defer sg.mu.Unlock()
|
|
|
|
|
|
|
|
for _, stats := range sg.m {
|
|
|
|
stats.ResetErrors()
|
|
|
|
stats.ResetCounters()
|
|
|
|
}
|
|
|
|
|
|
|
|
sg.m = make(map[string]*StatsInfo)
|
|
|
|
sg.order = nil
|
|
|
|
}
|
2019-12-19 10:16:22 +00:00
|
|
|
|
|
|
|
// delete removes all references to the group.
|
|
|
|
func (sg *statsGroups) delete(group string) {
|
|
|
|
sg.mu.Lock()
|
|
|
|
defer sg.mu.Unlock()
|
|
|
|
stats := sg.m[group]
|
|
|
|
if stats == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
stats.ResetErrors()
|
|
|
|
stats.ResetCounters()
|
|
|
|
delete(sg.m, group)
|
|
|
|
|
|
|
|
// Remove group reference from the ordering slice.
|
|
|
|
tmp := sg.order[:0]
|
|
|
|
for _, g := range sg.order {
|
|
|
|
if g != group {
|
|
|
|
tmp = append(tmp, g)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sg.order = tmp
|
|
|
|
}
|