diff --git a/pkg/delivery/transport/grpc/protobuf_type_converters.microgen.go b/pkg/delivery/transport/grpc/protobuf_type_converters.microgen.go index 187f256c9617d39dd2f157a18c2fd43498dadf36..aedb4ff8a7612702413760f2a1276153c1571c9e 100644 --- a/pkg/delivery/transport/grpc/protobuf_type_converters.microgen.go +++ b/pkg/delivery/transport/grpc/protobuf_type_converters.microgen.go @@ -309,6 +309,8 @@ func PtrServicesFindOptionsToProto(options *services.FindOptions) (*common.FindO Sort: options.Sort, PageNum: int32(options.PageNum), PageSize: int32(options.PageSize), + Offset: int32(options.Offset), + Limit: int32(options.Limit), Fields: options.Fields, ExcludeFields: options.ExcludeFields, }, nil @@ -325,6 +327,8 @@ func ProtoToPtrServicesFindOptions(protoOptions *common.FindOptions) (*services. PaginationOptions: services.PaginationOptions{ PageNum: int(protoOptions.PageNum), PageSize: int(protoOptions.PageSize), + Offset: int(protoOptions.Offset), + Limit: int(protoOptions.Limit), }, FieldOptions: services.FieldOptions{ Fields: protoOptions.Fields, diff --git a/pkg/files/uploader.go b/pkg/files/uploader.go index 5b03f62a8007c85a64bdaa3ce8961f4d28ceaef3..a26b4cea1ea9fba0411380579f138f8a1a455ec9 100644 --- a/pkg/files/uploader.go +++ b/pkg/files/uploader.go @@ -33,6 +33,7 @@ func (u *uploader) Upload(src io.Reader, upload *Upload) error { if err != nil { return err } + resp.Body.Close() if resp.StatusCode != http.StatusOK { return errors.New("upload request failed: " + resp.Status) diff --git a/pkg/items/pagination.go b/pkg/items/pagination.go index 6fe197d7d36c1e191e300dfb2a7799d4eac58a94..a73987fab2f72b3c4ff315f8d0dfec15b023fa54 100644 --- a/pkg/items/pagination.go +++ b/pkg/items/pagination.go @@ -16,9 +16,12 @@ type BatchProcessor struct { FindPublishedOptions *FindPublishedOptions Filter *Filter + // Deprecated использовать offset, limit pageSize, pageNum int - sort []string - processed int + + offset, limit int + sort []string + processed int } func (b *BatchProcessor) getBatch(ctx context.Context) ([]*Item, bool, error) { diff --git a/pkg/items/transport/grpc/protobuf_type_converters.microgen.go b/pkg/items/transport/grpc/protobuf_type_converters.microgen.go index 212b1ecd2bfb27db8b49d0f965b484226265f189..0b214cc93c44392ad1490ced7665dd1b595b76b3 100644 --- a/pkg/items/transport/grpc/protobuf_type_converters.microgen.go +++ b/pkg/items/transport/grpc/protobuf_type_converters.microgen.go @@ -151,6 +151,8 @@ func PtrServicesFindOptionsToProto(opts *options.FindOptions) (*pbcommon.FindOpt Sort: opts.Sort, PageNum: int32(opts.PageNum), PageSize: int32(opts.PageSize), + Offset: int32(opts.Offset), + Limit: int32(opts.Limit), Fields: opts.Fields, ExcludeFields: opts.ExcludeFields, }, nil @@ -167,6 +169,8 @@ func ProtoToPtrServicesFindOptions(protoOpts *pbcommon.FindOptions) (*options.Fi PaginationOptions: options.PaginationOptions{ PageNum: int(protoOpts.PageNum), PageSize: int(protoOpts.PageSize), + Offset: int(protoOpts.Offset), + Limit: int(protoOpts.Limit), }, FieldOptions: options.FieldOptions{ Fields: protoOpts.Fields, diff --git a/pkg/log/client.go b/pkg/log/client.go new file mode 100644 index 0000000000000000000000000000000000000000..97ae04aa8c39c23520a48b0850b7921c0f6f230c --- /dev/null +++ b/pkg/log/client.go @@ -0,0 +1,77 @@ +package log + +import ( + "context" + + errorsgrpc "git.perx.ru/perxis/perxis-go/pkg/errors/grpc" + "git.perx.ru/perxis/perxis-go/pkg/options" + "git.perx.ru/perxis/perxis-go/proto/common" + pb "git.perx.ru/perxis/perxis-go/proto/log" + "google.golang.org/grpc" +) + +type Client struct { + client pb.LogServiceClient +} + +var _ Service = &Client{} + +func NewClient(conn *grpc.ClientConn) *Client { + return &Client{ + client: pb.NewLogServiceClient(conn), + } +} + +func (c *Client) Log(ctx context.Context, entries []*Entry) error { + var pbEntries []*pb.LogEntry + for _, e := range entries { + pbEntries = append(pbEntries, EntryToPB(e)) + } + response, err := c.client.Log(ctx, &pb.LogRequest{Entries: pbEntries}) + if err != nil { + return err + } + if response.GetError() != nil { + return errorsgrpc.ErrorFromProto(nil, response.GetError()) + } + return nil +} + +func (c *Client) Find(ctx context.Context, filter *Filter, options *options.FindOptions) (*FindResult, error) { + request := new(pb.FindRequest) + if filter != nil { + request.Filter = &pb.Filter{Q: filter.Q} + } + if options != nil { + request.Options = &common.FindOptions{ + Sort: options.Sort, + Offset: int32(options.Offset), + Limit: int32(options.Limit), + PageSize: int32(options.PageSize), + PageNum: int32(options.PageNum), + } + } + response, err := c.client.Find(ctx, request) + if err != nil { + return nil, err + } + if response.GetError() != nil { + return nil, errorsgrpc.ErrorFromProto(nil, response.GetError()) + } + return FindResultFromPB(response.GetResult()), nil +} + +func (c *Client) Delete(ctx context.Context, filter *Filter) error { + request := new(pb.DeleteRequest) + if filter != nil { + request.Filter = &pb.Filter{Q: filter.Q} + } + response, err := c.client.Delete(ctx, &pb.DeleteRequest{Filter: &pb.Filter{Q: filter.Q}}) + if err != nil { + return err + } + if response.GetError() != nil { + return errorsgrpc.ErrorFromProto(nil, response.GetError()) + } + return nil +} diff --git a/pkg/log/log.go b/pkg/log/log.go new file mode 100644 index 0000000000000000000000000000000000000000..fb22b272af5a982684271044a3ce52ee712a4fad --- /dev/null +++ b/pkg/log/log.go @@ -0,0 +1,90 @@ +package log + +import ( + "time" + + pb "git.perx.ru/perxis/perxis-go/proto/log" + "github.com/mitchellh/mapstructure" + "google.golang.org/protobuf/types/known/timestamppb" +) + +type Level int + +const ( + Info = Level(pb.LogLevel_INFO) + Warning = Level(pb.LogLevel_WARNING) + Error = Level(pb.LogLevel_ERROR) + Critical = Level(pb.LogLevel_CRITICAL) + Fatal = Level(pb.LogLevel_FATAL) +) + +func (l Level) String() string { + s := pb.LogLevel_name[int32(l)] + if s == "" { + s = "UNKNOWN" + } + return s +} + +type Entry struct { + ID string `json:"id" bson:"id" mapstructure:"id"` + Timestamp time.Time `json:"timestamp,omitempty" bson:"timestamp,omitempty" mapstructure:"timestamp,omitempty"` + LogLevel Level `json:"log_level,omitempty" bson:"log_level,omitempty" mapstructure:"log_level,omitempty"` + Message string `json:"message,omitempty" bson:"message,omitempty" mapstructure:"message,omitempty"` + Category string `json:"category,omitempty" bson:"category,omitempty" mapstructure:"category,omitempty"` + Component string `json:"component,omitempty" bson:"component,omitempty" mapstructure:"component,omitempty"` + Event string `json:"event,omitempty" bson:"event,omitempty" mapstructure:"event,omitempty"` + Object string `json:"object,omitempty" bson:"object,omitempty" mapstructure:"object,omitempty"` + Caller string `json:"caller,omitempty" bson:"caller,omitempty" mapstructure:"caller,omitempty"` + Attr interface{} `json:"attr,omitempty" bson:"attr,omitempty" mapstructure:"attr,omitempty"` + Tags []string `json:"tags,omitempty" bson:"tags,omitempty" mapstructure:"tags,omitempty"` +} + +//func convertInterfaceToAny(v interface{}) (*any.Any, error) { +// anyValue := &any.Any{} +// bytes, _ := json.Marshal(v) +// bytesValue := &wrappers.BytesValue{ +// Value: bytes, +// } +// err := anypb.MarshalFrom(anyValue, bytesValue, proto.MarshalOptions{}) +// return anyValue, err +//} + +func EntryToPB(entry *Entry) *pb.LogEntry { + logEntry := &pb.LogEntry{ + Id: entry.ID, + Timestamp: timestamppb.New(entry.Timestamp), + Level: pb.LogLevel(entry.LogLevel), + Message: entry.Message, + Category: entry.Category, + Component: entry.Component, + Event: entry.Event, + Object: entry.Object, + Caller: entry.Caller, + Attr: nil, //implement + Tags: entry.Tags, + } + return logEntry +} + +func EntryFromPB(request *pb.LogEntry) *Entry { + return &Entry{ + ID: request.Id, + Timestamp: request.Timestamp.AsTime(), + LogLevel: Level(request.Level), + Message: request.Message, + Category: request.Category, + Component: request.Component, + Event: request.Event, + Object: request.Object, + Caller: request.Caller, + Attr: request.Attr, // todo: как с этим работать? + Tags: request.Tags, + } +} + +func (e *Entry) ToMap() map[string]interface{} { + res := make(map[string]interface{}) + _ = mapstructure.Decode(e, &res) + return res +} diff --git a/pkg/log/log_test.go b/pkg/log/log_test.go new file mode 100644 index 0000000000000000000000000000000000000000..2f63f5353a1c3a3a0b1cc3dfcc807e52c0b13a28 --- /dev/null +++ b/pkg/log/log_test.go @@ -0,0 +1,65 @@ +package log + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +func TestEntry_ToMap(t *testing.T) { + type fields struct { + ID string + Timestamp time.Time + LogLevel Level + Message string + Category string + Component string + Event string + Object string + Caller string + Attr interface{} + Tags []string + } + tests := []struct { + name string + fields fields + want map[string]interface{} + }{ + { + "#1", + fields{ + ID: "1", + Timestamp: time.Time{}, + Message: "message", + Object: "/spaces/<space_id>/envs/<env_id>", + Caller: "/users/<user_id>", + }, + map[string]interface{}{ + "id": "1", + "timestamp": map[string]interface{}{}, + "message": "message", + "object": "/spaces/<space_id>/envs/<env_id>", + "caller": "/users/<user_id>", + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + e := &Entry{ + ID: tt.fields.ID, + Timestamp: tt.fields.Timestamp, + LogLevel: tt.fields.LogLevel, + Message: tt.fields.Message, + Category: tt.fields.Category, + Component: tt.fields.Component, + Event: tt.fields.Event, + Object: tt.fields.Object, + Caller: tt.fields.Caller, + Attr: tt.fields.Attr, + Tags: tt.fields.Tags, + } + assert.Equal(t, e.ToMap(), tt.want) + }) + } +} diff --git a/pkg/log/mocks/Service.go b/pkg/log/mocks/Service.go new file mode 100644 index 0000000000000000000000000000000000000000..4038268ceb95c06985d1730b09cffbaee3fe8e03 --- /dev/null +++ b/pkg/log/mocks/Service.go @@ -0,0 +1,97 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package mocks + +import ( + context "context" + + log "git.perx.ru/perxis/perxis-go/pkg/log" + mock "github.com/stretchr/testify/mock" + + options "git.perx.ru/perxis/perxis-go/pkg/options" +) + +// Service is an autogenerated mock type for the Service type +type Service struct { + mock.Mock +} + +// Delete provides a mock function with given fields: ctx, filter +func (_m *Service) Delete(ctx context.Context, filter *log.Filter) error { + ret := _m.Called(ctx, filter) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, *log.Filter) error); ok { + r0 = rf(ctx, filter) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Find provides a mock function with given fields: ctx, filter, _a2 +func (_m *Service) Find(ctx context.Context, filter *log.Filter, _a2 *options.FindOptions) (*log.FindResult, error) { + ret := _m.Called(ctx, filter, _a2) + + if len(ret) == 0 { + panic("no return value specified for Find") + } + + var r0 *log.FindResult + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *log.Filter, *options.FindOptions) (*log.FindResult, error)); ok { + return rf(ctx, filter, _a2) + } + if rf, ok := ret.Get(0).(func(context.Context, *log.Filter, *options.FindOptions) *log.FindResult); ok { + r0 = rf(ctx, filter, _a2) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*log.FindResult) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *log.Filter, *options.FindOptions) error); ok { + r1 = rf(ctx, filter, _a2) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Log provides a mock function with given fields: ctx, entries +func (_m *Service) Log(ctx context.Context, entries []*log.Entry) error { + ret := _m.Called(ctx, entries) + + if len(ret) == 0 { + panic("no return value specified for Log") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, []*log.Entry) error); ok { + r0 = rf(ctx, entries) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// NewService creates a new instance of Service. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewService(t interface { + mock.TestingT + Cleanup(func()) +}) *Service { + mock := &Service{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/pkg/log/mocks/Storage.go b/pkg/log/mocks/Storage.go new file mode 100644 index 0000000000000000000000000000000000000000..3b5a32f56c74091399b3fefdc0ba546f568f882a --- /dev/null +++ b/pkg/log/mocks/Storage.go @@ -0,0 +1,140 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package mocks + +import ( + context "context" + + log "git.perx.ru/perxis/perxis-go/pkg/log" + mock "github.com/stretchr/testify/mock" + + options "git.perx.ru/perxis/perxis-go/pkg/options" +) + +// Storage is an autogenerated mock type for the Storage type +type Storage struct { + mock.Mock +} + +// Delete provides a mock function with given fields: ctx, filter +func (_m *Storage) Delete(ctx context.Context, filter *log.Filter) error { + ret := _m.Called(ctx, filter) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, *log.Filter) error); ok { + r0 = rf(ctx, filter) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Find provides a mock function with given fields: ctx, filter, _a2 +func (_m *Storage) Find(ctx context.Context, filter *log.Filter, _a2 *options.FindOptions) ([]*log.Entry, int, error) { + ret := _m.Called(ctx, filter, _a2) + + if len(ret) == 0 { + panic("no return value specified for Find") + } + + var r0 []*log.Entry + var r1 int + var r2 error + if rf, ok := ret.Get(0).(func(context.Context, *log.Filter, *options.FindOptions) ([]*log.Entry, int, error)); ok { + return rf(ctx, filter, _a2) + } + if rf, ok := ret.Get(0).(func(context.Context, *log.Filter, *options.FindOptions) []*log.Entry); ok { + r0 = rf(ctx, filter, _a2) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*log.Entry) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *log.Filter, *options.FindOptions) int); ok { + r1 = rf(ctx, filter, _a2) + } else { + r1 = ret.Get(1).(int) + } + + if rf, ok := ret.Get(2).(func(context.Context, *log.Filter, *options.FindOptions) error); ok { + r2 = rf(ctx, filter, _a2) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// Init provides a mock function with given fields: ctx +func (_m *Storage) Init(ctx context.Context) error { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for Init") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context) error); ok { + r0 = rf(ctx) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Log provides a mock function with given fields: ctx, entry +func (_m *Storage) Log(ctx context.Context, entry []*log.Entry) error { + ret := _m.Called(ctx, entry) + + if len(ret) == 0 { + panic("no return value specified for Log") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, []*log.Entry) error); ok { + r0 = rf(ctx, entry) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Reset provides a mock function with given fields: ctx +func (_m *Storage) Reset(ctx context.Context) error { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for Reset") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context) error); ok { + r0 = rf(ctx) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// NewStorage creates a new instance of Storage. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewStorage(t interface { + mock.TestingT + Cleanup(func()) +}) *Storage { + mock := &Storage{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/pkg/log/service.go b/pkg/log/service.go new file mode 100644 index 0000000000000000000000000000000000000000..8a39ca53e0573ac4ed0bed8bba619837d1fdf030 --- /dev/null +++ b/pkg/log/service.go @@ -0,0 +1,74 @@ +package log + +import ( + "context" + + itemstransportgrpc "git.perx.ru/perxis/perxis-go/pkg/items/transport/grpc" + "git.perx.ru/perxis/perxis-go/pkg/options" + pb "git.perx.ru/perxis/perxis-go/proto/log" +) + +type Service interface { + + // Log метод записи логов + Log(ctx context.Context, entries []*Entry) error + + // Find метод для поиска логов по заданным параметрам + Find(ctx context.Context, filter *Filter, options *options.FindOptions) (*FindResult, error) + + // Delete метод для удаления логов по заданным параметрам + Delete(ctx context.Context, filter *Filter) error +} + +type Filter struct { + Q []string +} + +type FindResult struct { + Entries []*Entry + Filter *Filter + Options *options.FindOptions + Total uint32 +} + +func FindResultToPB(result *FindResult) *pb.FindResult { + findResult := &pb.FindResult{ + Total: result.Total, + } + + entries := make([]*pb.LogEntry, 0, len(result.Entries)) + for _, e := range result.Entries { + entries = append(entries, EntryToPB(e)) + } + findResult.Entries = entries + + if result.Filter != nil { + findResult.Filter.Q = result.Filter.Q + } + if result.Options != nil { + findResult.Options, _ = itemstransportgrpc.PtrServicesFindOptionsToProto(result.Options) + } + + return findResult +} + +func FindResultFromPB(result *pb.FindResult) *FindResult { + findResult := &FindResult{ + Total: result.Total, + } + + entries := make([]*Entry, 0, len(result.Entries)) + for _, e := range result.Entries { + entries = append(entries, EntryFromPB(e)) + } + findResult.Entries = entries + + if result.Filter != nil { + findResult.Filter.Q = result.Filter.Q + } + if result.Options != nil { + findResult.Options, _ = itemstransportgrpc.ProtoToPtrServicesFindOptions(result.Options) + } + + return findResult +} diff --git a/pkg/log/storage.go b/pkg/log/storage.go new file mode 100644 index 0000000000000000000000000000000000000000..fd672e53584bf283fff6f1dc9f87cc1cccc71c7e --- /dev/null +++ b/pkg/log/storage.go @@ -0,0 +1,15 @@ +package log + +import ( + "context" + + "git.perx.ru/perxis/perxis-go/pkg/options" +) + +type Storage interface { + Init(ctx context.Context) error + Reset(ctx context.Context) error + Log(ctx context.Context, entry []*Entry) error + Find(ctx context.Context, filter *Filter, options *options.FindOptions) ([]*Entry, int, error) + Delete(ctx context.Context, filter *Filter) error +} diff --git a/pkg/options/options.go b/pkg/options/options.go index 7f8b0cd624db7e6c4c35fe62333a67ba633fbe7e..09296f359d42e838f4389cc106d8d93bc955cfd6 100644 --- a/pkg/options/options.go +++ b/pkg/options/options.go @@ -9,8 +9,12 @@ type SortOptions struct { // PaginationOptions настройки возвращаемых страниц результатов type PaginationOptions struct { + //Deprecated PageNum int PageSize int + + Limit int + Offset int } // FieldOptions настройки включения/исключения полей из результатов запроса @@ -98,11 +102,13 @@ func MergeSortOptions(options ...SortOptions) SortOptions { func MergePaginationOptions(options ...PaginationOptions) PaginationOptions { fo := PaginationOptions{} for _, opt := range options { - if opt.PageSize == 0 && opt.PageNum == 0 { + if opt.PageSize == 0 && opt.PageNum == 0 && opt.Offset == 0 && opt.Limit == 0 { continue } fo.PageNum = opt.PageNum fo.PageSize = opt.PageSize + fo.Offset = opt.Offset + fo.Limit = opt.Limit } return fo } diff --git a/pkg/organizations/transport/grpc/protobuf_type_converters.microgen.go b/pkg/organizations/transport/grpc/protobuf_type_converters.microgen.go index 15fce8f5a7966f8fa2958fef30f62805923f512b..2c024a9e6973181ccb5ff683b14be4aaad98792c 100644 --- a/pkg/organizations/transport/grpc/protobuf_type_converters.microgen.go +++ b/pkg/organizations/transport/grpc/protobuf_type_converters.microgen.go @@ -68,6 +68,8 @@ func PtrServicesFindOptionsToProto(opts *options.FindOptions) (*common.FindOptio Sort: opts.Sort, PageNum: int32(opts.PageNum), PageSize: int32(opts.PageSize), + Offset: int32(opts.Offset), + Limit: int32(opts.Limit), }, nil } @@ -82,6 +84,8 @@ func ProtoToPtrServicesFindOptions(protoOpts *common.FindOptions) (*options.Find PaginationOptions: options.PaginationOptions{ PageNum: int(protoOpts.PageNum), PageSize: int(protoOpts.PageSize), + Offset: int(protoOpts.Offset), + Limit: int(protoOpts.Limit), }, }, nil } diff --git a/proto/common/common.pb.go b/proto/common/common.pb.go index 31926abe8e19b189bc87a67684e2476a43898811..ea585fe3435096d877fa4bbc3649fe96a4b0649f 100644 --- a/proto/common/common.pb.go +++ b/proto/common/common.pb.go @@ -194,10 +194,12 @@ type FindOptions struct { unknownFields protoimpl.UnknownFields Sort []string `protobuf:"bytes,1,rep,name=sort,proto3" json:"sort,omitempty"` - PageNum int32 `protobuf:"varint,2,opt,name=page_num,json=pageNum,proto3" json:"page_num,omitempty"` - PageSize int32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + PageNum int32 `protobuf:"varint,2,opt,name=page_num,json=pageNum,proto3" json:"page_num,omitempty"` // Deprecated + PageSize int32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // Deprecated Fields []string `protobuf:"bytes,4,rep,name=fields,proto3" json:"fields,omitempty"` ExcludeFields bool `protobuf:"varint,5,opt,name=exclude_fields,json=excludeFields,proto3" json:"exclude_fields,omitempty"` + Offset int32 `protobuf:"varint,6,opt,name=offset,proto3" json:"offset,omitempty"` + Limit int32 `protobuf:"varint,7,opt,name=limit,proto3" json:"limit,omitempty"` } func (x *FindOptions) Reset() { @@ -267,6 +269,20 @@ func (x *FindOptions) GetExcludeFields() bool { return false } +func (x *FindOptions) GetOffset() int32 { + if x != nil { + return x.Offset + } + return 0 +} + +func (x *FindOptions) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + type Rule struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -541,7 +557,7 @@ var file_common_common_proto_rawDesc = []byte{ 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x98, 0x01, 0x0a, 0x0b, 0x46, 0x69, + 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xc6, 0x01, 0x0a, 0x0b, 0x46, 0x69, 0x6e, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x73, 0x6f, 0x72, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, @@ -551,59 +567,62 @@ var file_common_common_proto_rawDesc = []byte{ 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x73, 0x22, 0x90, 0x03, 0x0a, 0x04, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x23, 0x0a, - 0x0d, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x49, 0x64, 0x12, 0x28, 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x06, - 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x63, - 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x06, 0x61, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x68, 0x69, 0x64, 0x64, 0x65, 0x6e, 0x5f, 0x66, - 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x68, 0x69, 0x64, - 0x64, 0x65, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x61, - 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x61, 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x46, 0x69, 0x65, 0x6c, - 0x64, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x77, 0x72, 0x69, 0x74, 0x65, 0x6f, 0x6e, 0x6c, 0x79, 0x5f, - 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x77, 0x72, - 0x69, 0x74, 0x65, 0x6f, 0x6e, 0x6c, 0x79, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x1f, 0x0a, - 0x0b, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x21, - 0x0a, 0x0c, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x09, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x77, 0x72, 0x69, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x12, 0x28, 0x0a, 0x10, 0x64, 0x65, 0x6e, 0x79, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x66, - 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x64, 0x65, 0x6e, - 0x79, 0x52, 0x65, 0x61, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x64, - 0x65, 0x6e, 0x79, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, - 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65, 0x6e, 0x79, 0x57, 0x72, 0x69, 0x74, - 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x22, 0x57, 0x0a, 0x0c, 0x43, 0x6f, 0x6c, 0x6c, 0x61, - 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, - 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, - 0x22, 0xab, 0x01, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x74, 0x69, - 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x54, - 0x69, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, - 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x0b, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2a, 0x25, - 0x0a, 0x06, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x59, 0x10, - 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4d, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, - 0x4f, 0x4c, 0x45, 0x10, 0x02, 0x2a, 0x43, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, - 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x45, 0x41, 0x44, - 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x03, 0x12, 0x0a, - 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, 0x42, 0x32, 0x5a, 0x30, 0x67, 0x69, - 0x74, 0x2e, 0x70, 0x65, 0x72, 0x78, 0x2e, 0x72, 0x75, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, - 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x6c, 0x64, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x14, 0x0a, 0x05, + 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, + 0x69, 0x74, 0x22, 0x90, 0x03, 0x0a, 0x04, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x63, + 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, + 0x12, 0x28, 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0e, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x06, 0x61, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x06, 0x61, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x68, 0x69, 0x64, 0x64, 0x65, 0x6e, 0x5f, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x68, 0x69, 0x64, 0x64, 0x65, + 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x61, 0x64, 0x6f, + 0x6e, 0x6c, 0x79, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x0e, 0x72, 0x65, 0x61, 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, + 0x12, 0x29, 0x0a, 0x10, 0x77, 0x72, 0x69, 0x74, 0x65, 0x6f, 0x6e, 0x6c, 0x79, 0x5f, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x77, 0x72, 0x69, 0x74, + 0x65, 0x6f, 0x6e, 0x6c, 0x79, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x72, + 0x65, 0x61, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x72, 0x65, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, + 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x77, 0x72, 0x69, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, + 0x28, 0x0a, 0x10, 0x64, 0x65, 0x6e, 0x79, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x64, 0x65, 0x6e, 0x79, 0x52, + 0x65, 0x61, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x64, 0x65, 0x6e, + 0x79, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x0b, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65, 0x6e, 0x79, 0x57, 0x72, 0x69, 0x74, 0x65, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x73, 0x22, 0x57, 0x0a, 0x0c, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, + 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, + 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, + 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x22, 0xab, + 0x01, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x69, 0x6d, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x75, 0x69, + 0x6c, 0x64, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x0b, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2a, 0x25, 0x0a, 0x06, + 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x59, 0x10, 0x00, 0x12, + 0x08, 0x0a, 0x04, 0x4d, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x4f, 0x4c, + 0x45, 0x10, 0x02, 0x2a, 0x43, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x0a, + 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x52, + 0x45, 0x41, 0x54, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x45, 0x41, 0x44, 0x10, 0x02, + 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, + 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, 0x42, 0x32, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x2e, + 0x70, 0x65, 0x72, 0x78, 0x2e, 0x72, 0x75, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2f, 0x70, + 0x65, 0x72, 0x78, 0x69, 0x73, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/log/log.pb.go b/proto/log/log.pb.go new file mode 100644 index 0000000000000000000000000000000000000000..14cf7c042aec8364a2883ff5d42555da012ede6e --- /dev/null +++ b/proto/log/log.pb.go @@ -0,0 +1,370 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v4.25.1 +// source: log/log.proto + +package log + +import ( + _ "git.perx.ru/perxis/perxis-go/proto/common" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" + 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) +) + +// LogLevel задает уровень журналирования. +type LogLevel int32 + +const ( + // INFO - обозначает сообщения с нормальным, операционным уровнем журналирования. + LogLevel_INFO LogLevel = 0 + // WARNING - обозначает сообщения, которые содержат потенциально вредные ситуации. + LogLevel_WARNING LogLevel = 1 + // ERROR - обозначает другие ошибки в работе. + LogLevel_ERROR LogLevel = 2 + // CRITICAL - обозначает серьезные ошибки, из-за которых программа может не выполнять некоторые функции. + LogLevel_CRITICAL LogLevel = 3 + // FATAL - обозначает очень серьезные ошибки, которые могут привести к остановке приложения. + LogLevel_FATAL LogLevel = 4 +) + +// Enum value maps for LogLevel. +var ( + LogLevel_name = map[int32]string{ + 0: "INFO", + 1: "WARNING", + 2: "ERROR", + 3: "CRITICAL", + 4: "FATAL", + } + LogLevel_value = map[string]int32{ + "INFO": 0, + "WARNING": 1, + "ERROR": 2, + "CRITICAL": 3, + "FATAL": 4, + } +) + +func (x LogLevel) Enum() *LogLevel { + p := new(LogLevel) + *p = x + return p +} + +func (x LogLevel) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (LogLevel) Descriptor() protoreflect.EnumDescriptor { + return file_log_log_proto_enumTypes[0].Descriptor() +} + +func (LogLevel) Type() protoreflect.EnumType { + return &file_log_log_proto_enumTypes[0] +} + +func (x LogLevel) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use LogLevel.Descriptor instead. +func (LogLevel) EnumDescriptor() ([]byte, []int) { + return file_log_log_proto_rawDescGZIP(), []int{0} +} + +// LogEntry представляет собой структуру данных для хранения информации о журнале. +type LogEntry struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // id является уникальным идентификатором каждой записи в журнале. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // timestamp указывает на временную метку, указывающую когда было создано данное сообщение. + Timestamp *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Level LogLevel `protobuf:"varint,3,opt,name=level,proto3,enum=log.LogLevel" json:"level,omitempty"` // message это основное сообщение, которое требуется записать в лог. + Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"` + // category указывает на категорию события. + // Примеры: + // - + Category string `protobuf:"bytes,5,opt,name=category,proto3" json:"category,omitempty"` + Component string `protobuf:"bytes,6,opt,name=component,proto3" json:"component,omitempty"` + // action описывает действие, которое было произведено. Это поле может принимать разные значения в зависимости от сервиса. + // Примеры: + // - item.create + // - item.update + // - organization.create + // - action.run + // - reference.create + Event string `protobuf:"bytes,7,opt,name=event,proto3" json:"event,omitempty"` + // object это идентификатор объекта связанного с событием + // Идентификатор объекта должен быть в формате GlobalID: + // <контекст>/<тип объекта>/<идентификатор объекта> + // где: + // - <контекст> - представляет собой иднетификатор родительского объекта, если таковой имеется + // - <тип объекта> - представляет собой тип объекта, например: + // spaces, envs, cols, items, revs, fields, clients, roles, orgs, users + // - <идентификатор объекта> - представляет собой идентификатор объекта + // + // Примеры: + // /spaces/<space_id> - пространство + // /spaces/<space_id>/envs/<env_id> - окружение + // /spaces/<space_id>/envs/<env_id>/cols/<collection_id> - коллекция + // /spaces/<space_id>/cols/<collection_id> - коллекция в окружении "master" + // /spaces/<space_id>/envs/<env_id>/schema/<collection_id> - схема коллекции + // /spaces/<space_id>/envs/<env_id>/cols/<collection_id>/items/<item_id> - элемент коллекции + // /spaces/<space_id>/cols/<collection_id>/items/<item_id> - элемент коллекции в окружении "master" + // /spaces/<space_id>/envs/<env_id>/cols/<collection_id>/items/<item_id>/fields/<field_name> - поле элемента коллекции + // /spaces/<space_id>/envs/<env_id>/cols/<collection_id>/items/<item_id>/revs/<rev_id> - ревизия элемента коллекции + // /spaces/<space_id>/clients/<client_id> - клиент + // /spaces/<space_id>/roles/<role_id> - роль + // /orgs/<org_id> - организация + // /users/<user_id> - пользователь + // /services/<service_id> - сервис + Object string `protobuf:"bytes,8,opt,name=object,proto3" json:"object,omitempty"` + // caller содержит идентификатор сущности вызвавшей событиe, аналогично полю object + // + // Примеры: + // /users/<user_id> - пользователь + // /spaces/<space_id>/clients/<client_id> - клиент + // /services/<service_id> - сервис + Caller string `protobuf:"bytes,9,opt,name=caller,proto3" json:"caller,omitempty"` + // attr содержит дополнительные связанные с событием атрибуты в формате Any + // позволяет добавить дополнительные данные в событие + Attr *anypb.Any `protobuf:"bytes,10,opt,name=attr,proto3" json:"attr,omitempty"` + // tags содержит теги связанные с событием, на усмотрение сервиса + Tags []string `protobuf:"bytes,11,rep,name=tags,proto3" json:"tags,omitempty"` +} + +func (x *LogEntry) Reset() { + *x = LogEntry{} + if protoimpl.UnsafeEnabled { + mi := &file_log_log_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LogEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LogEntry) ProtoMessage() {} + +func (x *LogEntry) ProtoReflect() protoreflect.Message { + mi := &file_log_log_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LogEntry.ProtoReflect.Descriptor instead. +func (*LogEntry) Descriptor() ([]byte, []int) { + return file_log_log_proto_rawDescGZIP(), []int{0} +} + +func (x *LogEntry) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *LogEntry) GetTimestamp() *timestamppb.Timestamp { + if x != nil { + return x.Timestamp + } + return nil +} + +func (x *LogEntry) GetLevel() LogLevel { + if x != nil { + return x.Level + } + return LogLevel_INFO +} + +func (x *LogEntry) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *LogEntry) GetCategory() string { + if x != nil { + return x.Category + } + return "" +} + +func (x *LogEntry) GetComponent() string { + if x != nil { + return x.Component + } + return "" +} + +func (x *LogEntry) GetEvent() string { + if x != nil { + return x.Event + } + return "" +} + +func (x *LogEntry) GetObject() string { + if x != nil { + return x.Object + } + return "" +} + +func (x *LogEntry) GetCaller() string { + if x != nil { + return x.Caller + } + return "" +} + +func (x *LogEntry) GetAttr() *anypb.Any { + if x != nil { + return x.Attr + } + return nil +} + +func (x *LogEntry) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + +var File_log_log_proto protoreflect.FileDescriptor + +var file_log_log_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x6c, 0x6f, 0x67, 0x2f, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x03, 0x6c, 0x6f, 0x67, 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, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x12, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd1, 0x02, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, + 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, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x23, 0x0a, 0x05, 0x6c, + 0x65, 0x76, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x6c, 0x6f, 0x67, + 0x2e, 0x4c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, + 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, + 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x61, + 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, + 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, + 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x61, 0x6c, 0x6c, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x63, 0x61, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x28, 0x0a, 0x04, 0x61, 0x74, + 0x74, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, + 0x61, 0x74, 0x74, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x0b, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x2a, 0x45, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x4c, + 0x65, 0x76, 0x65, 0x6c, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0x00, 0x12, 0x0b, + 0x0a, 0x07, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x45, + 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x52, 0x49, 0x54, 0x49, 0x43, + 0x41, 0x4c, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x46, 0x41, 0x54, 0x41, 0x4c, 0x10, 0x04, 0x42, + 0x2c, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x2e, 0x70, 0x65, 0x72, 0x78, 0x2e, 0x72, 0x75, 0x2f, 0x70, + 0x65, 0x72, 0x78, 0x69, 0x73, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2d, 0x67, 0x6f, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6c, 0x6f, 0x67, 0x3b, 0x6c, 0x6f, 0x67, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_log_log_proto_rawDescOnce sync.Once + file_log_log_proto_rawDescData = file_log_log_proto_rawDesc +) + +func file_log_log_proto_rawDescGZIP() []byte { + file_log_log_proto_rawDescOnce.Do(func() { + file_log_log_proto_rawDescData = protoimpl.X.CompressGZIP(file_log_log_proto_rawDescData) + }) + return file_log_log_proto_rawDescData +} + +var file_log_log_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_log_log_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_log_log_proto_goTypes = []interface{}{ + (LogLevel)(0), // 0: log.LogLevel + (*LogEntry)(nil), // 1: log.LogEntry + (*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp + (*anypb.Any)(nil), // 3: google.protobuf.Any +} +var file_log_log_proto_depIdxs = []int32{ + 2, // 0: log.LogEntry.timestamp:type_name -> google.protobuf.Timestamp + 0, // 1: log.LogEntry.level:type_name -> log.LogLevel + 3, // 2: log.LogEntry.attr:type_name -> google.protobuf.Any + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] 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_log_log_proto_init() } +func file_log_log_proto_init() { + if File_log_log_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_log_log_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LogEntry); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_log_log_proto_rawDesc, + NumEnums: 1, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_log_log_proto_goTypes, + DependencyIndexes: file_log_log_proto_depIdxs, + EnumInfos: file_log_log_proto_enumTypes, + MessageInfos: file_log_log_proto_msgTypes, + }.Build() + File_log_log_proto = out.File + file_log_log_proto_rawDesc = nil + file_log_log_proto_goTypes = nil + file_log_log_proto_depIdxs = nil +} diff --git a/proto/log/log_service.pb.go b/proto/log/log_service.pb.go new file mode 100644 index 0000000000000000000000000000000000000000..02d2c1074d9bdb111da86dc8a02fabc22eb850c4 --- /dev/null +++ b/proto/log/log_service.pb.go @@ -0,0 +1,734 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v4.25.1 +// source: log/log_service.proto + +package log + +import ( + common "git.perx.ru/perxis/perxis-go/proto/common" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + _ "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) +) + +// Запрос для лога +type LogRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Запись лога + Entries []*LogEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` +} + +func (x *LogRequest) Reset() { + *x = LogRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_log_log_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LogRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LogRequest) ProtoMessage() {} + +func (x *LogRequest) ProtoReflect() protoreflect.Message { + mi := &file_log_log_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LogRequest.ProtoReflect.Descriptor instead. +func (*LogRequest) Descriptor() ([]byte, []int) { + return file_log_log_service_proto_rawDescGZIP(), []int{0} +} + +func (x *LogRequest) GetEntries() []*LogEntry { + if x != nil { + return x.Entries + } + return nil +} + +// Ответ сервера на запрос лога +type LogResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Содержит информацию об ошибке, если таковая имеется + Error *common.Error `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *LogResponse) Reset() { + *x = LogResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_log_log_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LogResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LogResponse) ProtoMessage() {} + +func (x *LogResponse) ProtoReflect() protoreflect.Message { + mi := &file_log_log_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LogResponse.ProtoReflect.Descriptor instead. +func (*LogResponse) Descriptor() ([]byte, []int) { + return file_log_log_service_proto_rawDescGZIP(), []int{1} +} + +func (x *LogResponse) GetError() *common.Error { + if x != nil { + return x.Error + } + return nil +} + +type Filter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Запрос на поиск логов + // Примеры: + // 1. `timestamp > '2019-01-01' AND timestamp < '2019-01-02'` + // 2. `timestamp > '2019-01-01' AND timestamp < '2019-01-02' AND level = 'error'` + // 3. `component = 'api' AND object_id = '123' AND object_type = 'item' AND space = 'spc1'` + // 4. `id in ['1', '2', '3']` + Q []string `protobuf:"bytes,3,rep,name=q,proto3" json:"q,omitempty"` // Список выражений для фильтрации +} + +func (x *Filter) Reset() { + *x = Filter{} + if protoimpl.UnsafeEnabled { + mi := &file_log_log_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Filter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Filter) ProtoMessage() {} + +func (x *Filter) ProtoReflect() protoreflect.Message { + mi := &file_log_log_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Filter.ProtoReflect.Descriptor instead. +func (*Filter) Descriptor() ([]byte, []int) { + return file_log_log_service_proto_rawDescGZIP(), []int{2} +} + +func (x *Filter) GetQ() []string { + if x != nil { + return x.Q + } + return nil +} + +// Запрос на поиск логов +type FindRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Фильтры для поиска + Filter *Filter `protobuf:"bytes,2,opt,name=filter,proto3" json:"filter,omitempty"` + // Опции поиска + Options *common.FindOptions `protobuf:"bytes,3,opt,name=options,proto3" json:"options,omitempty"` +} + +func (x *FindRequest) Reset() { + *x = FindRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_log_log_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindRequest) ProtoMessage() {} + +func (x *FindRequest) ProtoReflect() protoreflect.Message { + mi := &file_log_log_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FindRequest.ProtoReflect.Descriptor instead. +func (*FindRequest) Descriptor() ([]byte, []int) { + return file_log_log_service_proto_rawDescGZIP(), []int{3} +} + +func (x *FindRequest) GetFilter() *Filter { + if x != nil { + return x.Filter + } + return nil +} + +func (x *FindRequest) GetOptions() *common.FindOptions { + if x != nil { + return x.Options + } + return nil +} + +// Результат поиска +type FindResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Найденные записи лога + Entries []*LogEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` + // Использовавшийся для поиска фильтр + // Для + Filter *Filter `protobuf:"bytes,2,opt,name=filter,proto3" json:"filter,omitempty"` + // Использовавшиеся для поиска опции + Options *common.FindOptions `protobuf:"bytes,3,opt,name=options,proto3" json:"options,omitempty"` + // Общее количество найденных записей + Total uint32 `protobuf:"varint,4,opt,name=total,proto3" json:"total,omitempty"` +} + +func (x *FindResult) Reset() { + *x = FindResult{} + if protoimpl.UnsafeEnabled { + mi := &file_log_log_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindResult) ProtoMessage() {} + +func (x *FindResult) ProtoReflect() protoreflect.Message { + mi := &file_log_log_service_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FindResult.ProtoReflect.Descriptor instead. +func (*FindResult) Descriptor() ([]byte, []int) { + return file_log_log_service_proto_rawDescGZIP(), []int{4} +} + +func (x *FindResult) GetEntries() []*LogEntry { + if x != nil { + return x.Entries + } + return nil +} + +func (x *FindResult) GetFilter() *Filter { + if x != nil { + return x.Filter + } + return nil +} + +func (x *FindResult) GetOptions() *common.FindOptions { + if x != nil { + return x.Options + } + return nil +} + +func (x *FindResult) GetTotal() uint32 { + if x != nil { + return x.Total + } + return 0 +} + +// Ответ сервера на запрос поиска +type FindResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Response: + // + // *FindResponse_Result + // *FindResponse_Error + Response isFindResponse_Response `protobuf_oneof:"response"` +} + +func (x *FindResponse) Reset() { + *x = FindResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_log_log_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindResponse) ProtoMessage() {} + +func (x *FindResponse) ProtoReflect() protoreflect.Message { + mi := &file_log_log_service_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FindResponse.ProtoReflect.Descriptor instead. +func (*FindResponse) Descriptor() ([]byte, []int) { + return file_log_log_service_proto_rawDescGZIP(), []int{5} +} + +func (m *FindResponse) GetResponse() isFindResponse_Response { + if m != nil { + return m.Response + } + return nil +} + +func (x *FindResponse) GetResult() *FindResult { + if x, ok := x.GetResponse().(*FindResponse_Result); ok { + return x.Result + } + return nil +} + +func (x *FindResponse) GetError() *common.Error { + if x, ok := x.GetResponse().(*FindResponse_Error); ok { + return x.Error + } + return nil +} + +type isFindResponse_Response interface { + isFindResponse_Response() +} + +type FindResponse_Result struct { + // Результаты поиска + Result *FindResult `protobuf:"bytes,1,opt,name=result,proto3,oneof"` +} + +type FindResponse_Error struct { + // Информация об ошибке, если таковая имеется + Error *common.Error `protobuf:"bytes,2,opt,name=error,proto3,oneof"` +} + +func (*FindResponse_Result) isFindResponse_Response() {} + +func (*FindResponse_Error) isFindResponse_Response() {} + +// Запрос на удаление логов +type DeleteRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Фильтры для удаления + Filter *Filter `protobuf:"bytes,2,opt,name=filter,proto3" json:"filter,omitempty"` +} + +func (x *DeleteRequest) Reset() { + *x = DeleteRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_log_log_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRequest) ProtoMessage() {} + +func (x *DeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_log_log_service_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead. +func (*DeleteRequest) Descriptor() ([]byte, []int) { + return file_log_log_service_proto_rawDescGZIP(), []int{6} +} + +func (x *DeleteRequest) GetFilter() *Filter { + if x != nil { + return x.Filter + } + return nil +} + +// Ответ сервера на запрос удаления +type DeleteResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Информация об ошибке, если таковая имеется + Error *common.Error `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *DeleteResponse) Reset() { + *x = DeleteResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_log_log_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteResponse) ProtoMessage() {} + +func (x *DeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_log_log_service_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead. +func (*DeleteResponse) Descriptor() ([]byte, []int) { + return file_log_log_service_proto_rawDescGZIP(), []int{7} +} + +func (x *DeleteResponse) GetError() *common.Error { + if x != nil { + return x.Error + } + return nil +} + +var File_log_log_service_proto protoreflect.FileDescriptor + +var file_log_log_service_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x6c, 0x6f, 0x67, 0x2f, 0x6c, 0x6f, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6c, 0x6f, 0x67, 0x1a, 0x13, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x12, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0d, 0x6c, 0x6f, 0x67, 0x2f, 0x6c, 0x6f, 0x67, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 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, 0x35, 0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x4c, 0x6f, 0x67, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x22, 0x32, 0x0a, 0x0b, + 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x22, 0x16, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x0c, 0x0a, 0x01, 0x71, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x01, 0x71, 0x22, 0x61, 0x0a, 0x0b, 0x46, 0x69, 0x6e, 0x64, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x46, 0x69, + 0x6c, 0x74, 0x65, 0x72, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x2d, 0x0a, 0x07, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x9f, 0x01, 0x0a, 0x0a, + 0x46, 0x69, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x27, 0x0a, 0x07, 0x65, 0x6e, + 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6c, 0x6f, + 0x67, 0x2e, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, + 0x69, 0x65, 0x73, 0x12, 0x23, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x2d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x22, 0x6c, 0x0a, + 0x0c, 0x46, 0x69, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, + 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, + 0x6c, 0x6f, 0x67, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x48, 0x00, + 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x25, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x48, 0x00, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x42, + 0x0a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x34, 0x0a, 0x0d, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x06, + 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x6c, + 0x6f, 0x67, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x22, 0x35, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x32, 0x9c, 0x01, 0x0a, 0x0a, 0x4c, 0x6f, 0x67, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2a, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x0f, + 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x10, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x2d, 0x0a, 0x04, 0x46, 0x69, 0x6e, 0x64, 0x12, 0x10, 0x2e, 0x6c, 0x6f, + 0x67, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, + 0x6c, 0x6f, 0x67, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x12, 0x33, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x12, 0x2e, 0x6c, + 0x6f, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x13, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x2c, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x2e, 0x70, + 0x65, 0x72, 0x78, 0x2e, 0x72, 0x75, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2f, 0x70, 0x65, + 0x72, 0x78, 0x69, 0x73, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6c, 0x6f, + 0x67, 0x3b, 0x6c, 0x6f, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_log_log_service_proto_rawDescOnce sync.Once + file_log_log_service_proto_rawDescData = file_log_log_service_proto_rawDesc +) + +func file_log_log_service_proto_rawDescGZIP() []byte { + file_log_log_service_proto_rawDescOnce.Do(func() { + file_log_log_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_log_log_service_proto_rawDescData) + }) + return file_log_log_service_proto_rawDescData +} + +var file_log_log_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_log_log_service_proto_goTypes = []interface{}{ + (*LogRequest)(nil), // 0: log.LogRequest + (*LogResponse)(nil), // 1: log.LogResponse + (*Filter)(nil), // 2: log.Filter + (*FindRequest)(nil), // 3: log.FindRequest + (*FindResult)(nil), // 4: log.FindResult + (*FindResponse)(nil), // 5: log.FindResponse + (*DeleteRequest)(nil), // 6: log.DeleteRequest + (*DeleteResponse)(nil), // 7: log.DeleteResponse + (*LogEntry)(nil), // 8: log.LogEntry + (*common.Error)(nil), // 9: common.Error + (*common.FindOptions)(nil), // 10: common.FindOptions +} +var file_log_log_service_proto_depIdxs = []int32{ + 8, // 0: log.LogRequest.entries:type_name -> log.LogEntry + 9, // 1: log.LogResponse.error:type_name -> common.Error + 2, // 2: log.FindRequest.filter:type_name -> log.Filter + 10, // 3: log.FindRequest.options:type_name -> common.FindOptions + 8, // 4: log.FindResult.entries:type_name -> log.LogEntry + 2, // 5: log.FindResult.filter:type_name -> log.Filter + 10, // 6: log.FindResult.options:type_name -> common.FindOptions + 4, // 7: log.FindResponse.result:type_name -> log.FindResult + 9, // 8: log.FindResponse.error:type_name -> common.Error + 2, // 9: log.DeleteRequest.filter:type_name -> log.Filter + 9, // 10: log.DeleteResponse.error:type_name -> common.Error + 0, // 11: log.LogService.Log:input_type -> log.LogRequest + 3, // 12: log.LogService.Find:input_type -> log.FindRequest + 6, // 13: log.LogService.Delete:input_type -> log.DeleteRequest + 1, // 14: log.LogService.Log:output_type -> log.LogResponse + 5, // 15: log.LogService.Find:output_type -> log.FindResponse + 7, // 16: log.LogService.Delete:output_type -> log.DeleteResponse + 14, // [14:17] is the sub-list for method output_type + 11, // [11:14] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name +} + +func init() { file_log_log_service_proto_init() } +func file_log_log_service_proto_init() { + if File_log_log_service_proto != nil { + return + } + file_log_log_proto_init() + if !protoimpl.UnsafeEnabled { + file_log_log_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LogRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_log_log_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LogResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_log_log_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Filter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_log_log_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_log_log_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_log_log_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_log_log_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_log_log_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_log_log_service_proto_msgTypes[5].OneofWrappers = []interface{}{ + (*FindResponse_Result)(nil), + (*FindResponse_Error)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_log_log_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_log_log_service_proto_goTypes, + DependencyIndexes: file_log_log_service_proto_depIdxs, + MessageInfos: file_log_log_service_proto_msgTypes, + }.Build() + File_log_log_service_proto = out.File + file_log_log_service_proto_rawDesc = nil + file_log_log_service_proto_goTypes = nil + file_log_log_service_proto_depIdxs = nil +} diff --git a/proto/log/log_service_grpc.pb.go b/proto/log/log_service_grpc.pb.go new file mode 100644 index 0000000000000000000000000000000000000000..d9dfda0b67492f3e5521a4f368d24502c206b542 --- /dev/null +++ b/proto/log/log_service_grpc.pb.go @@ -0,0 +1,189 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.25.1 +// source: log/log_service.proto + +package log + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + LogService_Log_FullMethodName = "/log.LogService/Log" + LogService_Find_FullMethodName = "/log.LogService/Find" + LogService_Delete_FullMethodName = "/log.LogService/Delete" +) + +// LogServiceClient is the client API for LogService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type LogServiceClient interface { + // Метод для записи логов + Log(ctx context.Context, in *LogRequest, opts ...grpc.CallOption) (*LogResponse, error) + // Метод для поиска логов по заданным параметрам + Find(ctx context.Context, in *FindRequest, opts ...grpc.CallOption) (*FindResponse, error) + // Метод для удаления логов по заданным параметрам + Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) +} + +type logServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewLogServiceClient(cc grpc.ClientConnInterface) LogServiceClient { + return &logServiceClient{cc} +} + +func (c *logServiceClient) Log(ctx context.Context, in *LogRequest, opts ...grpc.CallOption) (*LogResponse, error) { + out := new(LogResponse) + err := c.cc.Invoke(ctx, LogService_Log_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logServiceClient) Find(ctx context.Context, in *FindRequest, opts ...grpc.CallOption) (*FindResponse, error) { + out := new(FindResponse) + err := c.cc.Invoke(ctx, LogService_Find_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { + out := new(DeleteResponse) + err := c.cc.Invoke(ctx, LogService_Delete_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// LogServiceServer is the server API for LogService service. +// All implementations must embed UnimplementedLogServiceServer +// for forward compatibility +type LogServiceServer interface { + // Метод для записи логов + Log(context.Context, *LogRequest) (*LogResponse, error) + // Метод для поиска логов по заданным параметрам + Find(context.Context, *FindRequest) (*FindResponse, error) + // Метод для удаления логов по заданным параметрам + Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) + mustEmbedUnimplementedLogServiceServer() +} + +// UnimplementedLogServiceServer must be embedded to have forward compatible implementations. +type UnimplementedLogServiceServer struct { +} + +func (UnimplementedLogServiceServer) Log(context.Context, *LogRequest) (*LogResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Log not implemented") +} +func (UnimplementedLogServiceServer) Find(context.Context, *FindRequest) (*FindResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Find not implemented") +} +func (UnimplementedLogServiceServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} +func (UnimplementedLogServiceServer) mustEmbedUnimplementedLogServiceServer() {} + +// UnsafeLogServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to LogServiceServer will +// result in compilation errors. +type UnsafeLogServiceServer interface { + mustEmbedUnimplementedLogServiceServer() +} + +func RegisterLogServiceServer(s grpc.ServiceRegistrar, srv LogServiceServer) { + s.RegisterService(&LogService_ServiceDesc, srv) +} + +func _LogService_Log_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LogRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogServiceServer).Log(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: LogService_Log_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogServiceServer).Log(ctx, req.(*LogRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogService_Find_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FindRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogServiceServer).Find(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: LogService_Find_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogServiceServer).Find(ctx, req.(*FindRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogServiceServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: LogService_Delete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogServiceServer).Delete(ctx, req.(*DeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// LogService_ServiceDesc is the grpc.ServiceDesc for LogService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var LogService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "log.LogService", + HandlerType: (*LogServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Log", + Handler: _LogService_Log_Handler, + }, + { + MethodName: "Find", + Handler: _LogService_Find_Handler, + }, + { + MethodName: "Delete", + Handler: _LogService_Delete_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "log/log_service.proto", +}