From e412e3ff50f9470b86fd9dcb625a55311229261f Mon Sep 17 00:00:00 2001 From: Alva8756 Date: Mon, 18 Nov 2024 22:17:31 -0800 Subject: [PATCH] microbenchmark-proto --- benchmark/microbench_test.go | 158 +++++++++++ go.mod | 3 +- go.sum | 2 + pkg/api/v1/client.go | 18 ++ pkg/api/v1/requests.go | 42 +++ pkg/api/v1/router.go | 4 + pkg/api/v1/router_server_components.go | 50 ++++ pkg/api/v1/server_service.go | 14 + proto/fleetservice.proto | 37 +++ protogen/fleetservice/fleetservice.pb.go | 331 +++++++++++++++++++++++ 10 files changed, 658 insertions(+), 1 deletion(-) create mode 100644 benchmark/microbench_test.go create mode 100644 proto/fleetservice.proto create mode 100644 protogen/fleetservice/fleetservice.pb.go diff --git a/benchmark/microbench_test.go b/benchmark/microbench_test.go new file mode 100644 index 00000000..8bbf1e70 --- /dev/null +++ b/benchmark/microbench_test.go @@ -0,0 +1,158 @@ +package benchmark_test + +import ( + "context" + "encoding/json" + "fmt" + "sort" + "testing" + "time" + + "github.com/google/uuid" + "github.com/jmoiron/sqlx" + "github.com/metal-toolbox/fleetdb/internal/config" + "github.com/metal-toolbox/fleetdb/internal/dbtools" + "github.com/metal-toolbox/fleetdb/internal/httpsrv" + fleetdbapi "github.com/metal-toolbox/fleetdb/pkg/api/v1" + "github.com/vattle/sqlboiler/boil" + "go.infratographer.com/x/crdbx" + "go.uber.org/zap" +) + +// go test -benchmem -run=^$ -tags testtools -bench . github.com/metal-toolbox/fleetdb/benchmark -benchtime=30s +/* +BenchmarkGetComponentsJson +p50 latency: 3.597459ms +p90 latency: 6.332708ms +p99 latency: 20.509166ms + +BenchmarkGetComponentsProto +p50 latency: 3.574375ms +p90 latency: 5.545833ms +p99 latency: 17.993708ms +*/ + +func init() { + return + + go func() { + sqldb, err := crdbx.NewDB(crdbx.Config{ + URI: "postgresql://root@fleetdb-crdb:26257/defaultdb?sslmode=disable", + }, false) + if err != nil { + fmt.Errorf("failed to initialize database connection %v", err) + } + + boil.SetDB(sqldb) + + db := sqlx.NewDb(sqldb, "postgres") + + logger, _ := zap.NewDevelopment() + hs := &httpsrv.Server{ + Logger: logger, + Listen: "localhost:12345", + Debug: config.AppConfig.Logging.Debug, + DB: db, + OIDCEnabled: false, + SecretsKeeper: nil, + AuthConfigs: config.AppConfig.APIServerJWTAuth, + } + + if err := hs.Run(); err != nil { + fmt.Errorf("failed starting server %v", err) + } + }() + + client, err := fleetdbapi.NewClient("http://localhost:8000", nil) + if err != nil { + // b.Fatalf("failed to create client %v\n", err) + } + componentTypeSlice, _, err := client.ListServerComponentTypes(context.Background(), nil) + if err != nil { + // b.Fail() + fmt.Errorf("%v", err) + } + + csFixtureCreate := fleetdbapi.ServerComponentSlice{ + { + ServerUUID: uuid.MustParse("224c776c-239a-4853-b4b8-29fe7942f8cf"), + Name: "My Lucky Fin5", + Vendor: "barracuda5", + Model: "a lucky fin5", + Serial: "right5", + ComponentTypeID: componentTypeSlice.ByName("GPU").ID, + ComponentTypeName: componentTypeSlice.ByName("GPU").Name, + ComponentTypeSlug: componentTypeSlice.ByName("GPU").Slug, + VersionedAttributes: []fleetdbapi.VersionedAttributes{ + { + Namespace: dbtools.FixtureNamespaceVersioned, + Data: json.RawMessage(`{"version":"1.0"}`), + }, + { + Namespace: dbtools.FixtureNamespaceVersioned, + Data: json.RawMessage(`{"version":"2.0"}`), + }, + }, + }, + } + res, err := client.CreateComponents(context.TODO(), uuid.MustParse("224c776c-239a-4853-b4b8-29fe7942f8cf"), csFixtureCreate) + if err != nil { + fmt.Printf("%v\n", err) + } + fmt.Printf("============== res = %v\n", res) +} + +func printHistogram(times []time.Duration) { + // Set bin sizes (e.g., 10 ms intervals) + n := len(times) + sort.Slice(times, func(i, j int) bool { + return times[i] < times[j] + }) + fmt.Printf("\np50 latency: %v\np90 latency: %v\np99 latency: %v\n", times[n/2], times[n/100*90], times[n/100*99]) +} + +func BenchmarkGetComponentsJson(b *testing.B) { + client, err := fleetdbapi.NewClient("http://localhost:8000", nil) + if err != nil { + b.Fatalf("failed to create client %v\n", err) + } + + // resp, _, err := client.GetComponents(context.TODO(), uuid.MustParse("224c776c-239a-4853-b4b8-29fe7942f8cf"), nil) + // fmt.Printf("resp= %v\b", resp) + + var times []time.Duration + for i := 0; i < b.N; i++ { + start := time.Now() + resp, _, err := client.GetComponents(context.TODO(), uuid.MustParse("224c776c-239a-4853-b4b8-29fe7942f8cf"), nil) + if err != nil { + b.Fatal() + } + _ = resp + duration := time.Since(start) + times = append(times, duration) + } + printHistogram(times) +} + +func BenchmarkGetComponentsProto(b *testing.B) { + client, err := fleetdbapi.NewClient("http://localhost:8000", nil) + if err != nil { + b.Fatalf("failed to create client %v\n", err) + } + + resp, _, err := client.GetComponentsProto(context.TODO(), uuid.MustParse("224c776c-239a-4853-b4b8-29fe7942f8cf"), nil) + fmt.Printf("resp= %v, err = %v\n", resp, err) + + var times []time.Duration + for i := 0; i < b.N; i++ { + start := time.Now() + resp, _, err := client.GetComponentsProto(context.TODO(), uuid.MustParse("224c776c-239a-4853-b4b8-29fe7942f8cf"), nil) + if err != nil { + b.Fatal() + } + _ = resp + duration := time.Since(start) + times = append(times, duration) + } + printHistogram(times) +} diff --git a/go.mod b/go.mod index 8577163c..14074e2d 100644 --- a/go.mod +++ b/go.mod @@ -37,10 +37,12 @@ require ( github.com/hetiansu5/urlquery v1.2.7 github.com/metal-toolbox/bmc-common v1.0.2 github.com/metal-toolbox/rivets/v2 v2.0.0 + github.com/vattle/sqlboiler v2.5.0+incompatible github.com/volatiletech/sqlboiler v3.7.1+incompatible go.infratographer.com/x v0.5.4 gocloud.dev v0.40.0 golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f + google.golang.org/protobuf v1.35.1 gopkg.in/go-jose/go-jose.v2 v2.6.3 ) @@ -127,7 +129,6 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect google.golang.org/grpc v1.67.1 // indirect - google.golang.org/protobuf v1.35.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index f82d727a..c7ee0005 100644 --- a/go.sum +++ b/go.sum @@ -674,6 +674,8 @@ github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/vattle/sqlboiler v2.5.0+incompatible h1:Wt7km7/dtfzZD8gt1u3NWeK0AuF5UEr26kVD360w2PA= +github.com/vattle/sqlboiler v2.5.0+incompatible/go.mod h1:Q3YlQv8muqQLqYsCfq0TjX87Ec/oUbIcLuZFZIUV614= github.com/volatiletech/inflect v0.0.1 h1:2a6FcMQyhmPZcLa+uet3VJ8gLn/9svWhJxJYwvE8KsU= github.com/volatiletech/inflect v0.0.1/go.mod h1:IBti31tG6phkHitLlr5j7shC5SOo//x0AjDzaJU1PLA= github.com/volatiletech/null v8.0.0+incompatible h1:7wP8m5d/gZ6kW/9GnrLtMCRre2dlEnaQ9Km5OXlK4zg= diff --git a/pkg/api/v1/client.go b/pkg/api/v1/client.go index d0f00d2b..30a44a29 100644 --- a/pkg/api/v1/client.go +++ b/pkg/api/v1/client.go @@ -8,6 +8,8 @@ import ( "net/url" "os" "strings" + + "github.com/metal-toolbox/fleetdb/protogen/fleetservice" ) var apiVersion = "v1" @@ -164,6 +166,22 @@ func (c *Client) list(ctx context.Context, path string, params queryParams, resp return c.do(request, &resp) } +// list provides a reusable method for a standard list to a hollow server +func (c *Client) listProto(ctx context.Context, path string, params queryParams, resp *fleetservice.GetComponentsResponse) error { + request, err := newGetRequest(ctx, c.url, path) + if err != nil { + return err + } + + if params != nil { + q := request.URL.Query() + params.setQuery(q) + request.URL.RawQuery = q.Encode() + } + + return c.doProto(request, resp) +} + // get provides a reusable method for a standard GET of a single item func (c *Client) get(ctx context.Context, path string, resp interface{}) error { request, err := newGetRequest(ctx, c.url, path) diff --git a/pkg/api/v1/requests.go b/pkg/api/v1/requests.go index da8c5a98..524ed2b7 100644 --- a/pkg/api/v1/requests.go +++ b/pkg/api/v1/requests.go @@ -9,7 +9,9 @@ import ( "net/http" "net/url" + "github.com/metal-toolbox/fleetdb/protogen/fleetservice" "github.com/metal-toolbox/rivets/v2/version" + "google.golang.org/protobuf/proto" ) func newGetRequest(ctx context.Context, uri, path string) (*http.Request, error) { @@ -113,3 +115,43 @@ func (c *Client) do(req *http.Request, result interface{}) error { return json.Unmarshal(data, result) } + +func (c *Client) doProto(req *http.Request, result *fleetservice.GetComponentsResponse) error { + req.Header.Set("Authorization", fmt.Sprintf("bearer %s", c.authToken)) + req.Header.Set("User-Agent", userAgentString()) + + // dump request if c.dumper is set + if err := c.dumpRequest(req); err != nil { + return err + } + + resp, err := c.httpClient.Do(req) + if err != nil { + return err + } + + // dump response if c.dumper is set + if err := c.dumpResponse(resp); err != nil { + return err + } + + if err := ensureValidServerResponse(resp); err != nil { + return err + } + + defer resp.Body.Close() + + switch resp.StatusCode { + case http.StatusNoContent, http.StatusResetContent: + // these statuses are not allowed to have body content + return nil + default: + } + + data, err := io.ReadAll(resp.Body) + if err != nil { + return err + } + + return proto.Unmarshal(data, result) +} diff --git a/pkg/api/v1/router.go b/pkg/api/v1/router.go index a003414c..43c86f23 100644 --- a/pkg/api/v1/router.go +++ b/pkg/api/v1/router.go @@ -53,6 +53,10 @@ func (r *Router) Routes(rg *gin.RouterGroup) { srvAttrs.DELETE("/:namespace", amw.AuthRequired(deleteScopes("server", "server:attributes")), r.serverAttributesDelete) } + srvComponentsProto := srv.Group("/components-proto") + { + srvComponentsProto.GET("", amw.AuthRequired(readScopes("server", "server:component")), r.serverComponentGetProto) + } // /servers/:uuid/components srvComponents := srv.Group("/components") { diff --git a/pkg/api/v1/router_server_components.go b/pkg/api/v1/router_server_components.go index 02ff65c4..1108f3ec 100644 --- a/pkg/api/v1/router_server_components.go +++ b/pkg/api/v1/router_server_components.go @@ -2,6 +2,7 @@ package fleetdbapi import ( "database/sql" + "net/http" "github.com/gin-gonic/gin" "github.com/google/uuid" @@ -11,6 +12,7 @@ import ( "github.com/volatiletech/sqlboiler/v4/queries/qm" "github.com/metal-toolbox/fleetdb/internal/models" + "github.com/metal-toolbox/fleetdb/protogen/fleetservice" ) var ( @@ -109,6 +111,54 @@ func (r *Router) serverComponentGet(c *gin.Context) { listResponse(c, comps, pd) } +// serverComponentGet returns a response with the list of components referenced by the server UUID. +func (r *Router) serverComponentGetProto(c *gin.Context) { + srv, err := r.loadServerFromParams(c) + if err != nil { + if errors.Is(err, ErrUUIDParse) { + badRequestResponse(c, "", err) + return + } + + dbErrorResponse(c, err) + + return + } + + // - include Attributes, VersionedAttributes and ServerComponentyType relations + mods := []qm.QueryMod{ + qm.Load("Attributes"), + qm.Load("VersionedAttributes", qm.Where("(namespace, created_at, server_component_id) IN (select namespace, max(created_at), server_component_id from versioned_attributes group by namespace, server_component_id)")), + qm.Load("ServerComponentType"), + } + + dbComps, err := srv.ServerComponents(mods...).All(c.Request.Context(), r.DB) + if err != nil { + dbErrorResponse(c, err) + return + } + + var cc []*fleetservice.Components + for _, comp := range dbComps { + cc = append(cc, &fleetservice.Components{ + Id: comp.ID, + Name: comp.Name.String, + Vendor: comp.Vendor.String, + Model: comp.Model.String, + Serial: comp.Serial.String, + ServerComponentTypeId: comp.ServerComponentTypeID, + ServerId: comp.ServerID, + // CreatedAt: comp.CreatedAt.Time, + // UpdatedAt: comp.UpdatedAt.Time, + }) + } + rr := &fleetservice.GetComponentsResponse{ + Components: cc, + } + + c.ProtoBuf(http.StatusOK, rr) +} + // serverComponentsCreate stores a ServerComponentSlice object into the backend store. func (r *Router) serverComponentsCreate(c *gin.Context) { // load server based on the UUID parameter diff --git a/pkg/api/v1/server_service.go b/pkg/api/v1/server_service.go index 156c027e..e039321b 100644 --- a/pkg/api/v1/server_service.go +++ b/pkg/api/v1/server_service.go @@ -8,6 +8,7 @@ import ( "time" "github.com/google/uuid" + "github.com/metal-toolbox/fleetdb/protogen/fleetservice" rivets "github.com/metal-toolbox/rivets/v2/types" ) @@ -43,6 +44,7 @@ type ClientInterface interface { UpdateAttributes(ctx context.Context, u uuid.UUID, ns string, data json.RawMessage) (*ServerResponse, error) GetComponents(context.Context, uuid.UUID, *PaginationParams) ([]ServerComponent, *ServerResponse, error) + GetComponentsProto(context.Context, uuid.UUID, *PaginationParams) ([]ServerComponent, *ServerResponse, error) ListComponents(context.Context, *ServerComponentListParams) ([]ServerComponent, *ServerResponse, error) CreateComponents(context.Context, uuid.UUID, ServerComponentSlice) (*ServerResponse, error) UpdateComponents(context.Context, uuid.UUID, ServerComponentSlice) (*ServerResponse, error) @@ -197,6 +199,18 @@ func (c *Client) GetComponents(ctx context.Context, srvUUID uuid.UUID, params *P return *sc, &r, nil } +func (c *Client) GetComponentsProto(ctx context.Context, srvUUID uuid.UUID, params *PaginationParams) (ServerComponentSlice, *fleetservice.GetComponentsResponse, error) { + sc := &ServerComponentSlice{} + r := fleetservice.GetComponentsResponse{} + + path := fmt.Sprintf("%s/%s/components-proto", serversEndpoint, srvUUID) + if err := c.listProto(ctx, path, params, &r); err != nil { + return nil, nil, err + } + + return *sc, &r, nil +} + // ListComponents will get all the components matching the given parameters func (c *Client) ListComponents(ctx context.Context, params *ServerComponentListParams) (ServerComponentSlice, *ServerResponse, error) { sc := &ServerComponentSlice{} diff --git a/proto/fleetservice.proto b/proto/fleetservice.proto new file mode 100644 index 00000000..583d9ac3 --- /dev/null +++ b/proto/fleetservice.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; + +import "google/protobuf/timestamp.proto"; + +// protoc --go_out=. proto/fleetservice.proto + +package fleetservice; + +option go_package = "protogen/fleetservice"; + +// GetComponentsRequest ... +message GetComponentsRequest { + string server_id = 1; +} + +// Components +message Components { + string id = 1; + string name = 2; // Nullable string + string vendor = 3; // Nullable string + string model = 4; // Nullable string + string serial = 5; // Nullable string + string server_component_type_id = 6; + string server_id = 7; + google.protobuf.Timestamp created_at = 8; // Nullable timestamp + google.protobuf.Timestamp updated_at = 9; // Nullable timestamp; +} + +// GetComponentsResponse ... +message GetComponentsResponse { + repeated Components components = 1; +} + +// FleetService ... +service FleetService { + rpc GetComponents (GetComponentsRequest) returns (GetComponentsResponse) {} +} diff --git a/protogen/fleetservice/fleetservice.pb.go b/protogen/fleetservice/fleetservice.pb.go new file mode 100644 index 00000000..f0a8a4b1 --- /dev/null +++ b/protogen/fleetservice/fleetservice.pb.go @@ -0,0 +1,331 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.2 +// protoc v5.27.1 +// source: proto/fleetservice.proto + +// protoc --go_out=. proto/fleetservice.proto + +package fleetservice + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// GetComponentsRequest ... +type GetComponentsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServerId string `protobuf:"bytes,1,opt,name=server_id,json=serverId,proto3" json:"server_id,omitempty"` +} + +func (x *GetComponentsRequest) Reset() { + *x = GetComponentsRequest{} + mi := &file_proto_fleetservice_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetComponentsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetComponentsRequest) ProtoMessage() {} + +func (x *GetComponentsRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_fleetservice_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetComponentsRequest.ProtoReflect.Descriptor instead. +func (*GetComponentsRequest) Descriptor() ([]byte, []int) { + return file_proto_fleetservice_proto_rawDescGZIP(), []int{0} +} + +func (x *GetComponentsRequest) GetServerId() string { + if x != nil { + return x.ServerId + } + return "" +} + +// Components +type Components struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Nullable string + Vendor string `protobuf:"bytes,3,opt,name=vendor,proto3" json:"vendor,omitempty"` // Nullable string + Model string `protobuf:"bytes,4,opt,name=model,proto3" json:"model,omitempty"` // Nullable string + Serial string `protobuf:"bytes,5,opt,name=serial,proto3" json:"serial,omitempty"` // Nullable string + ServerComponentTypeId string `protobuf:"bytes,6,opt,name=server_component_type_id,json=serverComponentTypeId,proto3" json:"server_component_type_id,omitempty"` + ServerId string `protobuf:"bytes,7,opt,name=server_id,json=serverId,proto3" json:"server_id,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // Nullable timestamp + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` // Nullable timestamp; +} + +func (x *Components) Reset() { + *x = Components{} + mi := &file_proto_fleetservice_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Components) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Components) ProtoMessage() {} + +func (x *Components) ProtoReflect() protoreflect.Message { + mi := &file_proto_fleetservice_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Components.ProtoReflect.Descriptor instead. +func (*Components) Descriptor() ([]byte, []int) { + return file_proto_fleetservice_proto_rawDescGZIP(), []int{1} +} + +func (x *Components) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Components) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Components) GetVendor() string { + if x != nil { + return x.Vendor + } + return "" +} + +func (x *Components) GetModel() string { + if x != nil { + return x.Model + } + return "" +} + +func (x *Components) GetSerial() string { + if x != nil { + return x.Serial + } + return "" +} + +func (x *Components) GetServerComponentTypeId() string { + if x != nil { + return x.ServerComponentTypeId + } + return "" +} + +func (x *Components) GetServerId() string { + if x != nil { + return x.ServerId + } + return "" +} + +func (x *Components) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *Components) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +// GetComponentsResponse ... +type GetComponentsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Components []*Components `protobuf:"bytes,1,rep,name=components,proto3" json:"components,omitempty"` +} + +func (x *GetComponentsResponse) Reset() { + *x = GetComponentsResponse{} + mi := &file_proto_fleetservice_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetComponentsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetComponentsResponse) ProtoMessage() {} + +func (x *GetComponentsResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_fleetservice_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetComponentsResponse.ProtoReflect.Descriptor instead. +func (*GetComponentsResponse) Descriptor() ([]byte, []int) { + return file_proto_fleetservice_proto_rawDescGZIP(), []int{2} +} + +func (x *GetComponentsResponse) GetComponents() []*Components { + if x != nil { + return x.Components + } + return nil +} + +var File_proto_fleetservice_proto protoreflect.FileDescriptor + +var file_proto_fleetservice_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x66, 0x6c, 0x65, 0x65, + 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x33, 0x0a, 0x14, 0x47, 0x65, 0x74, + 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x22, 0xc2, + 0x02, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x12, + 0x16, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x12, 0x37, 0x0a, 0x18, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x49, 0x64, + 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x39, 0x0a, + 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x64, 0x41, 0x74, 0x22, 0x51, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, + 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x0a, + 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x70, + 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x32, 0x6a, 0x0a, 0x0c, 0x46, 0x6c, 0x65, 0x65, 0x74, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5a, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, + 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x22, 0x2e, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, + 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x66, 0x6c, + 0x65, 0x65, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, + 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x42, 0x17, 0x5a, 0x15, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x66, + 0x6c, 0x65, 0x65, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_proto_fleetservice_proto_rawDescOnce sync.Once + file_proto_fleetservice_proto_rawDescData = file_proto_fleetservice_proto_rawDesc +) + +func file_proto_fleetservice_proto_rawDescGZIP() []byte { + file_proto_fleetservice_proto_rawDescOnce.Do(func() { + file_proto_fleetservice_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_fleetservice_proto_rawDescData) + }) + return file_proto_fleetservice_proto_rawDescData +} + +var file_proto_fleetservice_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_proto_fleetservice_proto_goTypes = []any{ + (*GetComponentsRequest)(nil), // 0: fleetservice.GetComponentsRequest + (*Components)(nil), // 1: fleetservice.Components + (*GetComponentsResponse)(nil), // 2: fleetservice.GetComponentsResponse + (*timestamppb.Timestamp)(nil), // 3: google.protobuf.Timestamp +} +var file_proto_fleetservice_proto_depIdxs = []int32{ + 3, // 0: fleetservice.Components.created_at:type_name -> google.protobuf.Timestamp + 3, // 1: fleetservice.Components.updated_at:type_name -> google.protobuf.Timestamp + 1, // 2: fleetservice.GetComponentsResponse.components:type_name -> fleetservice.Components + 0, // 3: fleetservice.FleetService.GetComponents:input_type -> fleetservice.GetComponentsRequest + 2, // 4: fleetservice.FleetService.GetComponents:output_type -> fleetservice.GetComponentsResponse + 4, // [4:5] is the sub-list for method output_type + 3, // [3:4] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_proto_fleetservice_proto_init() } +func file_proto_fleetservice_proto_init() { + if File_proto_fleetservice_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_proto_fleetservice_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_proto_fleetservice_proto_goTypes, + DependencyIndexes: file_proto_fleetservice_proto_depIdxs, + MessageInfos: file_proto_fleetservice_proto_msgTypes, + }.Build() + File_proto_fleetservice_proto = out.File + file_proto_fleetservice_proto_rawDesc = nil + file_proto_fleetservice_proto_goTypes = nil + file_proto_fleetservice_proto_depIdxs = nil +}