From b1236429a119120f7e70463e165c6c0e15d6eafb Mon Sep 17 00:00:00 2001 From: CMGS Date: Fri, 26 May 2023 13:55:36 +0800 Subject: [PATCH] use any replace interface{} --- auth/auth.go | 4 +- auth/simple/simple.go | 4 +- client/interceptor/retry.go | 6 +- client/interceptor/types.go | 2 +- cluster/calcium/wal.go | 32 ++-- go.mod | 2 +- go.sum | 4 +- log/field.go | 26 +-- log/inner.go | 18 +-- log/log.go | 20 +-- log/sentry.go | 2 +- resource/cobalt/node.go | 1 + resource/plugins/binary/call.go | 4 +- resource/plugins/cpumem/calculate.go | 8 +- resource/plugins/cpumem/metrics.go | 6 +- resource/plugins/cpumem/node.go | 14 +- resource/plugins/cpumem/schedule/schedule.go | 4 +- resource/plugins/cpumem/types/cpu.go | 2 +- resource/plugins/cpumem/types/node.go | 8 +- resource/plugins/cpumem/types/workload.go | 14 +- resource/types/resource.go | 8 +- rpc/gen/core.pb.go | 158 +++++++++---------- rpc/gen/core_grpc.pb.go | 132 ++++++++-------- rpc/rpc.go | 2 +- rpc/transform.go | 2 +- strategy/communism.go | 4 +- strategy/global.go | 4 +- utils/gopool.go | 2 +- wal/hydro.go | 2 +- wal/wal.go | 10 +- 30 files changed, 253 insertions(+), 252 deletions(-) diff --git a/auth/auth.go b/auth/auth.go index 73b6cfe9f..d74c77a39 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -11,8 +11,8 @@ import ( // Auth define auth obj type Auth interface { - StreamInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error - UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) + StreamInterceptor(srv any, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error + UnaryInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) } // NewAuth return auth obj diff --git a/auth/simple/simple.go b/auth/simple/simple.go index 546c02eaf..58dd1f68a 100644 --- a/auth/simple/simple.go +++ b/auth/simple/simple.go @@ -21,7 +21,7 @@ func NewBasicAuth(username, password string) *BasicAuth { } // StreamInterceptor define stream interceptor -func (b *BasicAuth) StreamInterceptor(srv interface{}, stream grpc.ServerStream, _ *grpc.StreamServerInfo, handler grpc.StreamHandler) error { +func (b *BasicAuth) StreamInterceptor(srv any, stream grpc.ServerStream, _ *grpc.StreamServerInfo, handler grpc.StreamHandler) error { ctx := stream.Context() if err := b.doAuth(ctx); err != nil { return err @@ -30,7 +30,7 @@ func (b *BasicAuth) StreamInterceptor(srv interface{}, stream grpc.ServerStream, } // UnaryInterceptor define unary interceptor -func (b *BasicAuth) UnaryInterceptor(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { +func (b *BasicAuth) UnaryInterceptor(ctx context.Context, req any, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) { if err := b.doAuth(ctx); err != nil { return nil, err } diff --git a/client/interceptor/retry.go b/client/interceptor/retry.go index 37bd13410..86f2876a7 100644 --- a/client/interceptor/retry.go +++ b/client/interceptor/retry.go @@ -12,7 +12,7 @@ import ( // NewUnaryRetry makes unary RPC retry on error func NewUnaryRetry(retryOpts RetryOptions) grpc.UnaryClientInterceptor { - return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + return func(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { return backoff.Retry(func() error { return invoker(ctx, method, req, reply, cc, opts...) }, backoff.WithMaxRetries(backoff.WithContext(backoff.NewExponentialBackOff(), ctx), uint64(retryOpts.Max))) @@ -45,14 +45,14 @@ func NewStreamRetry(retryOpts RetryOptions) grpc.StreamClientInterceptor { } } -func (s *retryStream) SendMsg(m interface{}) error { +func (s *retryStream) SendMsg(m any) error { s.mux.Lock() s.sent = m s.mux.Unlock() return s.getStream().SendMsg(m) } -func (s *retryStream) RecvMsg(m interface{}) (err error) { +func (s *retryStream) RecvMsg(m any) (err error) { if err = s.ClientStream.RecvMsg(m); err == nil || errors.Is(err, context.Canceled) { return } diff --git a/client/interceptor/types.go b/client/interceptor/types.go index 728b28758..82363a4b3 100644 --- a/client/interceptor/types.go +++ b/client/interceptor/types.go @@ -16,7 +16,7 @@ type retryStream struct { ctx context.Context grpc.ClientStream mux sync.RWMutex - sent interface{} + sent any newStream func() (grpc.ClientStream, error) retryOpts RetryOptions } diff --git a/cluster/calcium/wal.go b/cluster/calcium/wal.go index 867c9be59..739917c09 100644 --- a/cluster/calcium/wal.go +++ b/cluster/calcium/wal.go @@ -59,12 +59,12 @@ func (h *CreateLambdaHandler) Typ() string { } // Check . -func (h *CreateLambdaHandler) Check(context.Context, interface{}) (bool, error) { +func (h *CreateLambdaHandler) Check(context.Context, any) (bool, error) { return true, nil } // Encode . -func (h *CreateLambdaHandler) Encode(raw interface{}) ([]byte, error) { +func (h *CreateLambdaHandler) Encode(raw any) ([]byte, error) { workloadID, ok := raw.(string) if !ok { return nil, errors.Wrapf(types.ErrInvalidWALDataType, "%+v", raw) @@ -73,12 +73,12 @@ func (h *CreateLambdaHandler) Encode(raw interface{}) ([]byte, error) { } // Decode . -func (h *CreateLambdaHandler) Decode(bs []byte) (interface{}, error) { +func (h *CreateLambdaHandler) Decode(bs []byte) (any, error) { return string(bs), nil } // Handle . -func (h *CreateLambdaHandler) Handle(ctx context.Context, raw interface{}) error { +func (h *CreateLambdaHandler) Handle(ctx context.Context, raw any) error { workloadID, ok := raw.(string) if !ok { return errors.Wrapf(types.ErrInvalidWALDataType, "%+v", raw) @@ -133,7 +133,7 @@ func (h *CreateWorkloadHandler) Typ() string { } // Check . -func (h *CreateWorkloadHandler) Check(_ context.Context, raw interface{}) (handle bool, err error) { +func (h *CreateWorkloadHandler) Check(_ context.Context, raw any) (handle bool, err error) { _, ok := raw.(*types.Workload) if !ok { return false, errors.Wrapf(types.ErrInvalidWALDataType, "%+v", raw) @@ -142,7 +142,7 @@ func (h *CreateWorkloadHandler) Check(_ context.Context, raw interface{}) (handl } // Encode . -func (h *CreateWorkloadHandler) Encode(raw interface{}) ([]byte, error) { +func (h *CreateWorkloadHandler) Encode(raw any) ([]byte, error) { wrk, ok := raw.(*types.Workload) if !ok { return nil, errors.Wrapf(types.ErrInvalidWALDataType, "%+v", raw) @@ -151,14 +151,14 @@ func (h *CreateWorkloadHandler) Encode(raw interface{}) ([]byte, error) { } // Decode . -func (h *CreateWorkloadHandler) Decode(bs []byte) (interface{}, error) { +func (h *CreateWorkloadHandler) Decode(bs []byte) (any, error) { wrk := &types.Workload{} err := json.Unmarshal(bs, wrk) return wrk, err } // Handle will remove instance, remove meta, restore resource -func (h *CreateWorkloadHandler) Handle(ctx context.Context, raw interface{}) (err error) { +func (h *CreateWorkloadHandler) Handle(ctx context.Context, raw any) (err error) { wrk, _ := raw.(*types.Workload) logger := log.WithFunc("wal.CreateWorkloadHandler.Handle").WithField("ID", wrk.ID).WithField("node", wrk.Nodename) @@ -210,7 +210,7 @@ func (h *WorkloadResourceAllocatedHandler) Typ() string { } // Check . -func (h *WorkloadResourceAllocatedHandler) Check(_ context.Context, raw interface{}) (bool, error) { +func (h *WorkloadResourceAllocatedHandler) Check(_ context.Context, raw any) (bool, error) { if _, ok := raw.([]*types.Node); !ok { return false, errors.Wrapf(types.ErrInvalidWALDataType, "%+v", raw) } @@ -218,7 +218,7 @@ func (h *WorkloadResourceAllocatedHandler) Check(_ context.Context, raw interfac } // Encode . -func (h *WorkloadResourceAllocatedHandler) Encode(raw interface{}) ([]byte, error) { +func (h *WorkloadResourceAllocatedHandler) Encode(raw any) ([]byte, error) { nodes, ok := raw.([]*types.Node) if !ok { return nil, errors.Wrapf(types.ErrInvalidWALDataType, "%+v", raw) @@ -227,13 +227,13 @@ func (h *WorkloadResourceAllocatedHandler) Encode(raw interface{}) ([]byte, erro } // Decode . -func (h *WorkloadResourceAllocatedHandler) Decode(bytes []byte) (interface{}, error) { +func (h *WorkloadResourceAllocatedHandler) Decode(bytes []byte) (any, error) { nodes := []*types.Node{} return nodes, json.Unmarshal(bytes, &nodes) } // Handle . -func (h *WorkloadResourceAllocatedHandler) Handle(ctx context.Context, raw interface{}) (err error) { +func (h *WorkloadResourceAllocatedHandler) Handle(ctx context.Context, raw any) (err error) { nodes, _ := raw.([]*types.Node) logger := log.WithFunc("wal.WorkloadResourceAllocatedHandler.Handle").WithField("event", eventWorkloadResourceAllocated) @@ -281,7 +281,7 @@ func (h *ProcessingCreatedHandler) Typ() string { } // Check . -func (h ProcessingCreatedHandler) Check(_ context.Context, raw interface{}) (bool, error) { +func (h ProcessingCreatedHandler) Check(_ context.Context, raw any) (bool, error) { if _, ok := raw.(*types.Processing); !ok { return false, errors.Wrapf(types.ErrInvalidWALDataType, "%+v", raw) } @@ -289,7 +289,7 @@ func (h ProcessingCreatedHandler) Check(_ context.Context, raw interface{}) (boo } // Encode . -func (h *ProcessingCreatedHandler) Encode(raw interface{}) ([]byte, error) { +func (h *ProcessingCreatedHandler) Encode(raw any) ([]byte, error) { processing, ok := raw.(*types.Processing) if !ok { return nil, errors.Wrapf(types.ErrInvalidWALDataType, "%+v", raw) @@ -298,13 +298,13 @@ func (h *ProcessingCreatedHandler) Encode(raw interface{}) ([]byte, error) { } // Decode . -func (h *ProcessingCreatedHandler) Decode(bs []byte) (interface{}, error) { +func (h *ProcessingCreatedHandler) Decode(bs []byte) (any, error) { processing := &types.Processing{} return processing, json.Unmarshal(bs, processing) } // Handle . -func (h *ProcessingCreatedHandler) Handle(ctx context.Context, raw interface{}) (err error) { +func (h *ProcessingCreatedHandler) Handle(ctx context.Context, raw any) (err error) { processing, _ := raw.(*types.Processing) logger := log.WithFunc("wal.ProcessingCreatedHandler.Handle").WithField("event", eventProcessingCreated).WithField("ident", processing.Ident) diff --git a/go.mod b/go.mod index e4550bf15..d18ebfb14 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b github.com/panjf2000/ants/v2 v2.7.3 github.com/patrickmn/go-cache v2.1.0+incompatible - github.com/projecteru2/libyavirt v0.0.0-20230517062159-0c31f81550f3 + github.com/projecteru2/libyavirt v0.0.0-20230524090109-0faf050e0f3b github.com/prometheus/client_golang v1.15.0 github.com/rs/zerolog v1.29.1 github.com/sanity-io/litter v1.5.5 diff --git a/go.sum b/go.sum index 734456dec..f69133851 100644 --- a/go.sum +++ b/go.sum @@ -459,8 +459,8 @@ github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= -github.com/projecteru2/libyavirt v0.0.0-20230517062159-0c31f81550f3 h1:pjNFOoEalyROX9YfdxFXaNg4liZV/RASfhaVqJ4EnBQ= -github.com/projecteru2/libyavirt v0.0.0-20230517062159-0c31f81550f3/go.mod h1:N41KaKmqbailweGs4x/mt2H0O0Y7MizObZQ+igLdzpw= +github.com/projecteru2/libyavirt v0.0.0-20230524090109-0faf050e0f3b h1:mXvbNYdr2uh2mhk5HdiBBSc9DhaR2RuulURaXhJaP2I= +github.com/projecteru2/libyavirt v0.0.0-20230524090109-0faf050e0f3b/go.mod h1:N41KaKmqbailweGs4x/mt2H0O0Y7MizObZQ+igLdzpw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= diff --git a/log/field.go b/log/field.go index f0be7a37b..23feb9f49 100644 --- a/log/field.go +++ b/log/field.go @@ -9,7 +9,7 @@ import ( // Fields is a wrapper for zerolog.Entry // we need to insert some sentry captures here type Fields struct { - kv *haxmap.Map[string, interface{}] + kv *haxmap.Map[string, any] } // WithFunc is short for WithField @@ -18,8 +18,8 @@ func WithFunc(fname string) *Fields { } // WithField add kv into log entry -func WithField(key string, value interface{}) *Fields { - r := haxmap.New[string, interface{}]() +func WithField(key string, value any) *Fields { + r := haxmap.New[string, any]() r.Set(key, value) return &Fields{ kv: r, @@ -27,52 +27,52 @@ func WithField(key string, value interface{}) *Fields { } // WithField . -func (f *Fields) WithField(key string, value interface{}) *Fields { +func (f *Fields) WithField(key string, value any) *Fields { f.kv.Set(key, value) return f } // Fatalf forwards to sentry -func (f Fields) Fatalf(ctx context.Context, err error, format string, args ...interface{}) { +func (f Fields) Fatalf(ctx context.Context, err error, format string, args ...any) { fatalf(ctx, err, format, f.kv, args...) } // Warnf is Warnf -func (f Fields) Warnf(ctx context.Context, format string, args ...interface{}) { +func (f Fields) Warnf(ctx context.Context, format string, args ...any) { warnf(ctx, format, f.kv, args...) } // Warn is Warn -func (f Fields) Warn(ctx context.Context, args ...interface{}) { +func (f Fields) Warn(ctx context.Context, args ...any) { f.Warnf(ctx, "%+v", args...) } // Infof is Infof -func (f Fields) Infof(ctx context.Context, format string, args ...interface{}) { +func (f Fields) Infof(ctx context.Context, format string, args ...any) { infof(ctx, format, f.kv, args...) } // Info is Info -func (f Fields) Info(ctx context.Context, args ...interface{}) { +func (f Fields) Info(ctx context.Context, args ...any) { f.Infof(ctx, "%+v", args...) } // Debugf is Debugf -func (f Fields) Debugf(ctx context.Context, format string, args ...interface{}) { +func (f Fields) Debugf(ctx context.Context, format string, args ...any) { debugf(ctx, format, f.kv, args...) } // Debug is Debug -func (f Fields) Debug(ctx context.Context, args ...interface{}) { +func (f Fields) Debug(ctx context.Context, args ...any) { f.Debugf(ctx, "%+v", args...) } // Errorf forwards to sentry -func (f Fields) Errorf(ctx context.Context, err error, format string, args ...interface{}) { +func (f Fields) Errorf(ctx context.Context, err error, format string, args ...any) { errorf(ctx, err, format, f.kv, args...) } // Error forwards to sentry -func (f Fields) Error(ctx context.Context, err error, args ...interface{}) { +func (f Fields) Error(ctx context.Context, err error, args ...any) { f.Errorf(ctx, err, "%+v", args...) } diff --git a/log/inner.go b/log/inner.go index a2449bc00..52cbd856e 100644 --- a/log/inner.go +++ b/log/inner.go @@ -8,32 +8,32 @@ import ( "github.com/rs/zerolog" ) -func fatalf(ctx context.Context, err error, format string, fields *haxmap.Map[string, interface{}], args ...interface{}) { +func fatalf(ctx context.Context, err error, format string, fields *haxmap.Map[string, any], args ...any) { args = argsValidate(args) reportToSentry(ctx, sentry.LevelFatal, err, format, args...) f := globalLogger.Fatal() wrap(f, fields).Err(err).Msgf(format, args...) } -func warnf(_ context.Context, format string, fields *haxmap.Map[string, interface{}], args ...interface{}) { +func warnf(_ context.Context, format string, fields *haxmap.Map[string, any], args ...any) { args = argsValidate(args) f := globalLogger.Warn() wrap(f, fields).Msgf(format, args...) } -func infof(_ context.Context, format string, fields *haxmap.Map[string, interface{}], args ...interface{}) { +func infof(_ context.Context, format string, fields *haxmap.Map[string, any], args ...any) { args = argsValidate(args) f := globalLogger.Info() wrap(f, fields).Msgf(format, args...) } -func debugf(_ context.Context, format string, fields *haxmap.Map[string, interface{}], args ...interface{}) { +func debugf(_ context.Context, format string, fields *haxmap.Map[string, any], args ...any) { args = argsValidate(args) f := globalLogger.Debug() wrap(f, fields).Msgf(format, args...) } -func errorf(ctx context.Context, err error, format string, fields *haxmap.Map[string, interface{}], args ...interface{}) { +func errorf(ctx context.Context, err error, format string, fields *haxmap.Map[string, any], args ...any) { if err == nil { return } @@ -43,18 +43,18 @@ func errorf(ctx context.Context, err error, format string, fields *haxmap.Map[st wrap(f, fields).Stack().Err(err).Msgf(format, args...) } -func argsValidate(args []interface{}) []interface{} { +func argsValidate(args []any) []any { if len(args) > 0 { return args } - return []interface{}{""} + return []any{""} } -func wrap(f *zerolog.Event, kv *haxmap.Map[string, interface{}]) *zerolog.Event { +func wrap(f *zerolog.Event, kv *haxmap.Map[string, any]) *zerolog.Event { if kv == nil { return f } - kv.ForEach(func(k string, v interface{}) bool { + kv.ForEach(func(k string, v any) bool { f = f.Interface(k, v) return true }) diff --git a/log/log.go b/log/log.go index b798773ca..eda052faa 100644 --- a/log/log.go +++ b/log/log.go @@ -30,7 +30,7 @@ func SetupLog(ctx context.Context, l, dsn string) error { TimeFormat: time.RFC822, }).With().Timestamp().Logger() rslog.Level(level) - zerolog.ErrorStackMarshaler = func(err error) interface{} { + zerolog.ErrorStackMarshaler = func(err error) any { return errors.GetSafeDetails(err).SafeDetails } globalLogger = rslog @@ -44,46 +44,46 @@ func SetupLog(ctx context.Context, l, dsn string) error { } // Fatalf forwards to sentry -func Fatalf(ctx context.Context, err error, format string, args ...interface{}) { +func Fatalf(ctx context.Context, err error, format string, args ...any) { fatalf(ctx, err, format, nil, args...) } // Warnf is Warnf -func Warnf(ctx context.Context, format string, args ...interface{}) { +func Warnf(ctx context.Context, format string, args ...any) { warnf(ctx, format, nil, args...) } // Warn is Warn -func Warn(ctx context.Context, args ...interface{}) { +func Warn(ctx context.Context, args ...any) { Warnf(ctx, "%+v", args...) } // Infof is Infof -func Infof(ctx context.Context, format string, args ...interface{}) { +func Infof(ctx context.Context, format string, args ...any) { infof(ctx, format, nil, args...) } // Info is Info -func Info(ctx context.Context, args ...interface{}) { +func Info(ctx context.Context, args ...any) { Infof(ctx, "%+v", args...) } // Debugf is Debugf -func Debugf(ctx context.Context, format string, args ...interface{}) { +func Debugf(ctx context.Context, format string, args ...any) { debugf(ctx, format, nil, args...) } // Debug is Debug -func Debug(ctx context.Context, args ...interface{}) { +func Debug(ctx context.Context, args ...any) { Debugf(ctx, "%+v", args...) } // Errorf forwards to sentry -func Errorf(ctx context.Context, err error, format string, args ...interface{}) { +func Errorf(ctx context.Context, err error, format string, args ...any) { errorf(ctx, err, format, nil, args...) } // Error forwards to sentry -func Error(ctx context.Context, err error, args ...interface{}) { +func Error(ctx context.Context, err error, args ...any) { Errorf(ctx, err, "%+v", args...) } diff --git a/log/sentry.go b/log/sentry.go index 374cb0006..ce9ce6f6c 100644 --- a/log/sentry.go +++ b/log/sentry.go @@ -44,7 +44,7 @@ func genGRPCTracingInfo(ctx context.Context) (tracingInfo string) { return } -func reportToSentry(ctx context.Context, level sentry.Level, err error, format string, args ...interface{}) { //nolint +func reportToSentry(ctx context.Context, level sentry.Level, err error, format string, args ...any) { //nolint if sentryDSN == "" { return } diff --git a/resource/cobalt/node.go b/resource/cobalt/node.go index fcdef84aa..fc6532939 100644 --- a/resource/cobalt/node.go +++ b/resource/cobalt/node.go @@ -33,6 +33,7 @@ func (m Manager) AddNode(ctx context.Context, nodename string, opts resourcetype resps, err := call(ctx, m.plugins, func(plugin plugins.Plugin) (*plugintypes.AddNodeResponse, error) { r := opts[plugin.Name()] if r == nil { + logger.WithField("plugin", plugin.Name()).Warn(ctx, "empty plugin config") return &plugintypes.AddNodeResponse{}, nil } logger.WithField("plugin", plugin.Name()).WithField("node", nodename).Infof(ctx, "%v", litter.Sdump(r)) diff --git a/resource/plugins/binary/call.go b/resource/plugins/binary/call.go index d4e731670..df85f970b 100644 --- a/resource/plugins/binary/call.go +++ b/resource/plugins/binary/call.go @@ -10,7 +10,7 @@ import ( ) // calls the plugin and gets json response -func (p Plugin) call(ctx context.Context, cmd string, req interface{}, resp interface{}) error { +func (p Plugin) call(ctx context.Context, cmd string, req any, resp any) error { ctx, cancel := context.WithTimeout(ctx, p.config.ResourcePlugin.CallTimeout) defer cancel() logger := log.WithFunc("resource.binary.call") @@ -30,7 +30,7 @@ func (p Plugin) call(ctx context.Context, cmd string, req interface{}, resp inte return json.Unmarshal(out, resp) } -func (p Plugin) execCommand(ctx context.Context, cmd *exec.Cmd, req interface{}) ([]byte, error) { +func (p Plugin) execCommand(ctx context.Context, cmd *exec.Cmd, req any) ([]byte, error) { logger := log.WithFunc("resource.binary.execCommand") b, err := json.Marshal(req) if err != nil { diff --git a/resource/plugins/cpumem/calculate.go b/resource/plugins/cpumem/calculate.go index a1cacc0e1..fae65f83f 100644 --- a/resource/plugins/cpumem/calculate.go +++ b/resource/plugins/cpumem/calculate.go @@ -43,7 +43,7 @@ func (p Plugin) CalculateDeploy(ctx context.Context, nodename string, deployCoun } resp := &plugintypes.CalculateDeployResponse{} - return resp, mapstructure.Decode(map[string]interface{}{ + return resp, mapstructure.Decode(map[string]any{ "engines_params": enginesParams, "workloads_resource": workloadsResource, }, resp) @@ -132,7 +132,7 @@ func (p Plugin) CalculateRealloc(ctx context.Context, nodename string, resource deltaWorkloadResource.Sub(originResource) resp := &plugintypes.CalculateReallocResponse{} - return resp, mapstructure.Decode(map[string]interface{}{ + return resp, mapstructure.Decode(map[string]any{ "engine_params": engineParams, "delta_resource": deltaWorkloadResource, "workload_resource": newResource, @@ -144,7 +144,7 @@ func (p Plugin) CalculateRemap(ctx context.Context, nodename string, workloadsRe resp := &plugintypes.CalculateRemapResponse{} engineParamsMap := map[string]*cpumemtypes.EngineParams{} if len(workloadsResource) == 0 { - return resp, mapstructure.Decode(map[string]interface{}{ + return resp, mapstructure.Decode(map[string]any{ "engine_params_map": engineParamsMap, }, resp) } @@ -192,7 +192,7 @@ func (p Plugin) CalculateRemap(ctx context.Context, nodename string, workloadsRe } } - return resp, mapstructure.Decode(map[string]interface{}{ + return resp, mapstructure.Decode(map[string]any{ "engine_params_map": engineParamsMap, }, resp) } diff --git a/resource/plugins/cpumem/metrics.go b/resource/plugins/cpumem/metrics.go index 98747922b..903dd3fdc 100644 --- a/resource/plugins/cpumem/metrics.go +++ b/resource/plugins/cpumem/metrics.go @@ -12,7 +12,7 @@ import ( // GetMetricsDescription . func (p Plugin) GetMetricsDescription(context.Context) (*plugintypes.GetMetricsDescriptionResponse, error) { resp := &plugintypes.GetMetricsDescriptionResponse{} - return resp, mapstructure.Decode([]map[string]interface{}{ + return resp, mapstructure.Decode([]map[string]any{ { "name": "cpu_map", "help": "node available cpu.", @@ -47,7 +47,7 @@ func (p Plugin) GetMetrics(ctx context.Context, podname, nodename string) (*plug return nil, err } safeNodename := strings.ReplaceAll(nodename, ".", "_") - metrics := []map[string]interface{}{ + metrics := []map[string]any{ { "name": "memory_capacity", "labels": []string{podname, nodename}, @@ -69,7 +69,7 @@ func (p Plugin) GetMetrics(ctx context.Context, podname, nodename string) (*plug } for cpuID, pieces := range nodeResourceInfo.Usage.CPUMap { - metrics = append(metrics, map[string]interface{}{ + metrics = append(metrics, map[string]any{ "name": "cpu_map", "labels": []string{podname, nodename, cpuID}, "value": fmt.Sprintf("%+v", pieces), diff --git a/resource/plugins/cpumem/node.go b/resource/plugins/cpumem/node.go index 82f075353..db53a0a31 100644 --- a/resource/plugins/cpumem/node.go +++ b/resource/plugins/cpumem/node.go @@ -75,7 +75,7 @@ func (p Plugin) AddNode(ctx context.Context, nodename string, resource plugintyp } resp := &plugintypes.AddNodeResponse{} - return resp, mapstructure.Decode(map[string]interface{}{ + return resp, mapstructure.Decode(map[string]any{ "capacity": nodeResourceInfo.Capacity, "usage": nodeResourceInfo.Usage, }, resp) @@ -124,7 +124,7 @@ func (p Plugin) GetNodesDeployCapacity(ctx context.Context, nodenames []string, } resp := &plugintypes.GetNodesDeployCapacityResponse{} - return resp, mapstructure.Decode(map[string]interface{}{ + return resp, mapstructure.Decode(map[string]any{ "nodes_deploy_capacity_map": nodesDeployCapacityMap, "total": total, }, resp) @@ -160,7 +160,7 @@ func (p Plugin) SetNodeResourceCapacity(ctx context.Context, nodename string, re } resp := &plugintypes.SetNodeResourceCapacityResponse{} - return resp, mapstructure.Decode(map[string]interface{}{ + return resp, mapstructure.Decode(map[string]any{ "before": before, "after": nodeResourceInfo.Capacity, }, resp) @@ -174,7 +174,7 @@ func (p Plugin) GetNodeResourceInfo(ctx context.Context, nodename string, worklo } resp := &plugintypes.GetNodeResourceInfoResponse{} - return resp, mapstructure.Decode(map[string]interface{}{ + return resp, mapstructure.Decode(map[string]any{ "capacity": nodeResourceInfo.Capacity, "usage": nodeResourceInfo.Usage, "diffs": diffs, @@ -217,7 +217,7 @@ func (p Plugin) SetNodeResourceUsage(ctx context.Context, nodename string, resou } resp := &plugintypes.SetNodeResourceUsageResponse{} - return resp, mapstructure.Decode(map[string]interface{}{ + return resp, mapstructure.Decode(map[string]any{ "before": before, "after": nodeResourceInfo.Usage, }, resp) @@ -244,7 +244,7 @@ func (p Plugin) GetMostIdleNode(ctx context.Context, nodenames []string) (*plugi } resp := &plugintypes.GetMostIdleNodeResponse{} - return resp, mapstructure.Decode(map[string]interface{}{ + return resp, mapstructure.Decode(map[string]any{ "nodename": mostIdleNode, "priority": priority, }, resp) @@ -271,7 +271,7 @@ func (p Plugin) FixNodeResource(ctx context.Context, nodename string, workloadsR } resp := &plugintypes.GetNodeResourceInfoResponse{} - return resp, mapstructure.Decode(map[string]interface{}{ + return resp, mapstructure.Decode(map[string]any{ "capacity": nodeResourceInfo.Capacity, "usage": nodeResourceInfo.Usage, "diffs": diffs, diff --git a/resource/plugins/cpumem/schedule/schedule.go b/resource/plugins/cpumem/schedule/schedule.go index 1761a58c0..7813c7d74 100644 --- a/resource/plugins/cpumem/schedule/schedule.go +++ b/resource/plugins/cpumem/schedule/schedule.go @@ -38,12 +38,12 @@ func (c cpuCoreHeap) Swap(i, j int) { } // Push . -func (c *cpuCoreHeap) Push(x interface{}) { +func (c *cpuCoreHeap) Push(x any) { *c = append(*c, x.(*cpuCore)) } // Pop . -func (c *cpuCoreHeap) Pop() interface{} { +func (c *cpuCoreHeap) Pop() any { old := *c n := len(old) x := old[n-1] diff --git a/resource/plugins/cpumem/types/cpu.go b/resource/plugins/cpumem/types/cpu.go index f174e83fe..8dd89b3ea 100644 --- a/resource/plugins/cpumem/types/cpu.go +++ b/resource/plugins/cpumem/types/cpu.go @@ -35,7 +35,7 @@ func (c CPUMap) Add(c1 CPUMap) { // NUMA map[cpuID]nodeID type NUMA map[string]string -// NUMAMemory . +// NUMAMemory map[nodeID]memory type NUMAMemory map[string]int64 // Add . diff --git a/resource/plugins/cpumem/types/node.go b/resource/plugins/cpumem/types/node.go index 0ab393bde..14d92f3d0 100644 --- a/resource/plugins/cpumem/types/node.go +++ b/resource/plugins/cpumem/types/node.go @@ -172,10 +172,10 @@ func (n *NodeResourceInfo) GetAvailableResource() *NodeResource { // NodeResourceRequest includes all possible fields passed by eru-core for editing node, it not parsed! type NodeResourceRequest struct { - CPUMap CPUMap `json:"cpu_map"` - Memory int64 `json:"memory"` - NUMA NUMA `json:"numa"` - NUMAMemory NUMAMemory `json:"numa_memory"` + CPUMap CPUMap + Memory int64 + NUMA NUMA + NUMAMemory NUMAMemory } func (n *NodeResourceRequest) Parse(config coretypes.Config, rawParams resourcetypes.RawParams) error { diff --git a/resource/plugins/cpumem/types/workload.go b/resource/plugins/cpumem/types/workload.go index 85685ac62..cb073ebd1 100644 --- a/resource/plugins/cpumem/types/workload.go +++ b/resource/plugins/cpumem/types/workload.go @@ -70,15 +70,15 @@ func (w *WorkloadResource) Sub(w1 *WorkloadResource) { w.NUMAMemory.Sub(w1.NUMAMemory) } -// WorkloadResourceRaw includes all possible fields passed by eru-core for editing workload +// WorkloadResourceRequest includes all possible fields passed by eru-core for editing workload // for request calculation type WorkloadResourceRequest struct { - CPUBind bool `json:"cpu_bind"` - KeepCPUBind bool `json:"keep_cpu_bind"` - CPURequest float64 `json:"cpu_request"` - CPULimit float64 `json:"cpu_limit"` - MemRequest int64 `json:"mem_request"` - MemLimit int64 `json:"mem_limit"` + CPUBind bool + KeepCPUBind bool + CPURequest float64 + CPULimit float64 + MemRequest int64 + MemLimit int64 } // Validate . diff --git a/resource/types/resource.go b/resource/types/resource.go index f3d460e6d..d2c026ed4 100644 --- a/resource/types/resource.go +++ b/resource/types/resource.go @@ -8,7 +8,7 @@ import ( ) // RawParams . -type RawParams map[string]interface{} +type RawParams map[string]any // IsSet . func (r RawParams) IsSet(key string) bool { @@ -72,7 +72,7 @@ func (r RawParams) Bool(key string) bool { func (r RawParams) RawParams(key string) RawParams { var n RawParams if r.IsSet(key) { - if m, ok := r[key].(map[string]interface{}); ok { + if m, ok := r[key].(map[string]any); ok { n = RawParams{} _ = mapstructure.Decode(m, &n) } @@ -82,7 +82,7 @@ func (r RawParams) RawParams(key string) RawParams { // SliceRawParams . func (r RawParams) SliceRawParams(key string) []RawParams { - res := sliceHelper[map[string]interface{}](r, key) + res := sliceHelper[map[string]any](r, key) if res == nil { return nil } @@ -101,7 +101,7 @@ func sliceHelper[T any](r RawParams, key string) []T { return s } var res []T - if s, ok := r[key].([]interface{}); ok { + if s, ok := r[key].([]any); ok { res = []T{} for _, v := range s { if r, ok := v.(T); ok { diff --git a/rpc/gen/core.pb.go b/rpc/gen/core.pb.go index af4c13ce8..b97394fd1 100644 --- a/rpc/gen/core.pb.go +++ b/rpc/gen/core.pb.go @@ -6681,7 +6681,7 @@ func file_rpc_gen_core_proto_rawDescGZIP() []byte { var file_rpc_gen_core_proto_enumTypes = make([]protoimpl.EnumInfo, 4) var file_rpc_gen_core_proto_msgTypes = make([]protoimpl.MessageInfo, 116) -var file_rpc_gen_core_proto_goTypes = []interface{}{ +var file_rpc_gen_core_proto_goTypes = []any{ (TriOpt)(0), // 0: pb.TriOpt (StdStreamType)(0), // 1: pb.StdStreamType (BuildImageOptions_BuildMethod)(0), // 2: pb.BuildImageOptions.BuildMethod @@ -6973,7 +6973,7 @@ func file_rpc_gen_core_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_rpc_gen_core_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*Empty); i { case 0: return &v.state @@ -6985,7 +6985,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*CoreInfo); i { case 0: return &v.state @@ -6997,7 +6997,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*ServiceStatus); i { case 0: return &v.state @@ -7009,7 +7009,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*Engine); i { case 0: return &v.state @@ -7021,7 +7021,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*ListWorkloadsOptions); i { case 0: return &v.state @@ -7033,7 +7033,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*Pod); i { case 0: return &v.state @@ -7045,7 +7045,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*Pods); i { case 0: return &v.state @@ -7057,7 +7057,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*NodeResource); i { case 0: return &v.state @@ -7069,7 +7069,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*ListNetworkOptions); i { case 0: return &v.state @@ -7081,7 +7081,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*ConnectNetworkOptions); i { case 0: return &v.state @@ -7093,7 +7093,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*DisconnectNetworkOptions); i { case 0: return &v.state @@ -7105,7 +7105,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*Network); i { case 0: return &v.state @@ -7117,7 +7117,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[12].Exporter = func(v any, i int) any { switch v := v.(*Networks); i { case 0: return &v.state @@ -7129,7 +7129,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[13].Exporter = func(v any, i int) any { switch v := v.(*Node); i { case 0: return &v.state @@ -7141,7 +7141,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[14].Exporter = func(v any, i int) any { switch v := v.(*AddPodOptions); i { case 0: return &v.state @@ -7153,7 +7153,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[15].Exporter = func(v any, i int) any { switch v := v.(*RemovePodOptions); i { case 0: return &v.state @@ -7165,7 +7165,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[16].Exporter = func(v any, i int) any { switch v := v.(*GetPodOptions); i { case 0: return &v.state @@ -7177,7 +7177,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[17].Exporter = func(v any, i int) any { switch v := v.(*AddNodeOptions); i { case 0: return &v.state @@ -7189,7 +7189,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[18].Exporter = func(v any, i int) any { switch v := v.(*RemoveNodeOptions); i { case 0: return &v.state @@ -7201,7 +7201,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[19].Exporter = func(v any, i int) any { switch v := v.(*GetNodeOptions); i { case 0: return &v.state @@ -7213,7 +7213,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[20].Exporter = func(v any, i int) any { switch v := v.(*GetNodeResourceOptions); i { case 0: return &v.state @@ -7225,7 +7225,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[21].Exporter = func(v any, i int) any { switch v := v.(*ListNodesOptions); i { case 0: return &v.state @@ -7237,7 +7237,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[22].Exporter = func(v any, i int) any { switch v := v.(*SetNodeOptions); i { case 0: return &v.state @@ -7249,7 +7249,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[23].Exporter = func(v any, i int) any { switch v := v.(*SetNodeStatusOptions); i { case 0: return &v.state @@ -7261,7 +7261,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[24].Exporter = func(v any, i int) any { switch v := v.(*GetNodeStatusOptions); i { case 0: return &v.state @@ -7273,7 +7273,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[25].Exporter = func(v any, i int) any { switch v := v.(*NodeStatusStreamMessage); i { case 0: return &v.state @@ -7285,7 +7285,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[26].Exporter = func(v any, i int) any { switch v := v.(*NodeFilter); i { case 0: return &v.state @@ -7297,7 +7297,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[27].Exporter = func(v any, i int) any { switch v := v.(*Workload); i { case 0: return &v.state @@ -7309,7 +7309,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[28].Exporter = func(v any, i int) any { switch v := v.(*WorkloadStatus); i { case 0: return &v.state @@ -7321,7 +7321,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[29].Exporter = func(v any, i int) any { switch v := v.(*WorkloadsStatus); i { case 0: return &v.state @@ -7333,7 +7333,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[30].Exporter = func(v any, i int) any { switch v := v.(*SetWorkloadsStatusOptions); i { case 0: return &v.state @@ -7345,7 +7345,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[31].Exporter = func(v any, i int) any { switch v := v.(*WorkloadStatusStreamOptions); i { case 0: return &v.state @@ -7357,7 +7357,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[32].Exporter = func(v any, i int) any { switch v := v.(*WorkloadStatusStreamMessage); i { case 0: return &v.state @@ -7369,7 +7369,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[33].Exporter = func(v any, i int) any { switch v := v.(*Workloads); i { case 0: return &v.state @@ -7381,7 +7381,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[34].Exporter = func(v any, i int) any { switch v := v.(*WorkloadID); i { case 0: return &v.state @@ -7393,7 +7393,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[35].Exporter = func(v any, i int) any { switch v := v.(*WorkloadIDs); i { case 0: return &v.state @@ -7405,7 +7405,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[36].Exporter = func(v any, i int) any { switch v := v.(*RemoveWorkloadOptions); i { case 0: return &v.state @@ -7417,7 +7417,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[37].Exporter = func(v any, i int) any { switch v := v.(*DissociateWorkloadOptions); i { case 0: return &v.state @@ -7429,7 +7429,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[38].Exporter = func(v any, i int) any { switch v := v.(*ReallocOptions); i { case 0: return &v.state @@ -7441,7 +7441,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[39].Exporter = func(v any, i int) any { switch v := v.(*Build); i { case 0: return &v.state @@ -7453,7 +7453,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[40].Exporter = func(v any, i int) any { switch v := v.(*Builds); i { case 0: return &v.state @@ -7465,7 +7465,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[41].Exporter = func(v any, i int) any { switch v := v.(*BuildImageOptions); i { case 0: return &v.state @@ -7477,7 +7477,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[42].Exporter = func(v any, i int) any { switch v := v.(*HookOptions); i { case 0: return &v.state @@ -7489,7 +7489,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[43].Exporter = func(v any, i int) any { switch v := v.(*HealthCheckOptions); i { case 0: return &v.state @@ -7501,7 +7501,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[44].Exporter = func(v any, i int) any { switch v := v.(*LogOptions); i { case 0: return &v.state @@ -7513,7 +7513,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[45].Exporter = func(v any, i int) any { switch v := v.(*EntrypointOptions); i { case 0: return &v.state @@ -7525,7 +7525,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[46].Exporter = func(v any, i int) any { switch v := v.(*Volume); i { case 0: return &v.state @@ -7537,7 +7537,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[47].Exporter = func(v any, i int) any { switch v := v.(*DeployOptions); i { case 0: return &v.state @@ -7549,7 +7549,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[48].Exporter = func(v any, i int) any { switch v := v.(*ReplaceOptions); i { case 0: return &v.state @@ -7561,7 +7561,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[49].Exporter = func(v any, i int) any { switch v := v.(*CacheImageOptions); i { case 0: return &v.state @@ -7573,7 +7573,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[50].Exporter = func(v any, i int) any { switch v := v.(*RemoveImageOptions); i { case 0: return &v.state @@ -7585,7 +7585,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[51].Exporter = func(v any, i int) any { switch v := v.(*ListImageOptions); i { case 0: return &v.state @@ -7597,7 +7597,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[52].Exporter = func(v any, i int) any { switch v := v.(*CopyPaths); i { case 0: return &v.state @@ -7609,7 +7609,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[53].Exporter = func(v any, i int) any { switch v := v.(*CopyOptions); i { case 0: return &v.state @@ -7621,7 +7621,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[54].Exporter = func(v any, i int) any { switch v := v.(*FileOwner); i { case 0: return &v.state @@ -7633,7 +7633,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[55].Exporter = func(v any, i int) any { switch v := v.(*FileMode); i { case 0: return &v.state @@ -7645,7 +7645,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[56].Exporter = func(v any, i int) any { switch v := v.(*SendOptions); i { case 0: return &v.state @@ -7657,7 +7657,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[57].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[57].Exporter = func(v any, i int) any { switch v := v.(*ErrorDetail); i { case 0: return &v.state @@ -7669,7 +7669,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[58].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[58].Exporter = func(v any, i int) any { switch v := v.(*BuildImageMessage); i { case 0: return &v.state @@ -7681,7 +7681,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[59].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[59].Exporter = func(v any, i int) any { switch v := v.(*CreateWorkloadMessage); i { case 0: return &v.state @@ -7693,7 +7693,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[60].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[60].Exporter = func(v any, i int) any { switch v := v.(*ReplaceWorkloadMessage); i { case 0: return &v.state @@ -7705,7 +7705,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[61].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[61].Exporter = func(v any, i int) any { switch v := v.(*CacheImageMessage); i { case 0: return &v.state @@ -7717,7 +7717,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[62].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[62].Exporter = func(v any, i int) any { switch v := v.(*RemoveImageMessage); i { case 0: return &v.state @@ -7729,7 +7729,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[63].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[63].Exporter = func(v any, i int) any { switch v := v.(*ImageItem); i { case 0: return &v.state @@ -7741,7 +7741,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[64].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[64].Exporter = func(v any, i int) any { switch v := v.(*ListImageMessage); i { case 0: return &v.state @@ -7753,7 +7753,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[65].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[65].Exporter = func(v any, i int) any { switch v := v.(*RemoveWorkloadMessage); i { case 0: return &v.state @@ -7765,7 +7765,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[66].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[66].Exporter = func(v any, i int) any { switch v := v.(*DissociateWorkloadMessage); i { case 0: return &v.state @@ -7777,7 +7777,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[67].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[67].Exporter = func(v any, i int) any { switch v := v.(*ReallocResourceMessage); i { case 0: return &v.state @@ -7789,7 +7789,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[68].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[68].Exporter = func(v any, i int) any { switch v := v.(*CopyMessage); i { case 0: return &v.state @@ -7801,7 +7801,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[69].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[69].Exporter = func(v any, i int) any { switch v := v.(*SendMessage); i { case 0: return &v.state @@ -7813,7 +7813,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[70].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[70].Exporter = func(v any, i int) any { switch v := v.(*AttachWorkloadMessage); i { case 0: return &v.state @@ -7825,7 +7825,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[71].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[71].Exporter = func(v any, i int) any { switch v := v.(*RunAndWaitOptions); i { case 0: return &v.state @@ -7837,7 +7837,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[72].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[72].Exporter = func(v any, i int) any { switch v := v.(*ControlWorkloadOptions); i { case 0: return &v.state @@ -7849,7 +7849,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[73].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[73].Exporter = func(v any, i int) any { switch v := v.(*ControlWorkloadMessage); i { case 0: return &v.state @@ -7861,7 +7861,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[74].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[74].Exporter = func(v any, i int) any { switch v := v.(*LogStreamOptions); i { case 0: return &v.state @@ -7873,7 +7873,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[75].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[75].Exporter = func(v any, i int) any { switch v := v.(*LogStreamMessage); i { case 0: return &v.state @@ -7885,7 +7885,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[76].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[76].Exporter = func(v any, i int) any { switch v := v.(*ExecuteWorkloadOptions); i { case 0: return &v.state @@ -7897,7 +7897,7 @@ func file_rpc_gen_core_proto_init() { return nil } } - file_rpc_gen_core_proto_msgTypes[77].Exporter = func(v interface{}, i int) interface{} { + file_rpc_gen_core_proto_msgTypes[77].Exporter = func(v any, i int) any { switch v := v.(*CapacityMessage); i { case 0: return &v.state diff --git a/rpc/gen/core_grpc.pb.go b/rpc/gen/core_grpc.pb.go index c85be0541..e82657fe9 100644 --- a/rpc/gen/core_grpc.pb.go +++ b/rpc/gen/core_grpc.pb.go @@ -1114,7 +1114,7 @@ func RegisterCoreRPCServer(s grpc.ServiceRegistrar, srv CoreRPCServer) { s.RegisterService(&CoreRPC_ServiceDesc, srv) } -func _CoreRPC_Info_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_Info_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(Empty) if err := dec(in); err != nil { return nil, err @@ -1126,13 +1126,13 @@ func _CoreRPC_Info_Handler(srv interface{}, ctx context.Context, dec func(interf Server: srv, FullMethod: "/pb.CoreRPC/Info", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).Info(ctx, req.(*Empty)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_WatchServiceStatus_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_WatchServiceStatus_Handler(srv any, stream grpc.ServerStream) error { m := new(Empty) if err := stream.RecvMsg(m); err != nil { return err @@ -1153,7 +1153,7 @@ func (x *coreRPCWatchServiceStatusServer) Send(m *ServiceStatus) error { return x.ServerStream.SendMsg(m) } -func _CoreRPC_ListNetworks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_ListNetworks_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(ListNetworkOptions) if err := dec(in); err != nil { return nil, err @@ -1165,13 +1165,13 @@ func _CoreRPC_ListNetworks_Handler(srv interface{}, ctx context.Context, dec fun Server: srv, FullMethod: "/pb.CoreRPC/ListNetworks", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).ListNetworks(ctx, req.(*ListNetworkOptions)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_ConnectNetwork_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_ConnectNetwork_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(ConnectNetworkOptions) if err := dec(in); err != nil { return nil, err @@ -1183,13 +1183,13 @@ func _CoreRPC_ConnectNetwork_Handler(srv interface{}, ctx context.Context, dec f Server: srv, FullMethod: "/pb.CoreRPC/ConnectNetwork", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).ConnectNetwork(ctx, req.(*ConnectNetworkOptions)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_DisconnectNetwork_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_DisconnectNetwork_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(DisconnectNetworkOptions) if err := dec(in); err != nil { return nil, err @@ -1201,13 +1201,13 @@ func _CoreRPC_DisconnectNetwork_Handler(srv interface{}, ctx context.Context, de Server: srv, FullMethod: "/pb.CoreRPC/DisconnectNetwork", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).DisconnectNetwork(ctx, req.(*DisconnectNetworkOptions)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_AddPod_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_AddPod_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(AddPodOptions) if err := dec(in); err != nil { return nil, err @@ -1219,13 +1219,13 @@ func _CoreRPC_AddPod_Handler(srv interface{}, ctx context.Context, dec func(inte Server: srv, FullMethod: "/pb.CoreRPC/AddPod", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).AddPod(ctx, req.(*AddPodOptions)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_RemovePod_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_RemovePod_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(RemovePodOptions) if err := dec(in); err != nil { return nil, err @@ -1237,13 +1237,13 @@ func _CoreRPC_RemovePod_Handler(srv interface{}, ctx context.Context, dec func(i Server: srv, FullMethod: "/pb.CoreRPC/RemovePod", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).RemovePod(ctx, req.(*RemovePodOptions)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_GetPod_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_GetPod_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(GetPodOptions) if err := dec(in); err != nil { return nil, err @@ -1255,13 +1255,13 @@ func _CoreRPC_GetPod_Handler(srv interface{}, ctx context.Context, dec func(inte Server: srv, FullMethod: "/pb.CoreRPC/GetPod", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).GetPod(ctx, req.(*GetPodOptions)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_ListPods_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_ListPods_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(Empty) if err := dec(in); err != nil { return nil, err @@ -1273,13 +1273,13 @@ func _CoreRPC_ListPods_Handler(srv interface{}, ctx context.Context, dec func(in Server: srv, FullMethod: "/pb.CoreRPC/ListPods", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).ListPods(ctx, req.(*Empty)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_GetPodResource_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_GetPodResource_Handler(srv any, stream grpc.ServerStream) error { m := new(GetPodOptions) if err := stream.RecvMsg(m); err != nil { return err @@ -1300,7 +1300,7 @@ func (x *coreRPCGetPodResourceServer) Send(m *NodeResource) error { return x.ServerStream.SendMsg(m) } -func _CoreRPC_GetNodeResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_GetNodeResource_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(GetNodeResourceOptions) if err := dec(in); err != nil { return nil, err @@ -1312,13 +1312,13 @@ func _CoreRPC_GetNodeResource_Handler(srv interface{}, ctx context.Context, dec Server: srv, FullMethod: "/pb.CoreRPC/GetNodeResource", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).GetNodeResource(ctx, req.(*GetNodeResourceOptions)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_AddNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_AddNode_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(AddNodeOptions) if err := dec(in); err != nil { return nil, err @@ -1330,13 +1330,13 @@ func _CoreRPC_AddNode_Handler(srv interface{}, ctx context.Context, dec func(int Server: srv, FullMethod: "/pb.CoreRPC/AddNode", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).AddNode(ctx, req.(*AddNodeOptions)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_RemoveNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_RemoveNode_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(RemoveNodeOptions) if err := dec(in); err != nil { return nil, err @@ -1348,13 +1348,13 @@ func _CoreRPC_RemoveNode_Handler(srv interface{}, ctx context.Context, dec func( Server: srv, FullMethod: "/pb.CoreRPC/RemoveNode", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).RemoveNode(ctx, req.(*RemoveNodeOptions)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_ListPodNodes_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_ListPodNodes_Handler(srv any, stream grpc.ServerStream) error { m := new(ListNodesOptions) if err := stream.RecvMsg(m); err != nil { return err @@ -1375,7 +1375,7 @@ func (x *coreRPCListPodNodesServer) Send(m *Node) error { return x.ServerStream.SendMsg(m) } -func _CoreRPC_GetNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_GetNode_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(GetNodeOptions) if err := dec(in); err != nil { return nil, err @@ -1387,13 +1387,13 @@ func _CoreRPC_GetNode_Handler(srv interface{}, ctx context.Context, dec func(int Server: srv, FullMethod: "/pb.CoreRPC/GetNode", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).GetNode(ctx, req.(*GetNodeOptions)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_GetNodeEngineInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_GetNodeEngineInfo_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(GetNodeOptions) if err := dec(in); err != nil { return nil, err @@ -1405,13 +1405,13 @@ func _CoreRPC_GetNodeEngineInfo_Handler(srv interface{}, ctx context.Context, de Server: srv, FullMethod: "/pb.CoreRPC/GetNodeEngineInfo", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).GetNodeEngineInfo(ctx, req.(*GetNodeOptions)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_SetNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_SetNode_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(SetNodeOptions) if err := dec(in); err != nil { return nil, err @@ -1423,13 +1423,13 @@ func _CoreRPC_SetNode_Handler(srv interface{}, ctx context.Context, dec func(int Server: srv, FullMethod: "/pb.CoreRPC/SetNode", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).SetNode(ctx, req.(*SetNodeOptions)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_GetNodeStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_GetNodeStatus_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(GetNodeStatusOptions) if err := dec(in); err != nil { return nil, err @@ -1441,13 +1441,13 @@ func _CoreRPC_GetNodeStatus_Handler(srv interface{}, ctx context.Context, dec fu Server: srv, FullMethod: "/pb.CoreRPC/GetNodeStatus", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).GetNodeStatus(ctx, req.(*GetNodeStatusOptions)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_SetNodeStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_SetNodeStatus_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(SetNodeStatusOptions) if err := dec(in); err != nil { return nil, err @@ -1459,13 +1459,13 @@ func _CoreRPC_SetNodeStatus_Handler(srv interface{}, ctx context.Context, dec fu Server: srv, FullMethod: "/pb.CoreRPC/SetNodeStatus", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).SetNodeStatus(ctx, req.(*SetNodeStatusOptions)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_NodeStatusStream_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_NodeStatusStream_Handler(srv any, stream grpc.ServerStream) error { m := new(Empty) if err := stream.RecvMsg(m); err != nil { return err @@ -1486,7 +1486,7 @@ func (x *coreRPCNodeStatusStreamServer) Send(m *NodeStatusStreamMessage) error { return x.ServerStream.SendMsg(m) } -func _CoreRPC_GetWorkloadsStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_GetWorkloadsStatus_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(WorkloadIDs) if err := dec(in); err != nil { return nil, err @@ -1498,13 +1498,13 @@ func _CoreRPC_GetWorkloadsStatus_Handler(srv interface{}, ctx context.Context, d Server: srv, FullMethod: "/pb.CoreRPC/GetWorkloadsStatus", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).GetWorkloadsStatus(ctx, req.(*WorkloadIDs)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_SetWorkloadsStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_SetWorkloadsStatus_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(SetWorkloadsStatusOptions) if err := dec(in); err != nil { return nil, err @@ -1516,13 +1516,13 @@ func _CoreRPC_SetWorkloadsStatus_Handler(srv interface{}, ctx context.Context, d Server: srv, FullMethod: "/pb.CoreRPC/SetWorkloadsStatus", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).SetWorkloadsStatus(ctx, req.(*SetWorkloadsStatusOptions)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_WorkloadStatusStream_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_WorkloadStatusStream_Handler(srv any, stream grpc.ServerStream) error { m := new(WorkloadStatusStreamOptions) if err := stream.RecvMsg(m); err != nil { return err @@ -1543,7 +1543,7 @@ func (x *coreRPCWorkloadStatusStreamServer) Send(m *WorkloadStatusStreamMessage) return x.ServerStream.SendMsg(m) } -func _CoreRPC_CalculateCapacity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_CalculateCapacity_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(DeployOptions) if err := dec(in); err != nil { return nil, err @@ -1555,13 +1555,13 @@ func _CoreRPC_CalculateCapacity_Handler(srv interface{}, ctx context.Context, de Server: srv, FullMethod: "/pb.CoreRPC/CalculateCapacity", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).CalculateCapacity(ctx, req.(*DeployOptions)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_GetWorkload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_GetWorkload_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(WorkloadID) if err := dec(in); err != nil { return nil, err @@ -1573,13 +1573,13 @@ func _CoreRPC_GetWorkload_Handler(srv interface{}, ctx context.Context, dec func Server: srv, FullMethod: "/pb.CoreRPC/GetWorkload", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).GetWorkload(ctx, req.(*WorkloadID)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_GetWorkloads_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_GetWorkloads_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(WorkloadIDs) if err := dec(in); err != nil { return nil, err @@ -1591,13 +1591,13 @@ func _CoreRPC_GetWorkloads_Handler(srv interface{}, ctx context.Context, dec fun Server: srv, FullMethod: "/pb.CoreRPC/GetWorkloads", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).GetWorkloads(ctx, req.(*WorkloadIDs)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_ListWorkloads_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_ListWorkloads_Handler(srv any, stream grpc.ServerStream) error { m := new(ListWorkloadsOptions) if err := stream.RecvMsg(m); err != nil { return err @@ -1618,7 +1618,7 @@ func (x *coreRPCListWorkloadsServer) Send(m *Workload) error { return x.ServerStream.SendMsg(m) } -func _CoreRPC_ListNodeWorkloads_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_ListNodeWorkloads_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(GetNodeOptions) if err := dec(in); err != nil { return nil, err @@ -1630,13 +1630,13 @@ func _CoreRPC_ListNodeWorkloads_Handler(srv interface{}, ctx context.Context, de Server: srv, FullMethod: "/pb.CoreRPC/ListNodeWorkloads", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).ListNodeWorkloads(ctx, req.(*GetNodeOptions)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_Copy_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_Copy_Handler(srv any, stream grpc.ServerStream) error { m := new(CopyOptions) if err := stream.RecvMsg(m); err != nil { return err @@ -1657,7 +1657,7 @@ func (x *coreRPCCopyServer) Send(m *CopyMessage) error { return x.ServerStream.SendMsg(m) } -func _CoreRPC_Send_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_Send_Handler(srv any, stream grpc.ServerStream) error { m := new(SendOptions) if err := stream.RecvMsg(m); err != nil { return err @@ -1678,7 +1678,7 @@ func (x *coreRPCSendServer) Send(m *SendMessage) error { return x.ServerStream.SendMsg(m) } -func _CoreRPC_BuildImage_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_BuildImage_Handler(srv any, stream grpc.ServerStream) error { m := new(BuildImageOptions) if err := stream.RecvMsg(m); err != nil { return err @@ -1699,7 +1699,7 @@ func (x *coreRPCBuildImageServer) Send(m *BuildImageMessage) error { return x.ServerStream.SendMsg(m) } -func _CoreRPC_CacheImage_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_CacheImage_Handler(srv any, stream grpc.ServerStream) error { m := new(CacheImageOptions) if err := stream.RecvMsg(m); err != nil { return err @@ -1720,7 +1720,7 @@ func (x *coreRPCCacheImageServer) Send(m *CacheImageMessage) error { return x.ServerStream.SendMsg(m) } -func _CoreRPC_RemoveImage_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_RemoveImage_Handler(srv any, stream grpc.ServerStream) error { m := new(RemoveImageOptions) if err := stream.RecvMsg(m); err != nil { return err @@ -1741,7 +1741,7 @@ func (x *coreRPCRemoveImageServer) Send(m *RemoveImageMessage) error { return x.ServerStream.SendMsg(m) } -func _CoreRPC_ListImage_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_ListImage_Handler(srv any, stream grpc.ServerStream) error { m := new(ListImageOptions) if err := stream.RecvMsg(m); err != nil { return err @@ -1762,7 +1762,7 @@ func (x *coreRPCListImageServer) Send(m *ListImageMessage) error { return x.ServerStream.SendMsg(m) } -func _CoreRPC_CreateWorkload_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_CreateWorkload_Handler(srv any, stream grpc.ServerStream) error { m := new(DeployOptions) if err := stream.RecvMsg(m); err != nil { return err @@ -1783,7 +1783,7 @@ func (x *coreRPCCreateWorkloadServer) Send(m *CreateWorkloadMessage) error { return x.ServerStream.SendMsg(m) } -func _CoreRPC_ReplaceWorkload_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_ReplaceWorkload_Handler(srv any, stream grpc.ServerStream) error { m := new(ReplaceOptions) if err := stream.RecvMsg(m); err != nil { return err @@ -1804,7 +1804,7 @@ func (x *coreRPCReplaceWorkloadServer) Send(m *ReplaceWorkloadMessage) error { return x.ServerStream.SendMsg(m) } -func _CoreRPC_RemoveWorkload_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_RemoveWorkload_Handler(srv any, stream grpc.ServerStream) error { m := new(RemoveWorkloadOptions) if err := stream.RecvMsg(m); err != nil { return err @@ -1825,7 +1825,7 @@ func (x *coreRPCRemoveWorkloadServer) Send(m *RemoveWorkloadMessage) error { return x.ServerStream.SendMsg(m) } -func _CoreRPC_DissociateWorkload_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_DissociateWorkload_Handler(srv any, stream grpc.ServerStream) error { m := new(DissociateWorkloadOptions) if err := stream.RecvMsg(m); err != nil { return err @@ -1846,7 +1846,7 @@ func (x *coreRPCDissociateWorkloadServer) Send(m *DissociateWorkloadMessage) err return x.ServerStream.SendMsg(m) } -func _CoreRPC_ControlWorkload_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_ControlWorkload_Handler(srv any, stream grpc.ServerStream) error { m := new(ControlWorkloadOptions) if err := stream.RecvMsg(m); err != nil { return err @@ -1867,7 +1867,7 @@ func (x *coreRPCControlWorkloadServer) Send(m *ControlWorkloadMessage) error { return x.ServerStream.SendMsg(m) } -func _CoreRPC_ExecuteWorkload_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_ExecuteWorkload_Handler(srv any, stream grpc.ServerStream) error { return srv.(CoreRPCServer).ExecuteWorkload(&coreRPCExecuteWorkloadServer{stream}) } @@ -1893,7 +1893,7 @@ func (x *coreRPCExecuteWorkloadServer) Recv() (*ExecuteWorkloadOptions, error) { return m, nil } -func _CoreRPC_ReallocResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CoreRPC_ReallocResource_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(ReallocOptions) if err := dec(in); err != nil { return nil, err @@ -1905,13 +1905,13 @@ func _CoreRPC_ReallocResource_Handler(srv interface{}, ctx context.Context, dec Server: srv, FullMethod: "/pb.CoreRPC/ReallocResource", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(CoreRPCServer).ReallocResource(ctx, req.(*ReallocOptions)) } return interceptor(ctx, in, info, handler) } -func _CoreRPC_LogStream_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_LogStream_Handler(srv any, stream grpc.ServerStream) error { m := new(LogStreamOptions) if err := stream.RecvMsg(m); err != nil { return err @@ -1932,7 +1932,7 @@ func (x *coreRPCLogStreamServer) Send(m *LogStreamMessage) error { return x.ServerStream.SendMsg(m) } -func _CoreRPC_RunAndWait_Handler(srv interface{}, stream grpc.ServerStream) error { +func _CoreRPC_RunAndWait_Handler(srv any, stream grpc.ServerStream) error { return srv.(CoreRPCServer).RunAndWait(&coreRPCRunAndWaitServer{stream}) } diff --git a/rpc/rpc.go b/rpc/rpc.go index d3e94fcfd..ff85cf9de 100644 --- a/rpc/rpc.go +++ b/rpc/rpc.go @@ -1019,7 +1019,7 @@ func (v *Vibranium) RunAndWait(stream pb.CoreRPC_RunAndWaitServer) error { return nil } -func (v *Vibranium) logUnsentMessages(ctx context.Context, msgType string, err error, msg interface{}) { +func (v *Vibranium) logUnsentMessages(ctx context.Context, msgType string, err error, msg any) { log.WithFunc("vibranium.logUnsentMessages").Infof(ctx, "Unsent (%s) streamed message due to (%+v): (%+v)", msgType, err, msg) } diff --git a/rpc/transform.go b/rpc/transform.go index 98cf5e3b8..85424f379 100644 --- a/rpc/transform.go +++ b/rpc/transform.go @@ -47,7 +47,7 @@ func toRPCNode(n *types.Node) *pb.Node { return node } -func toRPCResources(v interface{}) string { +func toRPCResources(v any) string { body, _ := json.Marshal(v) return string(body) } diff --git a/strategy/communism.go b/strategy/communism.go index 394c6f220..6ae009463 100644 --- a/strategy/communism.go +++ b/strategy/communism.go @@ -26,7 +26,7 @@ func (h infoHeap) Swap(i, j int) { h.infos[i], h.infos[j] = h.infos[j], h.infos[i] } -func (h *infoHeap) Push(x interface{}) { +func (h *infoHeap) Push(x any) { info := x.(Info) if info.Capacity == 0 || (h.limit > 0 && info.Count >= h.limit) { return @@ -34,7 +34,7 @@ func (h *infoHeap) Push(x interface{}) { h.infos = append(h.infos, info) } -func (h *infoHeap) Pop() interface{} { +func (h *infoHeap) Pop() any { length := len(h.infos) x := h.infos[length-1] h.infos = h.infos[0 : length-1] diff --git a/strategy/global.go b/strategy/global.go index f122e97b6..d25faee25 100644 --- a/strategy/global.go +++ b/strategy/global.go @@ -27,12 +27,12 @@ func (r infoHeapForGlobalStrategy) Swap(i, j int) { } // Push . -func (r *infoHeapForGlobalStrategy) Push(x interface{}) { +func (r *infoHeapForGlobalStrategy) Push(x any) { *r = append(*r, x.(Info)) } // Pop . -func (r *infoHeapForGlobalStrategy) Pop() interface{} { +func (r *infoHeapForGlobalStrategy) Pop() any { old := *r n := len(old) x := old[n-1] diff --git a/utils/gopool.go b/utils/gopool.go index a94ee90cb..1b5265965 100644 --- a/utils/gopool.go +++ b/utils/gopool.go @@ -7,7 +7,7 @@ import ( // NewPool new a pool func NewPool(max int) (*ants.PoolWithFunc, error) { - return ants.NewPoolWithFunc(max, func(i interface{}) { + return ants.NewPoolWithFunc(max, func(i any) { defer log.SentryDefer() f, _ := i.(func()) f() diff --git a/wal/hydro.go b/wal/hydro.go index 51742a728..4c7e53404 100644 --- a/wal/hydro.go +++ b/wal/hydro.go @@ -80,7 +80,7 @@ func (h *Hydro) Recover(ctx context.Context) { } // Log records a log item. -func (h *Hydro) Log(eventyp string, item interface{}) (Commit, error) { +func (h *Hydro) Log(eventyp string, item any) (Commit, error) { handler, ok := h.getEventHandler(eventyp) if !ok { return nil, errors.Wrap(coretypes.ErrInvaildWALEventType, eventyp) diff --git a/wal/wal.go b/wal/wal.go index 75163623d..711b3f4bb 100644 --- a/wal/wal.go +++ b/wal/wal.go @@ -28,7 +28,7 @@ type Registry interface { // Logger is the interface that wraps the basic Log method. type Logger interface { - Log(string, interface{}) (Commit, error) + Log(string, any) (Commit, error) } // Closer is the interface that groups the Close methods. @@ -39,10 +39,10 @@ type Closer interface { // EventHandler is the interface that groups a few methods. type EventHandler interface { Typ() string - Check(context.Context, interface{}) (need bool, err error) - Encode(interface{}) ([]byte, error) - Decode([]byte) (interface{}, error) - Handle(context.Context, interface{}) error + Check(context.Context, any) (need bool, err error) + Encode(any) ([]byte, error) + Decode([]byte) (any, error) + Handle(context.Context, any) error } // Commit is a function for committing an event log