Console cache_stats command

This commit is contained in:
Anevo
2018-03-13 10:05:17 -04:00
committed by Dan Christian Bogos
parent f299b012c4
commit 7eb7586c48
10 changed files with 604 additions and 1 deletions

65
console/cache_clear.go Normal file
View File

@@ -0,0 +1,65 @@
/*
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdClear{
name: "cache_clear",
rpcMethod: utils.CacheSv1Clear,
rpcParams: []string{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdClear struct {
name string
rpcMethod string
rpcParams []string
*CommandExecuter
}
func (self *CmdClear) Name() string {
return self.name
}
func (self *CmdClear) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdClear) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = []string{}
}
return self.rpcParams
}
func (self *CmdClear) PostprocessRpcParams() error {
return nil
}
func (self *CmdClear) RpcResult() interface{} {
var reply string
return &reply
}

View File

@@ -0,0 +1,66 @@
/*
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdCacheGetGroupItemIDs{
name: "cache_group_item_ids",
rpcMethod: utils.CacheSv1GetGroupItemIDs,
rpcParams: &engine.ArgsGetGroup{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdCacheGetGroupItemIDs struct {
name string
rpcMethod string
rpcParams *engine.ArgsGetGroup
*CommandExecuter
}
func (self *CmdCacheGetGroupItemIDs) Name() string {
return self.name
}
func (self *CmdCacheGetGroupItemIDs) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdCacheGetGroupItemIDs) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.ArgsGetGroup{}
}
return self.rpcParams
}
func (self *CmdCacheGetGroupItemIDs) PostprocessRpcParams() error {
return nil
}
func (self *CmdCacheGetGroupItemIDs) RpcResult() interface{} {
reply := []string{}
return &reply
}

View File

@@ -0,0 +1,66 @@
/*
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdCacheHasGroup{
name: "cache_has_group",
rpcMethod: utils.CacheSv1HasGroup,
rpcParams: &engine.ArgsGetGroup{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdCacheHasGroup struct {
name string
rpcMethod string
rpcParams *engine.ArgsGetGroup
*CommandExecuter
}
func (self *CmdCacheHasGroup) Name() string {
return self.name
}
func (self *CmdCacheHasGroup) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdCacheHasGroup) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.ArgsGetGroup{}
}
return self.rpcParams
}
func (self *CmdCacheHasGroup) PostprocessRpcParams() error {
return nil
}
func (self *CmdCacheHasGroup) RpcResult() interface{} {
var reply bool
return &reply
}

66
console/cache_has_item.go Normal file
View File

@@ -0,0 +1,66 @@
/*
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdCacheHasItem{
name: "cache_has_item",
rpcMethod: utils.CacheSv1HasItem,
rpcParams: &engine.ArgsGetCacheItem{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdCacheHasItem struct {
name string
rpcMethod string
rpcParams *engine.ArgsGetCacheItem
*CommandExecuter
}
func (self *CmdCacheHasItem) Name() string {
return self.name
}
func (self *CmdCacheHasItem) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdCacheHasItem) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.ArgsGetCacheItem{}
}
return self.rpcParams
}
func (self *CmdCacheHasItem) PostprocessRpcParams() error {
return nil
}
func (self *CmdCacheHasItem) RpcResult() interface{} {
var reply bool
return &reply
}

View File

@@ -0,0 +1,66 @@
/*
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdCacheGetItemExpiryTime{
name: "cache_item_expiry_time",
rpcMethod: utils.CacheSv1GetItemExpiryTime,
rpcParams: &engine.ArgsGetCacheItem{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdCacheGetItemExpiryTime struct {
name string
rpcMethod string
rpcParams *engine.ArgsGetCacheItem
*CommandExecuter
}
func (self *CmdCacheGetItemExpiryTime) Name() string {
return self.name
}
func (self *CmdCacheGetItemExpiryTime) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdCacheGetItemExpiryTime) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.ArgsGetCacheItem{}
}
return self.rpcParams
}
func (self *CmdCacheGetItemExpiryTime) PostprocessRpcParams() error {
return nil
}
func (self *CmdCacheGetItemExpiryTime) RpcResult() interface{} {
var reply string
return &reply
}

66
console/cache_item_ids.go Normal file
View File

@@ -0,0 +1,66 @@
/*
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdCacheGetItemIDs{
name: "cache_item_ids",
rpcMethod: utils.CacheSv1GetItemIDs,
rpcParams: &engine.ArgsGetCacheItemIDs{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdCacheGetItemIDs struct {
name string
rpcMethod string
rpcParams *engine.ArgsGetCacheItemIDs
*CommandExecuter
}
func (self *CmdCacheGetItemIDs) Name() string {
return self.name
}
func (self *CmdCacheGetItemIDs) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdCacheGetItemIDs) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.ArgsGetCacheItemIDs{}
}
return self.rpcParams
}
func (self *CmdCacheGetItemIDs) PostprocessRpcParams() error {
return nil
}
func (self *CmdCacheGetItemIDs) RpcResult() interface{} {
reply := []string{}
return &reply
}

View File

@@ -0,0 +1,66 @@
/*
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/ltcache"
)
func init() {
c := &CmdGetPrecacheStatus{
name: "cache_precache_status",
rpcMethod: utils.CacheSv1PrecacheStatus,
rpcParams: []string{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdGetPrecacheStatus struct {
name string
rpcMethod string
rpcParams []string
*CommandExecuter
}
func (self *CmdGetPrecacheStatus) Name() string {
return self.name
}
func (self *CmdGetPrecacheStatus) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetPrecacheStatus) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = []string{}
}
return self.rpcParams
}
func (self *CmdGetPrecacheStatus) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetPrecacheStatus) RpcResult() interface{} {
reply := make(map[string]*ltcache.CacheStats)
return &reply
}

View File

@@ -0,0 +1,66 @@
/*
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdCacheRemoveGroup{
name: "cache_remove_group",
rpcMethod: utils.CacheSv1RemoveGroup,
rpcParams: &engine.ArgsGetGroup{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdCacheRemoveGroup struct {
name string
rpcMethod string
rpcParams *engine.ArgsGetGroup
*CommandExecuter
}
func (self *CmdCacheRemoveGroup) Name() string {
return self.name
}
func (self *CmdCacheRemoveGroup) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdCacheRemoveGroup) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.ArgsGetGroup{}
}
return self.rpcParams
}
func (self *CmdCacheRemoveGroup) PostprocessRpcParams() error {
return nil
}
func (self *CmdCacheRemoveGroup) RpcResult() interface{} {
var reply string
return &reply
}

View File

@@ -0,0 +1,66 @@
/*
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdCacheRemoveItem{
name: "cache_remove_item",
rpcMethod: utils.CacheSv1RemoveItem,
rpcParams: &engine.ArgsGetCacheItem{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdCacheRemoveItem struct {
name string
rpcMethod string
rpcParams *engine.ArgsGetCacheItem
*CommandExecuter
}
func (self *CmdCacheRemoveItem) Name() string {
return self.name
}
func (self *CmdCacheRemoveItem) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdCacheRemoveItem) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.ArgsGetCacheItem{}
}
return self.rpcParams
}
func (self *CmdCacheRemoveItem) PostprocessRpcParams() error {
return nil
}
func (self *CmdCacheRemoveItem) RpcResult() interface{} {
var reply string
return &reply
}

View File

@@ -638,8 +638,18 @@ const (
SMGenericV2UpdateSession = "SMGenericV2.UpdateSession"
)
// Cache
const (
CacheSv1GetCacheStats = "CacheSv1.GetCacheStats"
CacheSv1GetCacheStats = "CacheSv1.GetCacheStats"
CacheSv1GetItemIDs = "CacheSv1.GetItemIDs"
CacheSv1HasItem = "CacheSv1.HasItem"
CacheSv1GetItemExpiryTime = "CacheSv1.GetItemExpiryTime"
CacheSv1RemoveItem = "CacheSv1.RemoveItem"
CacheSv1PrecacheStatus = "CacheSv1.PrecacheStatus"
CacheSv1HasGroup = "CacheSv1.HasGroup"
CacheSv1GetGroupItemIDs = "CacheSv1.GetGroupItemIDs"
CacheSv1RemoveGroup = "CacheSv1.RemoveGroup"
CacheSv1Clear = "CacheSv1.Clear"
)
//CSV file name