github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/notify_runtimestats.go (about)

     1  // Auto-generated to Go types and interfaces using avdl-compiler v1.4.10 (https://github.com/keybase/node-avdl-compiler)
     2  //   Input file: avdl/keybase1/notify_runtimestats.avdl
     3  
     4  package keybase1
     5  
     6  import (
     7  	"fmt"
     8  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
     9  	context "golang.org/x/net/context"
    10  	"time"
    11  )
    12  
    13  type StatsSeverityLevel int
    14  
    15  const (
    16  	StatsSeverityLevel_NORMAL  StatsSeverityLevel = 0
    17  	StatsSeverityLevel_WARNING StatsSeverityLevel = 1
    18  	StatsSeverityLevel_SEVERE  StatsSeverityLevel = 2
    19  )
    20  
    21  func (o StatsSeverityLevel) DeepCopy() StatsSeverityLevel { return o }
    22  
    23  var StatsSeverityLevelMap = map[string]StatsSeverityLevel{
    24  	"NORMAL":  0,
    25  	"WARNING": 1,
    26  	"SEVERE":  2,
    27  }
    28  
    29  var StatsSeverityLevelRevMap = map[StatsSeverityLevel]string{
    30  	0: "NORMAL",
    31  	1: "WARNING",
    32  	2: "SEVERE",
    33  }
    34  
    35  func (e StatsSeverityLevel) String() string {
    36  	if v, ok := StatsSeverityLevelRevMap[e]; ok {
    37  		return v
    38  	}
    39  	return fmt.Sprintf("%v", int(e))
    40  }
    41  
    42  type DbStats struct {
    43  	Type            DbType `codec:"type" json:"type"`
    44  	MemCompActive   bool   `codec:"memCompActive" json:"memCompActive"`
    45  	TableCompActive bool   `codec:"tableCompActive" json:"tableCompActive"`
    46  }
    47  
    48  func (o DbStats) DeepCopy() DbStats {
    49  	return DbStats{
    50  		Type:            o.Type.DeepCopy(),
    51  		MemCompActive:   o.MemCompActive,
    52  		TableCompActive: o.TableCompActive,
    53  	}
    54  }
    55  
    56  type ProcessType int
    57  
    58  const (
    59  	ProcessType_MAIN ProcessType = 0
    60  	ProcessType_KBFS ProcessType = 1
    61  )
    62  
    63  func (o ProcessType) DeepCopy() ProcessType { return o }
    64  
    65  var ProcessTypeMap = map[string]ProcessType{
    66  	"MAIN": 0,
    67  	"KBFS": 1,
    68  }
    69  
    70  var ProcessTypeRevMap = map[ProcessType]string{
    71  	0: "MAIN",
    72  	1: "KBFS",
    73  }
    74  
    75  func (e ProcessType) String() string {
    76  	if v, ok := ProcessTypeRevMap[e]; ok {
    77  		return v
    78  	}
    79  	return fmt.Sprintf("%v", int(e))
    80  }
    81  
    82  type ProcessRuntimeStats struct {
    83  	Type             ProcessType        `codec:"type" json:"type"`
    84  	Cpu              string             `codec:"cpu" json:"cpu"`
    85  	Resident         string             `codec:"resident" json:"resident"`
    86  	Virt             string             `codec:"virt" json:"virt"`
    87  	Free             string             `codec:"free" json:"free"`
    88  	Goheap           string             `codec:"goheap" json:"goheap"`
    89  	Goheapsys        string             `codec:"goheapsys" json:"goheapsys"`
    90  	Goreleased       string             `codec:"goreleased" json:"goreleased"`
    91  	CpuSeverity      StatsSeverityLevel `codec:"cpuSeverity" json:"cpuSeverity"`
    92  	ResidentSeverity StatsSeverityLevel `codec:"residentSeverity" json:"residentSeverity"`
    93  }
    94  
    95  func (o ProcessRuntimeStats) DeepCopy() ProcessRuntimeStats {
    96  	return ProcessRuntimeStats{
    97  		Type:             o.Type.DeepCopy(),
    98  		Cpu:              o.Cpu,
    99  		Resident:         o.Resident,
   100  		Virt:             o.Virt,
   101  		Free:             o.Free,
   102  		Goheap:           o.Goheap,
   103  		Goheapsys:        o.Goheapsys,
   104  		Goreleased:       o.Goreleased,
   105  		CpuSeverity:      o.CpuSeverity.DeepCopy(),
   106  		ResidentSeverity: o.ResidentSeverity.DeepCopy(),
   107  	}
   108  }
   109  
   110  type PerfEventType int
   111  
   112  const (
   113  	PerfEventType_NETWORK      PerfEventType = 0
   114  	PerfEventType_TEAMBOXAUDIT PerfEventType = 1
   115  	PerfEventType_TEAMAUDIT    PerfEventType = 2
   116  	PerfEventType_USERCHAIN    PerfEventType = 3
   117  	PerfEventType_TEAMCHAIN    PerfEventType = 4
   118  	PerfEventType_CLEARCONV    PerfEventType = 5
   119  	PerfEventType_CLEARINBOX   PerfEventType = 6
   120  	PerfEventType_TEAMTREELOAD PerfEventType = 7
   121  )
   122  
   123  func (o PerfEventType) DeepCopy() PerfEventType { return o }
   124  
   125  var PerfEventTypeMap = map[string]PerfEventType{
   126  	"NETWORK":      0,
   127  	"TEAMBOXAUDIT": 1,
   128  	"TEAMAUDIT":    2,
   129  	"USERCHAIN":    3,
   130  	"TEAMCHAIN":    4,
   131  	"CLEARCONV":    5,
   132  	"CLEARINBOX":   6,
   133  	"TEAMTREELOAD": 7,
   134  }
   135  
   136  var PerfEventTypeRevMap = map[PerfEventType]string{
   137  	0: "NETWORK",
   138  	1: "TEAMBOXAUDIT",
   139  	2: "TEAMAUDIT",
   140  	3: "USERCHAIN",
   141  	4: "TEAMCHAIN",
   142  	5: "CLEARCONV",
   143  	6: "CLEARINBOX",
   144  	7: "TEAMTREELOAD",
   145  }
   146  
   147  func (e PerfEventType) String() string {
   148  	if v, ok := PerfEventTypeRevMap[e]; ok {
   149  		return v
   150  	}
   151  	return fmt.Sprintf("%v", int(e))
   152  }
   153  
   154  type PerfEvent struct {
   155  	Message   string        `codec:"message" json:"message"`
   156  	Ctime     Time          `codec:"ctime" json:"ctime"`
   157  	EventType PerfEventType `codec:"eventType" json:"eventType"`
   158  }
   159  
   160  func (o PerfEvent) DeepCopy() PerfEvent {
   161  	return PerfEvent{
   162  		Message:   o.Message,
   163  		Ctime:     o.Ctime.DeepCopy(),
   164  		EventType: o.EventType.DeepCopy(),
   165  	}
   166  }
   167  
   168  type RuntimeStats struct {
   169  	ProcessStats        []ProcessRuntimeStats `codec:"processStats" json:"processStats"`
   170  	DbStats             []DbStats             `codec:"dbStats" json:"dbStats"`
   171  	PerfEvents          []PerfEvent           `codec:"perfEvents" json:"perfEvents"`
   172  	ConvLoaderActive    bool                  `codec:"convLoaderActive" json:"convLoaderActive"`
   173  	SelectiveSyncActive bool                  `codec:"selectiveSyncActive" json:"selectiveSyncActive"`
   174  }
   175  
   176  func (o RuntimeStats) DeepCopy() RuntimeStats {
   177  	return RuntimeStats{
   178  		ProcessStats: (func(x []ProcessRuntimeStats) []ProcessRuntimeStats {
   179  			if x == nil {
   180  				return nil
   181  			}
   182  			ret := make([]ProcessRuntimeStats, len(x))
   183  			for i, v := range x {
   184  				vCopy := v.DeepCopy()
   185  				ret[i] = vCopy
   186  			}
   187  			return ret
   188  		})(o.ProcessStats),
   189  		DbStats: (func(x []DbStats) []DbStats {
   190  			if x == nil {
   191  				return nil
   192  			}
   193  			ret := make([]DbStats, len(x))
   194  			for i, v := range x {
   195  				vCopy := v.DeepCopy()
   196  				ret[i] = vCopy
   197  			}
   198  			return ret
   199  		})(o.DbStats),
   200  		PerfEvents: (func(x []PerfEvent) []PerfEvent {
   201  			if x == nil {
   202  				return nil
   203  			}
   204  			ret := make([]PerfEvent, len(x))
   205  			for i, v := range x {
   206  				vCopy := v.DeepCopy()
   207  				ret[i] = vCopy
   208  			}
   209  			return ret
   210  		})(o.PerfEvents),
   211  		ConvLoaderActive:    o.ConvLoaderActive,
   212  		SelectiveSyncActive: o.SelectiveSyncActive,
   213  	}
   214  }
   215  
   216  type RuntimeStatsUpdateArg struct {
   217  	Stats *RuntimeStats `codec:"stats,omitempty" json:"stats,omitempty"`
   218  }
   219  
   220  type NotifyRuntimeStatsInterface interface {
   221  	RuntimeStatsUpdate(context.Context, *RuntimeStats) error
   222  }
   223  
   224  func NotifyRuntimeStatsProtocol(i NotifyRuntimeStatsInterface) rpc.Protocol {
   225  	return rpc.Protocol{
   226  		Name: "keybase.1.NotifyRuntimeStats",
   227  		Methods: map[string]rpc.ServeHandlerDescription{
   228  			"runtimeStatsUpdate": {
   229  				MakeArg: func() interface{} {
   230  					var ret [1]RuntimeStatsUpdateArg
   231  					return &ret
   232  				},
   233  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   234  					typedArgs, ok := args.(*[1]RuntimeStatsUpdateArg)
   235  					if !ok {
   236  						err = rpc.NewTypeError((*[1]RuntimeStatsUpdateArg)(nil), args)
   237  						return
   238  					}
   239  					err = i.RuntimeStatsUpdate(ctx, typedArgs[0].Stats)
   240  					return
   241  				},
   242  			},
   243  		},
   244  	}
   245  }
   246  
   247  type NotifyRuntimeStatsClient struct {
   248  	Cli rpc.GenericClient
   249  }
   250  
   251  func (c NotifyRuntimeStatsClient) RuntimeStatsUpdate(ctx context.Context, stats *RuntimeStats) (err error) {
   252  	__arg := RuntimeStatsUpdateArg{Stats: stats}
   253  	err = c.Cli.Notify(ctx, "keybase.1.NotifyRuntimeStats.runtimeStatsUpdate", []interface{}{__arg}, 0*time.Millisecond)
   254  	return
   255  }