From 82e04b052873c01c5b9ae448edaa6c51f60e2be5 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Tue, 7 Oct 2025 10:57:06 +0200 Subject: [PATCH 1/7] feat(x/scheduler): add event types --- x/scheduler/api/scheduler/v1/events.pulsar.go | 2034 +++++++++++++++++ x/scheduler/proto/scheduler/v1/events.proto | 56 + x/scheduler/types/events.pb.go | 1105 +++++++++ 3 files changed, 3195 insertions(+) create mode 100644 x/scheduler/api/scheduler/v1/events.pulsar.go create mode 100644 x/scheduler/proto/scheduler/v1/events.proto create mode 100644 x/scheduler/types/events.pb.go diff --git a/x/scheduler/api/scheduler/v1/events.pulsar.go b/x/scheduler/api/scheduler/v1/events.pulsar.go new file mode 100644 index 000000000..daef0628c --- /dev/null +++ b/x/scheduler/api/scheduler/v1/events.pulsar.go @@ -0,0 +1,2034 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package schedulerv1 + +import ( + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + _ "google.golang.org/protobuf/types/known/durationpb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_TaskScheduledEvent protoreflect.MessageDescriptor + fd_TaskScheduledEvent_id protoreflect.FieldDescriptor + fd_TaskScheduledEvent_typename protoreflect.FieldDescriptor + fd_TaskScheduledEvent_at protoreflect.FieldDescriptor +) + +func init() { + file_scheduler_v1_events_proto_init() + md_TaskScheduledEvent = File_scheduler_v1_events_proto.Messages().ByName("TaskScheduledEvent") + fd_TaskScheduledEvent_id = md_TaskScheduledEvent.Fields().ByName("id") + fd_TaskScheduledEvent_typename = md_TaskScheduledEvent.Fields().ByName("typename") + fd_TaskScheduledEvent_at = md_TaskScheduledEvent.Fields().ByName("at") +} + +var _ protoreflect.Message = (*fastReflection_TaskScheduledEvent)(nil) + +type fastReflection_TaskScheduledEvent TaskScheduledEvent + +func (x *TaskScheduledEvent) ProtoReflect() protoreflect.Message { + return (*fastReflection_TaskScheduledEvent)(x) +} + +func (x *TaskScheduledEvent) slowProtoReflect() protoreflect.Message { + mi := &file_scheduler_v1_events_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) +} + +var _fastReflection_TaskScheduledEvent_messageType fastReflection_TaskScheduledEvent_messageType +var _ protoreflect.MessageType = fastReflection_TaskScheduledEvent_messageType{} + +type fastReflection_TaskScheduledEvent_messageType struct{} + +func (x fastReflection_TaskScheduledEvent_messageType) Zero() protoreflect.Message { + return (*fastReflection_TaskScheduledEvent)(nil) +} +func (x fastReflection_TaskScheduledEvent_messageType) New() protoreflect.Message { + return new(fastReflection_TaskScheduledEvent) +} +func (x fastReflection_TaskScheduledEvent_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_TaskScheduledEvent +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_TaskScheduledEvent) Descriptor() protoreflect.MessageDescriptor { + return md_TaskScheduledEvent +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_TaskScheduledEvent) Type() protoreflect.MessageType { + return _fastReflection_TaskScheduledEvent_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_TaskScheduledEvent) New() protoreflect.Message { + return new(fastReflection_TaskScheduledEvent) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_TaskScheduledEvent) Interface() protoreflect.ProtoMessage { + return (*TaskScheduledEvent)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_TaskScheduledEvent) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Id != "" { + value := protoreflect.ValueOfString(x.Id) + if !f(fd_TaskScheduledEvent_id, value) { + return + } + } + if x.Typename != "" { + value := protoreflect.ValueOfString(x.Typename) + if !f(fd_TaskScheduledEvent_typename, value) { + return + } + } + if x.At != nil { + value := protoreflect.ValueOfMessage(x.At.ProtoReflect()) + if !f(fd_TaskScheduledEvent_at, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_TaskScheduledEvent) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "scheduler.v1.TaskScheduledEvent.id": + return x.Id != "" + case "scheduler.v1.TaskScheduledEvent.typename": + return x.Typename != "" + case "scheduler.v1.TaskScheduledEvent.at": + return x.At != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: scheduler.v1.TaskScheduledEvent")) + } + panic(fmt.Errorf("message scheduler.v1.TaskScheduledEvent does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_TaskScheduledEvent) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "scheduler.v1.TaskScheduledEvent.id": + x.Id = "" + case "scheduler.v1.TaskScheduledEvent.typename": + x.Typename = "" + case "scheduler.v1.TaskScheduledEvent.at": + x.At = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: scheduler.v1.TaskScheduledEvent")) + } + panic(fmt.Errorf("message scheduler.v1.TaskScheduledEvent does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_TaskScheduledEvent) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "scheduler.v1.TaskScheduledEvent.id": + value := x.Id + return protoreflect.ValueOfString(value) + case "scheduler.v1.TaskScheduledEvent.typename": + value := x.Typename + return protoreflect.ValueOfString(value) + case "scheduler.v1.TaskScheduledEvent.at": + value := x.At + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: scheduler.v1.TaskScheduledEvent")) + } + panic(fmt.Errorf("message scheduler.v1.TaskScheduledEvent does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_TaskScheduledEvent) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "scheduler.v1.TaskScheduledEvent.id": + x.Id = value.Interface().(string) + case "scheduler.v1.TaskScheduledEvent.typename": + x.Typename = value.Interface().(string) + case "scheduler.v1.TaskScheduledEvent.at": + x.At = value.Message().Interface().(*timestamppb.Timestamp) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: scheduler.v1.TaskScheduledEvent")) + } + panic(fmt.Errorf("message scheduler.v1.TaskScheduledEvent does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_TaskScheduledEvent) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "scheduler.v1.TaskScheduledEvent.at": + if x.At == nil { + x.At = new(timestamppb.Timestamp) + } + return protoreflect.ValueOfMessage(x.At.ProtoReflect()) + case "scheduler.v1.TaskScheduledEvent.id": + panic(fmt.Errorf("field id of message scheduler.v1.TaskScheduledEvent is not mutable")) + case "scheduler.v1.TaskScheduledEvent.typename": + panic(fmt.Errorf("field typename of message scheduler.v1.TaskScheduledEvent is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: scheduler.v1.TaskScheduledEvent")) + } + panic(fmt.Errorf("message scheduler.v1.TaskScheduledEvent does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_TaskScheduledEvent) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "scheduler.v1.TaskScheduledEvent.id": + return protoreflect.ValueOfString("") + case "scheduler.v1.TaskScheduledEvent.typename": + return protoreflect.ValueOfString("") + case "scheduler.v1.TaskScheduledEvent.at": + m := new(timestamppb.Timestamp) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: scheduler.v1.TaskScheduledEvent")) + } + panic(fmt.Errorf("message scheduler.v1.TaskScheduledEvent does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_TaskScheduledEvent) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in scheduler.v1.TaskScheduledEvent", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_TaskScheduledEvent) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_TaskScheduledEvent) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_TaskScheduledEvent) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_TaskScheduledEvent) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*TaskScheduledEvent) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Id) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Typename) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.At != nil { + l = options.Size(x.At) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*TaskScheduledEvent) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.At != nil { + encoded, err := options.Marshal(x.At) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if len(x.Typename) > 0 { + i -= len(x.Typename) + copy(dAtA[i:], x.Typename) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Typename))) + i-- + dAtA[i] = 0x12 + } + if len(x.Id) > 0 { + i -= len(x.Id) + copy(dAtA[i:], x.Id) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Id))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*TaskScheduledEvent) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: TaskScheduledEvent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: TaskScheduledEvent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Typename", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Typename = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field At", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.At == nil { + x.At = ×tamppb.Timestamp{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.At); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_TaskUnscheduledEvent protoreflect.MessageDescriptor + fd_TaskUnscheduledEvent_id protoreflect.FieldDescriptor + fd_TaskUnscheduledEvent_typename protoreflect.FieldDescriptor + fd_TaskUnscheduledEvent_at protoreflect.FieldDescriptor +) + +func init() { + file_scheduler_v1_events_proto_init() + md_TaskUnscheduledEvent = File_scheduler_v1_events_proto.Messages().ByName("TaskUnscheduledEvent") + fd_TaskUnscheduledEvent_id = md_TaskUnscheduledEvent.Fields().ByName("id") + fd_TaskUnscheduledEvent_typename = md_TaskUnscheduledEvent.Fields().ByName("typename") + fd_TaskUnscheduledEvent_at = md_TaskUnscheduledEvent.Fields().ByName("at") +} + +var _ protoreflect.Message = (*fastReflection_TaskUnscheduledEvent)(nil) + +type fastReflection_TaskUnscheduledEvent TaskUnscheduledEvent + +func (x *TaskUnscheduledEvent) ProtoReflect() protoreflect.Message { + return (*fastReflection_TaskUnscheduledEvent)(x) +} + +func (x *TaskUnscheduledEvent) slowProtoReflect() protoreflect.Message { + mi := &file_scheduler_v1_events_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) +} + +var _fastReflection_TaskUnscheduledEvent_messageType fastReflection_TaskUnscheduledEvent_messageType +var _ protoreflect.MessageType = fastReflection_TaskUnscheduledEvent_messageType{} + +type fastReflection_TaskUnscheduledEvent_messageType struct{} + +func (x fastReflection_TaskUnscheduledEvent_messageType) Zero() protoreflect.Message { + return (*fastReflection_TaskUnscheduledEvent)(nil) +} +func (x fastReflection_TaskUnscheduledEvent_messageType) New() protoreflect.Message { + return new(fastReflection_TaskUnscheduledEvent) +} +func (x fastReflection_TaskUnscheduledEvent_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_TaskUnscheduledEvent +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_TaskUnscheduledEvent) Descriptor() protoreflect.MessageDescriptor { + return md_TaskUnscheduledEvent +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_TaskUnscheduledEvent) Type() protoreflect.MessageType { + return _fastReflection_TaskUnscheduledEvent_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_TaskUnscheduledEvent) New() protoreflect.Message { + return new(fastReflection_TaskUnscheduledEvent) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_TaskUnscheduledEvent) Interface() protoreflect.ProtoMessage { + return (*TaskUnscheduledEvent)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_TaskUnscheduledEvent) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Id != "" { + value := protoreflect.ValueOfString(x.Id) + if !f(fd_TaskUnscheduledEvent_id, value) { + return + } + } + if x.Typename != "" { + value := protoreflect.ValueOfString(x.Typename) + if !f(fd_TaskUnscheduledEvent_typename, value) { + return + } + } + if x.At != nil { + value := protoreflect.ValueOfMessage(x.At.ProtoReflect()) + if !f(fd_TaskUnscheduledEvent_at, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_TaskUnscheduledEvent) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "scheduler.v1.TaskUnscheduledEvent.id": + return x.Id != "" + case "scheduler.v1.TaskUnscheduledEvent.typename": + return x.Typename != "" + case "scheduler.v1.TaskUnscheduledEvent.at": + return x.At != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: scheduler.v1.TaskUnscheduledEvent")) + } + panic(fmt.Errorf("message scheduler.v1.TaskUnscheduledEvent does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_TaskUnscheduledEvent) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "scheduler.v1.TaskUnscheduledEvent.id": + x.Id = "" + case "scheduler.v1.TaskUnscheduledEvent.typename": + x.Typename = "" + case "scheduler.v1.TaskUnscheduledEvent.at": + x.At = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: scheduler.v1.TaskUnscheduledEvent")) + } + panic(fmt.Errorf("message scheduler.v1.TaskUnscheduledEvent does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_TaskUnscheduledEvent) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "scheduler.v1.TaskUnscheduledEvent.id": + value := x.Id + return protoreflect.ValueOfString(value) + case "scheduler.v1.TaskUnscheduledEvent.typename": + value := x.Typename + return protoreflect.ValueOfString(value) + case "scheduler.v1.TaskUnscheduledEvent.at": + value := x.At + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: scheduler.v1.TaskUnscheduledEvent")) + } + panic(fmt.Errorf("message scheduler.v1.TaskUnscheduledEvent does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_TaskUnscheduledEvent) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "scheduler.v1.TaskUnscheduledEvent.id": + x.Id = value.Interface().(string) + case "scheduler.v1.TaskUnscheduledEvent.typename": + x.Typename = value.Interface().(string) + case "scheduler.v1.TaskUnscheduledEvent.at": + x.At = value.Message().Interface().(*timestamppb.Timestamp) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: scheduler.v1.TaskUnscheduledEvent")) + } + panic(fmt.Errorf("message scheduler.v1.TaskUnscheduledEvent does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_TaskUnscheduledEvent) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "scheduler.v1.TaskUnscheduledEvent.at": + if x.At == nil { + x.At = new(timestamppb.Timestamp) + } + return protoreflect.ValueOfMessage(x.At.ProtoReflect()) + case "scheduler.v1.TaskUnscheduledEvent.id": + panic(fmt.Errorf("field id of message scheduler.v1.TaskUnscheduledEvent is not mutable")) + case "scheduler.v1.TaskUnscheduledEvent.typename": + panic(fmt.Errorf("field typename of message scheduler.v1.TaskUnscheduledEvent is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: scheduler.v1.TaskUnscheduledEvent")) + } + panic(fmt.Errorf("message scheduler.v1.TaskUnscheduledEvent does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_TaskUnscheduledEvent) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "scheduler.v1.TaskUnscheduledEvent.id": + return protoreflect.ValueOfString("") + case "scheduler.v1.TaskUnscheduledEvent.typename": + return protoreflect.ValueOfString("") + case "scheduler.v1.TaskUnscheduledEvent.at": + m := new(timestamppb.Timestamp) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: scheduler.v1.TaskUnscheduledEvent")) + } + panic(fmt.Errorf("message scheduler.v1.TaskUnscheduledEvent does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_TaskUnscheduledEvent) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in scheduler.v1.TaskUnscheduledEvent", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_TaskUnscheduledEvent) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_TaskUnscheduledEvent) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_TaskUnscheduledEvent) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_TaskUnscheduledEvent) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*TaskUnscheduledEvent) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Id) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Typename) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.At != nil { + l = options.Size(x.At) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*TaskUnscheduledEvent) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.At != nil { + encoded, err := options.Marshal(x.At) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if len(x.Typename) > 0 { + i -= len(x.Typename) + copy(dAtA[i:], x.Typename) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Typename))) + i-- + dAtA[i] = 0x12 + } + if len(x.Id) > 0 { + i -= len(x.Id) + copy(dAtA[i:], x.Id) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Id))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*TaskUnscheduledEvent) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: TaskUnscheduledEvent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: TaskUnscheduledEvent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Typename", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Typename = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field At", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.At == nil { + x.At = ×tamppb.Timestamp{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.At); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_TaskExecutedEvent protoreflect.MessageDescriptor + fd_TaskExecutedEvent_id protoreflect.FieldDescriptor + fd_TaskExecutedEvent_typename protoreflect.FieldDescriptor + fd_TaskExecutedEvent_at protoreflect.FieldDescriptor +) + +func init() { + file_scheduler_v1_events_proto_init() + md_TaskExecutedEvent = File_scheduler_v1_events_proto.Messages().ByName("TaskExecutedEvent") + fd_TaskExecutedEvent_id = md_TaskExecutedEvent.Fields().ByName("id") + fd_TaskExecutedEvent_typename = md_TaskExecutedEvent.Fields().ByName("typename") + fd_TaskExecutedEvent_at = md_TaskExecutedEvent.Fields().ByName("at") +} + +var _ protoreflect.Message = (*fastReflection_TaskExecutedEvent)(nil) + +type fastReflection_TaskExecutedEvent TaskExecutedEvent + +func (x *TaskExecutedEvent) ProtoReflect() protoreflect.Message { + return (*fastReflection_TaskExecutedEvent)(x) +} + +func (x *TaskExecutedEvent) slowProtoReflect() protoreflect.Message { + mi := &file_scheduler_v1_events_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) +} + +var _fastReflection_TaskExecutedEvent_messageType fastReflection_TaskExecutedEvent_messageType +var _ protoreflect.MessageType = fastReflection_TaskExecutedEvent_messageType{} + +type fastReflection_TaskExecutedEvent_messageType struct{} + +func (x fastReflection_TaskExecutedEvent_messageType) Zero() protoreflect.Message { + return (*fastReflection_TaskExecutedEvent)(nil) +} +func (x fastReflection_TaskExecutedEvent_messageType) New() protoreflect.Message { + return new(fastReflection_TaskExecutedEvent) +} +func (x fastReflection_TaskExecutedEvent_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_TaskExecutedEvent +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_TaskExecutedEvent) Descriptor() protoreflect.MessageDescriptor { + return md_TaskExecutedEvent +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_TaskExecutedEvent) Type() protoreflect.MessageType { + return _fastReflection_TaskExecutedEvent_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_TaskExecutedEvent) New() protoreflect.Message { + return new(fastReflection_TaskExecutedEvent) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_TaskExecutedEvent) Interface() protoreflect.ProtoMessage { + return (*TaskExecutedEvent)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_TaskExecutedEvent) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Id != "" { + value := protoreflect.ValueOfString(x.Id) + if !f(fd_TaskExecutedEvent_id, value) { + return + } + } + if x.Typename != "" { + value := protoreflect.ValueOfString(x.Typename) + if !f(fd_TaskExecutedEvent_typename, value) { + return + } + } + if x.At != nil { + value := protoreflect.ValueOfMessage(x.At.ProtoReflect()) + if !f(fd_TaskExecutedEvent_at, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_TaskExecutedEvent) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "scheduler.v1.TaskExecutedEvent.id": + return x.Id != "" + case "scheduler.v1.TaskExecutedEvent.typename": + return x.Typename != "" + case "scheduler.v1.TaskExecutedEvent.at": + return x.At != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: scheduler.v1.TaskExecutedEvent")) + } + panic(fmt.Errorf("message scheduler.v1.TaskExecutedEvent does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_TaskExecutedEvent) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "scheduler.v1.TaskExecutedEvent.id": + x.Id = "" + case "scheduler.v1.TaskExecutedEvent.typename": + x.Typename = "" + case "scheduler.v1.TaskExecutedEvent.at": + x.At = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: scheduler.v1.TaskExecutedEvent")) + } + panic(fmt.Errorf("message scheduler.v1.TaskExecutedEvent does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_TaskExecutedEvent) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "scheduler.v1.TaskExecutedEvent.id": + value := x.Id + return protoreflect.ValueOfString(value) + case "scheduler.v1.TaskExecutedEvent.typename": + value := x.Typename + return protoreflect.ValueOfString(value) + case "scheduler.v1.TaskExecutedEvent.at": + value := x.At + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: scheduler.v1.TaskExecutedEvent")) + } + panic(fmt.Errorf("message scheduler.v1.TaskExecutedEvent does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_TaskExecutedEvent) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "scheduler.v1.TaskExecutedEvent.id": + x.Id = value.Interface().(string) + case "scheduler.v1.TaskExecutedEvent.typename": + x.Typename = value.Interface().(string) + case "scheduler.v1.TaskExecutedEvent.at": + x.At = value.Message().Interface().(*timestamppb.Timestamp) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: scheduler.v1.TaskExecutedEvent")) + } + panic(fmt.Errorf("message scheduler.v1.TaskExecutedEvent does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_TaskExecutedEvent) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "scheduler.v1.TaskExecutedEvent.at": + if x.At == nil { + x.At = new(timestamppb.Timestamp) + } + return protoreflect.ValueOfMessage(x.At.ProtoReflect()) + case "scheduler.v1.TaskExecutedEvent.id": + panic(fmt.Errorf("field id of message scheduler.v1.TaskExecutedEvent is not mutable")) + case "scheduler.v1.TaskExecutedEvent.typename": + panic(fmt.Errorf("field typename of message scheduler.v1.TaskExecutedEvent is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: scheduler.v1.TaskExecutedEvent")) + } + panic(fmt.Errorf("message scheduler.v1.TaskExecutedEvent does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_TaskExecutedEvent) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "scheduler.v1.TaskExecutedEvent.id": + return protoreflect.ValueOfString("") + case "scheduler.v1.TaskExecutedEvent.typename": + return protoreflect.ValueOfString("") + case "scheduler.v1.TaskExecutedEvent.at": + m := new(timestamppb.Timestamp) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: scheduler.v1.TaskExecutedEvent")) + } + panic(fmt.Errorf("message scheduler.v1.TaskExecutedEvent does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_TaskExecutedEvent) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in scheduler.v1.TaskExecutedEvent", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_TaskExecutedEvent) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_TaskExecutedEvent) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_TaskExecutedEvent) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_TaskExecutedEvent) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*TaskExecutedEvent) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Id) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Typename) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.At != nil { + l = options.Size(x.At) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*TaskExecutedEvent) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.At != nil { + encoded, err := options.Marshal(x.At) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if len(x.Typename) > 0 { + i -= len(x.Typename) + copy(dAtA[i:], x.Typename) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Typename))) + i-- + dAtA[i] = 0x12 + } + if len(x.Id) > 0 { + i -= len(x.Id) + copy(dAtA[i:], x.Id) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Id))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*TaskExecutedEvent) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: TaskExecutedEvent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: TaskExecutedEvent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Typename", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Typename = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field At", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.At == nil { + x.At = ×tamppb.Timestamp{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.At); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: scheduler/v1/events.proto + +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) +) + +// TaskScheduledEvent is emitted when a task is scheduled or rescheduled at a specific time. +// If a task is created with no scheduling (i.e. next_run_at is empty), this event is not emitted until the task is scheduled. +// If an arbitrage decision is made to reschedule a task, this event is emitted. +// For a periodic task, this event is emitted at each execution. +type TaskScheduledEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Id is the unique identifier for the task. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Typename is the type of the task. + Typename string `protobuf:"bytes,2,opt,name=typename,proto3" json:"typename,omitempty"` + // At is the timestamp when the task is scheduled to be executed. + At *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=at,proto3" json:"at,omitempty"` +} + +func (x *TaskScheduledEvent) Reset() { + *x = TaskScheduledEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_scheduler_v1_events_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TaskScheduledEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TaskScheduledEvent) ProtoMessage() {} + +// Deprecated: Use TaskScheduledEvent.ProtoReflect.Descriptor instead. +func (*TaskScheduledEvent) Descriptor() ([]byte, []int) { + return file_scheduler_v1_events_proto_rawDescGZIP(), []int{0} +} + +func (x *TaskScheduledEvent) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *TaskScheduledEvent) GetTypename() string { + if x != nil { + return x.Typename + } + return "" +} + +func (x *TaskScheduledEvent) GetAt() *timestamppb.Timestamp { + if x != nil { + return x.At + } + return nil +} + +// TaskUnscheduledEvent is emitted when a task that was scheduled, is cancelled or unscheduled. +// This can happen when a task is cancelled, or rescheduled with no next run time set. +// When an arbitrage decision is made, this event may also be emitted. +type TaskUnscheduledEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Id is the unique identifier for the task. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Typename is the type of the task. + Typename string `protobuf:"bytes,2,opt,name=typename,proto3" json:"typename,omitempty"` + // At is the timestamp when the task was scheduled to be executed. + At *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=at,proto3" json:"at,omitempty"` +} + +func (x *TaskUnscheduledEvent) Reset() { + *x = TaskUnscheduledEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_scheduler_v1_events_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TaskUnscheduledEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TaskUnscheduledEvent) ProtoMessage() {} + +// Deprecated: Use TaskUnscheduledEvent.ProtoReflect.Descriptor instead. +func (*TaskUnscheduledEvent) Descriptor() ([]byte, []int) { + return file_scheduler_v1_events_proto_rawDescGZIP(), []int{1} +} + +func (x *TaskUnscheduledEvent) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *TaskUnscheduledEvent) GetTypename() string { + if x != nil { + return x.Typename + } + return "" +} + +func (x *TaskUnscheduledEvent) GetAt() *timestamppb.Timestamp { + if x != nil { + return x.At + } + return nil +} + +// TaskExecutedEvent is emitted when a task is executed. +// This event is emitted regardless of whether the task execution was successful or failed. +type TaskExecutedEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Id is the unique identifier for the task. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Typename is the type of the task. + Typename string `protobuf:"bytes,2,opt,name=typename,proto3" json:"typename,omitempty"` + // At is the timestamp when the task was scheduled to be executed, which can differ from the actual block time. + At *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=at,proto3" json:"at,omitempty"` +} + +func (x *TaskExecutedEvent) Reset() { + *x = TaskExecutedEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_scheduler_v1_events_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TaskExecutedEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TaskExecutedEvent) ProtoMessage() {} + +// Deprecated: Use TaskExecutedEvent.ProtoReflect.Descriptor instead. +func (*TaskExecutedEvent) Descriptor() ([]byte, []int) { + return file_scheduler_v1_events_proto_rawDescGZIP(), []int{2} +} + +func (x *TaskExecutedEvent) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *TaskExecutedEvent) GetTypename() string { + if x != nil { + return x.Typename + } + return "" +} + +func (x *TaskExecutedEvent) GetAt() *timestamppb.Timestamp { + if x != nil { + return x.At + } + return nil +} + +var File_scheduler_v1_events_proto protoreflect.FileDescriptor + +var file_scheduler_v1_events_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x65, + 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x73, 0x63, 0x68, + 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 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, + 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x88, 0x01, 0x0a, 0x12, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, + 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x0e, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x06, 0x54, 0x61, 0x73, + 0x6b, 0x49, 0x44, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x79, 0x70, 0x65, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x79, 0x70, 0x65, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x02, 0x61, 0x74, 0x18, 0x03, 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, 0x42, 0x04, 0x90, 0xdf, 0x1f, + 0x01, 0x52, 0x02, 0x61, 0x74, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01, 0x22, 0x8a, 0x01, 0x0a, 0x14, + 0x54, 0x61, 0x73, 0x6b, 0x55, 0x6e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x64, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x0e, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x06, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x44, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x79, 0x70, 0x65, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x79, 0x70, 0x65, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x30, 0x0a, 0x02, 0x61, 0x74, 0x18, 0x03, 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, 0x42, 0x04, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x02, + 0x61, 0x74, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01, 0x22, 0x87, 0x01, 0x0a, 0x11, 0x54, 0x61, 0x73, + 0x6b, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xc8, 0xde, 0x1f, 0x00, + 0xda, 0xde, 0x1f, 0x06, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x44, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, + 0x0a, 0x08, 0x74, 0x79, 0x70, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x74, 0x79, 0x70, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x02, 0x61, 0x74, + 0x18, 0x03, 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, 0x42, 0x04, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x02, 0x61, 0x74, 0x3a, 0x04, 0xe8, 0xa0, + 0x1f, 0x01, 0x42, 0xc1, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, + 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x61, 0x6c, 0x6c, 0x6f, 0x72, 0x61, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x2f, 0x61, 0x6c, 0x6c, 0x6f, 0x72, 0x61, 0x2d, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2f, 0x78, + 0x2f, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, + 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x73, 0x63, 0x68, 0x65, + 0x64, 0x75, 0x6c, 0x65, 0x72, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x58, 0x58, 0xaa, 0x02, 0x0c, + 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x53, + 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x53, 0x63, + 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, + 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_scheduler_v1_events_proto_rawDescOnce sync.Once + file_scheduler_v1_events_proto_rawDescData = file_scheduler_v1_events_proto_rawDesc +) + +func file_scheduler_v1_events_proto_rawDescGZIP() []byte { + file_scheduler_v1_events_proto_rawDescOnce.Do(func() { + file_scheduler_v1_events_proto_rawDescData = protoimpl.X.CompressGZIP(file_scheduler_v1_events_proto_rawDescData) + }) + return file_scheduler_v1_events_proto_rawDescData +} + +var file_scheduler_v1_events_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_scheduler_v1_events_proto_goTypes = []interface{}{ + (*TaskScheduledEvent)(nil), // 0: scheduler.v1.TaskScheduledEvent + (*TaskUnscheduledEvent)(nil), // 1: scheduler.v1.TaskUnscheduledEvent + (*TaskExecutedEvent)(nil), // 2: scheduler.v1.TaskExecutedEvent + (*timestamppb.Timestamp)(nil), // 3: google.protobuf.Timestamp +} +var file_scheduler_v1_events_proto_depIdxs = []int32{ + 3, // 0: scheduler.v1.TaskScheduledEvent.at:type_name -> google.protobuf.Timestamp + 3, // 1: scheduler.v1.TaskUnscheduledEvent.at:type_name -> google.protobuf.Timestamp + 3, // 2: scheduler.v1.TaskExecutedEvent.at:type_name -> google.protobuf.Timestamp + 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_scheduler_v1_events_proto_init() } +func file_scheduler_v1_events_proto_init() { + if File_scheduler_v1_events_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_scheduler_v1_events_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TaskScheduledEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_scheduler_v1_events_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TaskUnscheduledEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_scheduler_v1_events_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TaskExecutedEvent); 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_scheduler_v1_events_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_scheduler_v1_events_proto_goTypes, + DependencyIndexes: file_scheduler_v1_events_proto_depIdxs, + MessageInfos: file_scheduler_v1_events_proto_msgTypes, + }.Build() + File_scheduler_v1_events_proto = out.File + file_scheduler_v1_events_proto_rawDesc = nil + file_scheduler_v1_events_proto_goTypes = nil + file_scheduler_v1_events_proto_depIdxs = nil +} diff --git a/x/scheduler/proto/scheduler/v1/events.proto b/x/scheduler/proto/scheduler/v1/events.proto new file mode 100644 index 000000000..a9c08e097 --- /dev/null +++ b/x/scheduler/proto/scheduler/v1/events.proto @@ -0,0 +1,56 @@ +syntax = "proto3"; +package scheduler.v1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/duration.proto"; + +option go_package = "github.com/allora-network/allora-chain/x/scheduler/types"; + +// TaskScheduledEvent is emitted when a task is scheduled or rescheduled at a specific time. +// If a task is created with no scheduling (i.e. next_run_at is empty), this event is not emitted until the task is scheduled. +// If an arbitrage decision is made to reschedule a task, this event is emitted. +// For a periodic task, this event is emitted at each execution. +message TaskScheduledEvent { + option (gogoproto.equal) = true; + + // Id is the unique identifier for the task. + string id = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "TaskID"]; + + // Typename is the type of the task. + string typename = 2; + + // At is the timestamp when the task is scheduled to be executed. + google.protobuf.Timestamp at = 3 [(gogoproto.stdtime) = true]; +} + +// TaskUnscheduledEvent is emitted when a task that was scheduled, is cancelled or unscheduled. +// This can happen when a task is cancelled, or rescheduled with no next run time set. +// When an arbitrage decision is made, this event may also be emitted. +message TaskUnscheduledEvent { + option (gogoproto.equal) = true; + + // Id is the unique identifier for the task. + string id = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "TaskID"]; + + // Typename is the type of the task. + string typename = 2; + + // At is the timestamp when the task was scheduled to be executed. + google.protobuf.Timestamp at = 3 [(gogoproto.stdtime) = true]; +} + +// TaskExecutedEvent is emitted when a task is executed. +// This event is emitted regardless of whether the task execution was successful or failed. +message TaskExecutedEvent { + option (gogoproto.equal) = true; + + // Id is the unique identifier for the task. + string id = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "TaskID"]; + + // Typename is the type of the task. + string typename = 2; + + // At is the timestamp when the task was scheduled to be executed, which can differ from the actual block time. + google.protobuf.Timestamp at = 3 [(gogoproto.stdtime) = true]; +} diff --git a/x/scheduler/types/events.pb.go b/x/scheduler/types/events.pb.go new file mode 100644 index 000000000..23643fb29 --- /dev/null +++ b/x/scheduler/types/events.pb.go @@ -0,0 +1,1105 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: scheduler/v1/events.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + _ "google.golang.org/protobuf/types/known/durationpb" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// TaskScheduledEvent is emitted when a task is scheduled or rescheduled at a specific time. +// If a task is created with no scheduling (i.e. next_run_at is empty), this event is not emitted until the task is scheduled. +// If an arbitrage decision is made to reschedule a task, this event is emitted. +// For a periodic task, this event is emitted at each execution. +type TaskScheduledEvent struct { + // Id is the unique identifier for the task. + Id TaskID `protobuf:"bytes,1,opt,name=id,proto3,customtype=TaskID" json:"id"` + // Typename is the type of the task. + Typename string `protobuf:"bytes,2,opt,name=typename,proto3" json:"typename,omitempty"` + // At is the timestamp when the task is scheduled to be executed. + At *time.Time `protobuf:"bytes,3,opt,name=at,proto3,stdtime" json:"at,omitempty"` +} + +func (m *TaskScheduledEvent) Reset() { *m = TaskScheduledEvent{} } +func (m *TaskScheduledEvent) String() string { return proto.CompactTextString(m) } +func (*TaskScheduledEvent) ProtoMessage() {} +func (*TaskScheduledEvent) Descriptor() ([]byte, []int) { + return fileDescriptor_d5277773a989a729, []int{0} +} +func (m *TaskScheduledEvent) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TaskScheduledEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TaskScheduledEvent.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TaskScheduledEvent) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskScheduledEvent.Merge(m, src) +} +func (m *TaskScheduledEvent) XXX_Size() int { + return m.Size() +} +func (m *TaskScheduledEvent) XXX_DiscardUnknown() { + xxx_messageInfo_TaskScheduledEvent.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskScheduledEvent proto.InternalMessageInfo + +func (m *TaskScheduledEvent) GetTypename() string { + if m != nil { + return m.Typename + } + return "" +} + +func (m *TaskScheduledEvent) GetAt() *time.Time { + if m != nil { + return m.At + } + return nil +} + +// TaskUnscheduledEvent is emitted when a task that was scheduled, is cancelled or unscheduled. +// This can happen when a task is cancelled, or rescheduled with no next run time set. +// When an arbitrage decision is made, this event may also be emitted. +type TaskUnscheduledEvent struct { + // Id is the unique identifier for the task. + Id TaskID `protobuf:"bytes,1,opt,name=id,proto3,customtype=TaskID" json:"id"` + // Typename is the type of the task. + Typename string `protobuf:"bytes,2,opt,name=typename,proto3" json:"typename,omitempty"` + // At is the timestamp when the task was scheduled to be executed. + At *time.Time `protobuf:"bytes,3,opt,name=at,proto3,stdtime" json:"at,omitempty"` +} + +func (m *TaskUnscheduledEvent) Reset() { *m = TaskUnscheduledEvent{} } +func (m *TaskUnscheduledEvent) String() string { return proto.CompactTextString(m) } +func (*TaskUnscheduledEvent) ProtoMessage() {} +func (*TaskUnscheduledEvent) Descriptor() ([]byte, []int) { + return fileDescriptor_d5277773a989a729, []int{1} +} +func (m *TaskUnscheduledEvent) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TaskUnscheduledEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TaskUnscheduledEvent.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TaskUnscheduledEvent) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskUnscheduledEvent.Merge(m, src) +} +func (m *TaskUnscheduledEvent) XXX_Size() int { + return m.Size() +} +func (m *TaskUnscheduledEvent) XXX_DiscardUnknown() { + xxx_messageInfo_TaskUnscheduledEvent.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskUnscheduledEvent proto.InternalMessageInfo + +func (m *TaskUnscheduledEvent) GetTypename() string { + if m != nil { + return m.Typename + } + return "" +} + +func (m *TaskUnscheduledEvent) GetAt() *time.Time { + if m != nil { + return m.At + } + return nil +} + +// TaskExecutedEvent is emitted when a task is executed. +// This event is emitted regardless of whether the task execution was successful or failed. +type TaskExecutedEvent struct { + // Id is the unique identifier for the task. + Id TaskID `protobuf:"bytes,1,opt,name=id,proto3,customtype=TaskID" json:"id"` + // Typename is the type of the task. + Typename string `protobuf:"bytes,2,opt,name=typename,proto3" json:"typename,omitempty"` + // At is the timestamp when the task was scheduled to be executed, which can differ from the actual block time. + At *time.Time `protobuf:"bytes,3,opt,name=at,proto3,stdtime" json:"at,omitempty"` +} + +func (m *TaskExecutedEvent) Reset() { *m = TaskExecutedEvent{} } +func (m *TaskExecutedEvent) String() string { return proto.CompactTextString(m) } +func (*TaskExecutedEvent) ProtoMessage() {} +func (*TaskExecutedEvent) Descriptor() ([]byte, []int) { + return fileDescriptor_d5277773a989a729, []int{2} +} +func (m *TaskExecutedEvent) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TaskExecutedEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TaskExecutedEvent.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TaskExecutedEvent) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskExecutedEvent.Merge(m, src) +} +func (m *TaskExecutedEvent) XXX_Size() int { + return m.Size() +} +func (m *TaskExecutedEvent) XXX_DiscardUnknown() { + xxx_messageInfo_TaskExecutedEvent.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskExecutedEvent proto.InternalMessageInfo + +func (m *TaskExecutedEvent) GetTypename() string { + if m != nil { + return m.Typename + } + return "" +} + +func (m *TaskExecutedEvent) GetAt() *time.Time { + if m != nil { + return m.At + } + return nil +} + +func init() { + proto.RegisterType((*TaskScheduledEvent)(nil), "scheduler.v1.TaskScheduledEvent") + proto.RegisterType((*TaskUnscheduledEvent)(nil), "scheduler.v1.TaskUnscheduledEvent") + proto.RegisterType((*TaskExecutedEvent)(nil), "scheduler.v1.TaskExecutedEvent") +} + +func init() { proto.RegisterFile("scheduler/v1/events.proto", fileDescriptor_d5277773a989a729) } + +var fileDescriptor_d5277773a989a729 = []byte{ + // 316 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x92, 0xb1, 0x4e, 0xc2, 0x40, + 0x1c, 0x87, 0x7b, 0x95, 0x10, 0x3d, 0x8d, 0x89, 0x0d, 0x03, 0x76, 0xb8, 0x12, 0x26, 0x16, 0xef, + 0x44, 0x17, 0xe3, 0x48, 0x64, 0x70, 0xad, 0xb8, 0xb8, 0x1d, 0xed, 0x59, 0x2e, 0xb4, 0x77, 0xa4, + 0x77, 0x45, 0x7c, 0x02, 0x8d, 0x13, 0x8f, 0xe0, 0xe3, 0x30, 0x32, 0x1a, 0x07, 0x34, 0x74, 0xf1, + 0x31, 0xcc, 0xb5, 0x14, 0x13, 0x5f, 0x80, 0xed, 0xfe, 0xf9, 0x7d, 0xc9, 0xf7, 0x0d, 0x07, 0x4f, + 0x55, 0x30, 0x62, 0x61, 0x16, 0xb3, 0x94, 0x4c, 0xbb, 0x84, 0x4d, 0x99, 0xd0, 0x0a, 0x4f, 0x52, + 0xa9, 0xa5, 0x73, 0xb4, 0x9d, 0xf0, 0xb4, 0xeb, 0x36, 0x22, 0x19, 0xc9, 0x62, 0x20, 0xe6, 0x55, + 0x32, 0xae, 0x17, 0x49, 0x19, 0xc5, 0x8c, 0x14, 0xd7, 0x30, 0x7b, 0x24, 0x9a, 0x27, 0x4c, 0x69, + 0x9a, 0x4c, 0x36, 0x00, 0xfa, 0x0f, 0x84, 0x59, 0x4a, 0x35, 0x97, 0xa2, 0xdc, 0xdb, 0xaf, 0x00, + 0x3a, 0x03, 0xaa, 0xc6, 0x77, 0x1b, 0x57, 0xd8, 0x37, 0x09, 0x0e, 0x82, 0x36, 0x0f, 0x9b, 0xa0, + 0x05, 0x3a, 0x07, 0xbd, 0xe3, 0xc5, 0xca, 0xb3, 0x3e, 0x57, 0x5e, 0xdd, 0x70, 0xb7, 0x37, 0xbe, + 0xcd, 0x43, 0xc7, 0x85, 0xfb, 0xfa, 0x79, 0xc2, 0x04, 0x4d, 0x58, 0xd3, 0x36, 0x94, 0xbf, 0xbd, + 0x9d, 0x73, 0x68, 0x53, 0xdd, 0xdc, 0x6b, 0x81, 0xce, 0xe1, 0x85, 0x8b, 0x4b, 0x3f, 0xae, 0xfc, + 0x78, 0x50, 0x05, 0xf6, 0x6a, 0xf3, 0x2f, 0x0f, 0xf8, 0x36, 0xd5, 0xd7, 0xb5, 0x9f, 0x77, 0x0f, + 0xb4, 0xdf, 0x00, 0x6c, 0x18, 0xc5, 0xbd, 0x50, 0xbb, 0x8f, 0x79, 0x01, 0xf0, 0xc4, 0x28, 0xfa, + 0x33, 0x16, 0x64, 0x7a, 0x87, 0x25, 0x3d, 0x7f, 0xb1, 0x46, 0x60, 0xb9, 0x46, 0xe0, 0x7b, 0x8d, + 0xc0, 0x3c, 0x47, 0xd6, 0x32, 0x47, 0xd6, 0x47, 0x8e, 0xac, 0x87, 0xab, 0x88, 0xeb, 0x51, 0x36, + 0xc4, 0x81, 0x4c, 0x08, 0x8d, 0x63, 0x99, 0xd2, 0x33, 0xc1, 0xf4, 0x93, 0x4c, 0xc7, 0xd5, 0x19, + 0x8c, 0x28, 0x17, 0x64, 0x46, 0xfe, 0x3e, 0x99, 0xc9, 0x51, 0xc3, 0x7a, 0xe1, 0xbd, 0xfc, 0x0d, + 0x00, 0x00, 0xff, 0xff, 0xd4, 0xa5, 0x9c, 0x9e, 0x7e, 0x02, 0x00, 0x00, +} + +func (this *TaskScheduledEvent) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TaskScheduledEvent) + if !ok { + that2, ok := that.(TaskScheduledEvent) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Id.Equal(that1.Id) { + return false + } + if this.Typename != that1.Typename { + return false + } + if that1.At == nil { + if this.At != nil { + return false + } + } else if !this.At.Equal(*that1.At) { + return false + } + return true +} +func (this *TaskUnscheduledEvent) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TaskUnscheduledEvent) + if !ok { + that2, ok := that.(TaskUnscheduledEvent) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Id.Equal(that1.Id) { + return false + } + if this.Typename != that1.Typename { + return false + } + if that1.At == nil { + if this.At != nil { + return false + } + } else if !this.At.Equal(*that1.At) { + return false + } + return true +} +func (this *TaskExecutedEvent) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TaskExecutedEvent) + if !ok { + that2, ok := that.(TaskExecutedEvent) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Id.Equal(that1.Id) { + return false + } + if this.Typename != that1.Typename { + return false + } + if that1.At == nil { + if this.At != nil { + return false + } + } else if !this.At.Equal(*that1.At) { + return false + } + return true +} +func (m *TaskScheduledEvent) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TaskScheduledEvent) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TaskScheduledEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.At != nil { + n1, err1 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.At, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.At):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintEvents(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x1a + } + if len(m.Typename) > 0 { + i -= len(m.Typename) + copy(dAtA[i:], m.Typename) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Typename))) + i-- + dAtA[i] = 0x12 + } + { + size := m.Id.Size() + i -= size + if _, err := m.Id.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *TaskUnscheduledEvent) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TaskUnscheduledEvent) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TaskUnscheduledEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.At != nil { + n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.At, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.At):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintEvents(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x1a + } + if len(m.Typename) > 0 { + i -= len(m.Typename) + copy(dAtA[i:], m.Typename) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Typename))) + i-- + dAtA[i] = 0x12 + } + { + size := m.Id.Size() + i -= size + if _, err := m.Id.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *TaskExecutedEvent) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TaskExecutedEvent) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TaskExecutedEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.At != nil { + n3, err3 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.At, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.At):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintEvents(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x1a + } + if len(m.Typename) > 0 { + i -= len(m.Typename) + copy(dAtA[i:], m.Typename) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Typename))) + i-- + dAtA[i] = 0x12 + } + { + size := m.Id.Size() + i -= size + if _, err := m.Id.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { + offset -= sovEvents(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *TaskScheduledEvent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Id.Size() + n += 1 + l + sovEvents(uint64(l)) + l = len(m.Typename) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.At != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.At) + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func (m *TaskUnscheduledEvent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Id.Size() + n += 1 + l + sovEvents(uint64(l)) + l = len(m.Typename) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.At != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.At) + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func (m *TaskExecutedEvent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Id.Size() + n += 1 + l + sovEvents(uint64(l)) + l = len(m.Typename) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.At != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.At) + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func sovEvents(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvents(x uint64) (n int) { + return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *TaskScheduledEvent) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TaskScheduledEvent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TaskScheduledEvent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Id.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Typename", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Typename = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field At", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.At == nil { + m.At = new(time.Time) + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.At, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TaskUnscheduledEvent) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TaskUnscheduledEvent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TaskUnscheduledEvent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Id.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Typename", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Typename = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field At", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.At == nil { + m.At = new(time.Time) + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.At, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TaskExecutedEvent) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TaskExecutedEvent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TaskExecutedEvent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Id.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Typename", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Typename = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field At", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.At == nil { + m.At = new(time.Time) + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.At, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvents(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEvents + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvents + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvents + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group") +) From dd849c43ee0385870b060319b8e9c83d94af6566 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Tue, 7 Oct 2025 10:57:26 +0200 Subject: [PATCH 2/7] feat(x/scheduler): add events emissions --- x/scheduler/keeper/abci.go | 14 ++++++--- x/scheduler/keeper/abci_test.go | 2 +- x/scheduler/keeper/keeper.go | 53 +++++++++++++++++++++++++++------ 3 files changed, 55 insertions(+), 14 deletions(-) diff --git a/x/scheduler/keeper/abci.go b/x/scheduler/keeper/abci.go index aa3ca5552..df6c34bf2 100644 --- a/x/scheduler/keeper/abci.go +++ b/x/scheduler/keeper/abci.go @@ -78,6 +78,14 @@ func (k *Keeper) executeTask(ctx context.Context, task types.Task, handler types return errors.Wrapf(types.ErrTaskExecution, "run func failed for task '%s' of type '%s': %s", task.Id, handler.Typename(), err) } + if err := sdkCtx.EventManager().EmitTypedEvent(&types.TaskExecutedEvent{ + Id: task.Id, + Typename: task.Typename, + At: task.ScheduledFor, + }); err != nil { + return err + } + oldScheduleKey := getTaskScheduleKey(task) if oldScheduleKey == nil { // should never occur @@ -95,10 +103,8 @@ func (k *Keeper) executeTask(ctx context.Context, task types.Task, handler types return errors.Wrapf(types.ErrTaskExecution, "couldn't reschedule periodic task '%s' of type '%s': %s", task.Id, handler.Typename(), err) } - if key := getTaskScheduleKey(task); key != nil { - if err := k.tasksSchedule.Set(ctx, *key); err != nil { - return errors.Wrapf(types.ErrTaskExecution, "couldn't reschedule periodic task '%s' of type '%s': %s", task.Id, handler.Typename(), err) - } + if err := k.programTask(ctx, task); err != nil { + return errors.Wrapf(types.ErrTaskExecution, "couldn't reschedule periodic task '%s' of type '%s': %s", task.Id, handler.Typename(), err) } } else { if err := k.tasks.Remove(ctx, task.Id); err != nil { diff --git a/x/scheduler/keeper/abci_test.go b/x/scheduler/keeper/abci_test.go index 9b7e39495..abdf59fb1 100644 --- a/x/scheduler/keeper/abci_test.go +++ b/x/scheduler/keeper/abci_test.go @@ -324,7 +324,7 @@ func TestApplyArbitrageDecision(t *testing.T) { } } -func TestRunTask(t *testing.T) { +func TestExecuteTask(t *testing.T) { now := time.Now().UTC() interval := 10 * time.Minute in10Min := now.Add(interval) diff --git a/x/scheduler/keeper/keeper.go b/x/scheduler/keeper/keeper.go index eec78900b..ae30c25c6 100644 --- a/x/scheduler/keeper/keeper.go +++ b/x/scheduler/keeper/keeper.go @@ -163,7 +163,22 @@ func (k *Keeper) ScheduleTask(ctx context.Context, typename string, id types.Tas return err } - if key := getTaskScheduleKey(*task); key != nil { + return k.programTask(ctx, *task) +} + +// programTask programs the task to its next run schedule, if any. +func (k *Keeper) programTask(ctx context.Context, task types.Task) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + + if key := getTaskScheduleKey(task); key != nil { + if err := sdkCtx.EventManager().EmitTypedEvent(&types.TaskScheduledEvent{ + Id: task.Id, + Typename: task.Typename, + At: task.ScheduledFor, + }); err != nil { + return err + } + return k.tasksSchedule.Set(ctx, *key) } return nil @@ -171,6 +186,7 @@ func (k *Keeper) ScheduleTask(ctx context.Context, typename string, id types.Tas // CancelTask removes a task, removing it from the schedule. func (k *Keeper) CancelTask(ctx context.Context, taskID types.TaskID) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) task, err := k.tasks.Get(ctx, taskID) if err != nil { return err @@ -181,6 +197,14 @@ func (k *Keeper) CancelTask(ctx context.Context, taskID types.TaskID) error { } if key := getTaskScheduleKey(task); key != nil { + if err := sdkCtx.EventManager().EmitTypedEvent(&types.TaskUnscheduledEvent{ + Id: task.Id, + Typename: task.Typename, + At: task.ScheduledFor, + }); err != nil { + return err + } + return k.tasksSchedule.Remove(ctx, *key) } return nil @@ -195,16 +219,13 @@ func (k *Keeper) RescheduleTask(ctx context.Context, id types.TaskID, scheduleOp return nil } + sdkCtx := sdk.UnwrapSDKContext(ctx) task, err := k.tasks.Get(ctx, id) if err != nil { return err } - if key := getTaskScheduleKey(task); key != nil { - if err := k.tasksSchedule.Remove(ctx, *key); err != nil { - return err - } - } + oldScheduleKey := getTaskScheduleKey(task) if err := task.ApplySchedulingOpts(ctx, scheduleOpts...); err != nil { return err @@ -214,10 +235,24 @@ func (k *Keeper) RescheduleTask(ctx context.Context, id types.TaskID, scheduleOp return err } - if key := getTaskScheduleKey(task); key != nil { - return k.tasksSchedule.Set(ctx, *key) + if oldScheduleKey != nil { + if err := k.tasksSchedule.Remove(ctx, *oldScheduleKey); err != nil { + return err + } + + // if the task no longer has a next run time, it has been unscheduled + if task.ScheduledFor == nil { + if err := sdkCtx.EventManager().EmitTypedEvent(&types.TaskUnscheduledEvent{ + Id: task.Id, + Typename: task.Typename, + At: task.ScheduledFor, + }); err != nil { + return err + } + } } - return nil + + return k.programTask(ctx, task) } // GetDueTasksAt retrieves the tasks of the specified type that are due at the provided time. From 59941904687bf7296a75cbf337ef077d31231287 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Tue, 7 Oct 2025 11:36:42 +0200 Subject: [PATCH 3/7] test(x/scheduler): add event emissions tests --- x/scheduler/keeper/abci_test.go | 94 ++++++++++++++---- x/scheduler/keeper/genesis_test.go | 2 + x/scheduler/keeper/keeper.go | 3 +- x/scheduler/keeper/keeper_test.go | 151 ++++++++++++++++++++++------- 4 files changed, 194 insertions(+), 56 deletions(-) diff --git a/x/scheduler/keeper/abci_test.go b/x/scheduler/keeper/abci_test.go index abdf59fb1..5d3ae4b16 100644 --- a/x/scheduler/keeper/abci_test.go +++ b/x/scheduler/keeper/abci_test.go @@ -12,10 +12,12 @@ import ( "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" "github.com/allora-network/allora-chain/x/scheduler/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/testutil" cosmostypes "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/require" ) @@ -219,11 +221,12 @@ func TestApplyArbitrageDecision(t *testing.T) { in10min := now.Add(10 * time.Minute).UTC() testCases := []struct { - name string - taskID types.TaskID - decision types.ArbitrageDecision - expectError bool - expectTask *types.Task + name string + taskID types.TaskID + decision types.ArbitrageDecision + expectError bool + expectEvents []proto.Message + expectTask *types.Task }{ { name: "cancel task", @@ -232,7 +235,14 @@ func TestApplyArbitrageDecision(t *testing.T) { Action: types.ArbitrageActionCancel, }, expectError: false, - expectTask: nil, + expectEvents: []proto.Message{ + &types.TaskUnscheduledEvent{ + Id: "task1", + Typename: "noargs", + At: &in5min, + }, + }, + expectTask: nil, }, { name: "reschedule task", @@ -244,6 +254,13 @@ func TestApplyArbitrageDecision(t *testing.T) { }, }, expectError: false, + expectEvents: []proto.Message{ + &types.TaskScheduledEvent{ + Id: "task1", + Typename: "noargs", + At: &in10min, + }, + }, expectTask: &types.Task{ Id: "task1", Typename: "noargs", @@ -261,7 +278,8 @@ func TestApplyArbitrageDecision(t *testing.T) { decision: types.ArbitrageDecision{ Action: types.ArbitrageActionReschedule, }, - expectError: false, + expectError: false, + expectEvents: nil, expectTask: &types.Task{ Id: "task1", Typename: "noargs", @@ -282,8 +300,9 @@ func TestApplyArbitrageDecision(t *testing.T) { types.ScheduleAt(now.Add(-10 * time.Minute)), }, }, - expectError: true, - expectTask: nil, + expectEvents: nil, + expectError: true, + expectTask: nil, }, } @@ -308,6 +327,8 @@ func TestApplyArbitrageDecision(t *testing.T) { require.NoError(t, k.ScheduleTask(ctx, "noargs", "task1", nil, types.ScheduleAt(in5min))) + ctx = ctx.WithEventManager(cosmostypes.NewEventManager()) + err = k.applyArbitrageDecision(ctx, tc.taskID, tc.decision) if tc.expectError { require.Error(t, err) @@ -320,6 +341,9 @@ func TestApplyArbitrageDecision(t *testing.T) { require.Equal(t, tc.expectTask, &task) } } + + evts := parseEvents(t, ctx.EventManager().Events().ToABCIEvents()) + require.Equal(t, tc.expectEvents, evts) }) } } @@ -334,22 +358,42 @@ func TestExecuteTask(t *testing.T) { taskID types.TaskID runFail bool expectError bool + expectEvents []proto.Message expectTaskRemoval bool expectNewScheduleAt *time.Time }{ { - name: "successful run non-periodic task", - taskID: "task1", - runFail: false, - expectError: false, + name: "successful run non-periodic task", + taskID: "task1", + runFail: false, + expectError: false, + expectEvents: []proto.Message{ + &types.TaskExecutedEvent{ + Id: "task1", + Typename: "withargs", + At: &now, + }, + }, expectTaskRemoval: true, expectNewScheduleAt: nil, }, { - name: "successful run periodic task", - taskID: "task2", - runFail: false, - expectError: false, + name: "successful run periodic task", + taskID: "task2", + runFail: false, + expectError: false, + expectEvents: []proto.Message{ + &types.TaskExecutedEvent{ + Id: "task2", + Typename: "withargs", + At: &now, + }, + &types.TaskScheduledEvent{ + Id: "task2", + Typename: "withargs", + At: &in10Min, + }, + }, expectTaskRemoval: false, expectNewScheduleAt: &in10Min, }, @@ -358,6 +402,7 @@ func TestExecuteTask(t *testing.T) { taskID: "task1", runFail: true, expectError: true, + expectEvents: nil, expectTaskRemoval: false, expectNewScheduleAt: nil, }, @@ -399,7 +444,7 @@ func TestExecuteTask(t *testing.T) { require.NoError(t, k.ScheduleTask(ctx, "withargs", "task1", args, types.ScheduleAt(now))) require.NoError(t, k.ScheduleTask(ctx, "withargs", "task2", args, types.ScheduleAt(now), types.ScheduleEvery(&interval))) - ctx = ctx.WithBlockTime(now) + ctx = ctx.WithBlockTime(now).WithEventManager(cosmostypes.NewEventManager()) task, err := k.tasks.Get(ctx, tc.taskID) require.NoError(t, err) err = k.executeTask(ctx, task, handler) @@ -424,6 +469,19 @@ func TestExecuteTask(t *testing.T) { } } } + + evts := parseEvents(t, ctx.EventManager().Events().ToABCIEvents()) + require.Equal(t, tc.expectEvents, evts) }) } } + +func parseEvents(t *testing.T, events []abci.Event) []proto.Message { + var parsed []proto.Message + for _, e := range events { + evt, err := cosmostypes.ParseTypedEvent(e) + require.NoError(t, err) + parsed = append(parsed, evt) + } + return parsed +} diff --git a/x/scheduler/keeper/genesis_test.go b/x/scheduler/keeper/genesis_test.go index e0cff294d..b0c1f5851 100644 --- a/x/scheduler/keeper/genesis_test.go +++ b/x/scheduler/keeper/genesis_test.go @@ -82,6 +82,8 @@ func TestExportImportGenesis(t *testing.T) { require.NoError(t, err) require.Len(t, keys2, 2) + require.Len(t, ctx.EventManager().Events(), 0, "init genesis should not emit events") + genesis2 := k2.ExportGenesis(ctx) require.Equal(t, genesis, genesis2) } diff --git a/x/scheduler/keeper/keeper.go b/x/scheduler/keeper/keeper.go index ae30c25c6..90c07fb76 100644 --- a/x/scheduler/keeper/keeper.go +++ b/x/scheduler/keeper/keeper.go @@ -242,10 +242,11 @@ func (k *Keeper) RescheduleTask(ctx context.Context, id types.TaskID, scheduleOp // if the task no longer has a next run time, it has been unscheduled if task.ScheduledFor == nil { + prevSchedule := oldScheduleKey.K2() if err := sdkCtx.EventManager().EmitTypedEvent(&types.TaskUnscheduledEvent{ Id: task.Id, Typename: task.Typename, - At: task.ScheduledFor, + At: &prevSchedule, }); err != nil { return err } diff --git a/x/scheduler/keeper/keeper_test.go b/x/scheduler/keeper/keeper_test.go index 603af2ecf..84372ecef 100644 --- a/x/scheduler/keeper/keeper_test.go +++ b/x/scheduler/keeper/keeper_test.go @@ -140,6 +140,7 @@ func TestScheduleTask(t *testing.T) { args proto.Message scheduleOpts []types.SchedulingOption expectError bool + expectEvents []proto.Message expectTask *types.Task }{ { @@ -151,6 +152,13 @@ func TestScheduleTask(t *testing.T) { types.ScheduleAt(at), }, expectError: false, + expectEvents: []proto.Message{ + &types.TaskScheduledEvent{ + Id: "task1", + Typename: "noargs", + At: &at, + }, + }, expectTask: &types.Task{ Id: "task1", Typename: "noargs", @@ -171,6 +179,13 @@ func TestScheduleTask(t *testing.T) { types.ScheduleAt(at), }, expectError: false, + expectEvents: []proto.Message{ + &types.TaskScheduledEvent{ + Id: "task2", + Typename: "withargs", + At: &at, + }, + }, expectTask: &types.Task{ Id: "task2", Typename: "withargs", @@ -193,6 +208,13 @@ func TestScheduleTask(t *testing.T) { types.WithAbsoluteScheduling(), }, expectError: false, + expectEvents: []proto.Message{ + &types.TaskScheduledEvent{ + Id: "task", + Typename: "withargs", + At: &at, + }, + }, expectTask: &types.Task{ Id: "task", Typename: "withargs", @@ -212,8 +234,9 @@ func TestScheduleTask(t *testing.T) { scheduleOpts: []types.SchedulingOption{ types.ScheduleAt(at), }, - expectError: true, - expectTask: nil, + expectError: true, + expectEvents: nil, + expectTask: nil, }, { name: "wrong args type (nil)", @@ -223,8 +246,9 @@ func TestScheduleTask(t *testing.T) { scheduleOpts: []types.SchedulingOption{ types.ScheduleAt(at), }, - expectError: true, - expectTask: nil, + expectError: true, + expectEvents: nil, + expectTask: nil, }, { name: "wrong args type (non-nil)", @@ -234,8 +258,9 @@ func TestScheduleTask(t *testing.T) { scheduleOpts: []types.SchedulingOption{ types.ScheduleAt(at), }, - expectError: true, - expectTask: nil, + expectError: true, + expectEvents: nil, + expectTask: nil, }, { name: "duplicate task id", @@ -245,8 +270,9 @@ func TestScheduleTask(t *testing.T) { scheduleOpts: []types.SchedulingOption{ types.ScheduleAt(at), }, - expectError: true, - expectTask: nil, + expectError: true, + expectEvents: nil, + expectTask: nil, }, { name: "invalid scheduling", @@ -256,8 +282,9 @@ func TestScheduleTask(t *testing.T) { scheduleOpts: []types.SchedulingOption{ types.ScheduleAt(now.Add(-time.Hour)), }, - expectError: true, - expectTask: nil, + expectError: true, + expectEvents: nil, + expectTask: nil, }, } @@ -285,6 +312,8 @@ func TestScheduleTask(t *testing.T) { err = k.ScheduleTask(ctx, "noargs", "existing", nil, types.ScheduleAt(at)) require.NoError(t, err) + ctx = ctx.WithEventManager(cosmostypes.NewEventManager()) + err = k.ScheduleTask(ctx, tc.typename, tc.id, tc.args, tc.scheduleOpts...) if tc.expectError { require.Error(t, err) @@ -309,6 +338,9 @@ func TestScheduleTask(t *testing.T) { require.Equal(t, packedArgs.Value, task.Args.Value) } + evts := parseEvents(t, ctx.EventManager().Events().ToABCIEvents()) + require.Equal(t, tc.expectEvents, evts) + exists, err := k.tasksSchedule.Has(ctx, collections.Join3(tc.expectTask.Typename, *tc.expectTask.ScheduledFor, tc.expectTask.Id)) require.NoError(t, err) require.True(t, exists) @@ -317,17 +349,29 @@ func TestScheduleTask(t *testing.T) { } func TestCancelTask(t *testing.T) { + now := time.Now().UTC() + at := now.Add(10 * time.Minute) + d1Hour := 1 * time.Hour + testCases := []struct { name string id types.TaskID expectError bool + expectEvents []proto.Message expectTaskCount int expectTaskScheduleCount int }{ { - name: "scheduled task", - id: "task1", - expectError: false, + name: "scheduled task", + id: "task1", + expectError: false, + expectEvents: []proto.Message{ + &types.TaskUnscheduledEvent{ + Id: "task1", + Typename: "noargs", + At: &at, + }, + }, expectTaskCount: 2, expectTaskScheduleCount: 1, }, @@ -335,6 +379,7 @@ func TestCancelTask(t *testing.T) { name: "unscheduled task", id: "task2", expectError: false, + expectEvents: nil, expectTaskCount: 2, expectTaskScheduleCount: 2, }, @@ -342,15 +387,12 @@ func TestCancelTask(t *testing.T) { name: "unexisting task", id: "taskX", expectError: true, + expectEvents: nil, expectTaskCount: 3, expectTaskScheduleCount: 2, }, } - now := time.Now() - at := now.Add(10 * time.Minute) - d1Hour := 1 * time.Hour - for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { storeKey := storetypes.NewKVStoreKey("scheduler") @@ -375,7 +417,9 @@ func TestCancelTask(t *testing.T) { require.NoError(t, k.ScheduleTask(ctx, "noargs", "task2", nil, types.ScheduleAt(at), types.ScheduleEvery(&d1Hour))) require.NoError(t, k.ScheduleTask(ctx, "noargs", "task3", nil, types.ScheduleAt(at))) // pause the task2 to test canceling a paused task - require.NoError(t, k.tasksSchedule.Remove(ctx, collections.Join3[string, time.Time, types.TaskID]("noargs", at, "task2"))) + require.NoError(t, k.RescheduleTask(ctx, "task2", types.Unschedule())) + + ctx = ctx.WithEventManager(cosmostypes.NewEventManager()) err = k.CancelTask(ctx, tc.id) if tc.expectError { @@ -387,6 +431,9 @@ func TestCancelTask(t *testing.T) { require.False(t, exists) } + evts := parseEvents(t, ctx.EventManager().Events().ToABCIEvents()) + require.Equal(t, tc.expectEvents, evts) + it, err := k.tasks.IterateRaw(ctx, nil, nil, collections.OrderAscending) require.NoError(t, err) keys, err := it.Keys() @@ -403,22 +450,31 @@ func TestCancelTask(t *testing.T) { } func TestRescheduleTask(t *testing.T) { - now := time.Now() + now := time.Now().UTC() d1Hour := 1 * time.Hour - at := now.Add(d1Hour).UTC() + in10Min := now.Add(10 * time.Minute) + at := now.Add(d1Hour) testCases := []struct { - name string - id types.TaskID - newSchedule []types.SchedulingOption - expectError bool - expectTask *types.Task + name string + id types.TaskID + newSchedule []types.SchedulingOption + expectError bool + expectEvents []proto.Message + expectTask *types.Task }{ { name: "existing task", id: "task1", newSchedule: []types.SchedulingOption{types.ScheduleAt(at)}, expectError: false, + expectEvents: []proto.Message{ + &types.TaskScheduledEvent{ + Id: "task1", + Typename: "noargs", + At: &at, + }, + }, expectTask: &types.Task{ Id: "task1", Typename: "noargs", @@ -435,6 +491,13 @@ func TestRescheduleTask(t *testing.T) { id: "task2", newSchedule: []types.SchedulingOption{types.ScheduleAt(at)}, expectError: false, + expectEvents: []proto.Message{ + &types.TaskScheduledEvent{ + Id: "task2", + Typename: "noargs", + At: &at, + }, + }, expectTask: &types.Task{ Id: "task2", Typename: "noargs", @@ -451,6 +514,13 @@ func TestRescheduleTask(t *testing.T) { id: "task1", newSchedule: []types.SchedulingOption{types.Unschedule()}, expectError: false, + expectEvents: []proto.Message{ + &types.TaskUnscheduledEvent{ + Id: "task1", + Typename: "noargs", + At: &in10Min, + }, + }, expectTask: &types.Task{ Id: "task1", Typename: "noargs", @@ -463,18 +533,20 @@ func TestRescheduleTask(t *testing.T) { }, }, { - name: "unexisting task", - id: "taskX", - newSchedule: []types.SchedulingOption{types.ScheduleAt(at)}, - expectError: true, - expectTask: nil, + name: "unexisting task", + id: "taskX", + newSchedule: []types.SchedulingOption{types.ScheduleAt(at)}, + expectError: true, + expectEvents: nil, + expectTask: nil, }, { - name: "new time in the past", - id: "task1", - newSchedule: []types.SchedulingOption{types.ScheduleAt(now.Add(-d1Hour))}, - expectError: true, - expectTask: nil, + name: "new time in the past", + id: "task1", + newSchedule: []types.SchedulingOption{types.ScheduleAt(now.Add(-d1Hour))}, + expectError: true, + expectEvents: nil, + expectTask: nil, }, } @@ -498,11 +570,13 @@ func TestRescheduleTask(t *testing.T) { WithBlockTime(now) // pre-insert tasks - require.NoError(t, k.ScheduleTask(ctx, "noargs", "task1", nil, types.ScheduleAt(now.Add(10*time.Minute)))) - require.NoError(t, k.ScheduleTask(ctx, "noargs", "task2", nil, types.ScheduleAt(now.Add(10*time.Minute)), types.ScheduleEvery(&d1Hour))) + require.NoError(t, k.ScheduleTask(ctx, "noargs", "task1", nil, types.ScheduleAt(in10Min))) + require.NoError(t, k.ScheduleTask(ctx, "noargs", "task2", nil, types.ScheduleAt(in10Min), types.ScheduleEvery(&d1Hour))) // pause the task2 to test rescheduling a paused task require.NoError(t, k.tasksSchedule.Remove(ctx, collections.Join3[string, time.Time, types.TaskID]("noargs", at, "task2"))) + ctx = ctx.WithEventManager(cosmostypes.NewEventManager()) + err = k.RescheduleTask(ctx, tc.id, tc.newSchedule...) if tc.expectError { require.Error(t, err) @@ -518,6 +592,9 @@ func TestRescheduleTask(t *testing.T) { require.True(t, exists) } } + + evts := parseEvents(t, ctx.EventManager().Events().ToABCIEvents()) + require.Equal(t, tc.expectEvents, evts) }) } } From bec614b420f0db3f57b393229d334cc65f033e41 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Tue, 21 Oct 2025 14:30:57 +0200 Subject: [PATCH 4/7] style(x/scheduler): be nice to linters --- x/scheduler/keeper/abci_test.go | 2 ++ x/scheduler/keeper/genesis_test.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/x/scheduler/keeper/abci_test.go b/x/scheduler/keeper/abci_test.go index 5d3ae4b16..8ec088b74 100644 --- a/x/scheduler/keeper/abci_test.go +++ b/x/scheduler/keeper/abci_test.go @@ -477,6 +477,8 @@ func TestExecuteTask(t *testing.T) { } func parseEvents(t *testing.T, events []abci.Event) []proto.Message { + t.Helper() + var parsed []proto.Message for _, e := range events { evt, err := cosmostypes.ParseTypedEvent(e) diff --git a/x/scheduler/keeper/genesis_test.go b/x/scheduler/keeper/genesis_test.go index b0c1f5851..f0f2d3af3 100644 --- a/x/scheduler/keeper/genesis_test.go +++ b/x/scheduler/keeper/genesis_test.go @@ -82,7 +82,7 @@ func TestExportImportGenesis(t *testing.T) { require.NoError(t, err) require.Len(t, keys2, 2) - require.Len(t, ctx.EventManager().Events(), 0, "init genesis should not emit events") + require.Empty(t, ctx.EventManager().Events(), "init genesis should not emit events") genesis2 := k2.ExportGenesis(ctx) require.Equal(t, genesis, genesis2) From c4873657f1bfb3a3c73dee686b629097a42c4181 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Tue, 21 Oct 2025 14:31:21 +0200 Subject: [PATCH 5/7] docs: update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index df91c4655..a9fd3fad5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [#851](https://github.com/allora-network/allora-chain/pull/851) Enforce recommended settings * [#835](https://github.com/allora-network/allora-chain/pull/835): Introduce the `x/scheduler` module to manage tasks scheduling +* [#870](https://github.com/allora-network/allora-chain/pull/870): Add events related to the `x/scheduler` module ### Changed From fc49feec50263ad5e32f5eaedd9d1a1ee664642e Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Tue, 21 Oct 2025 14:36:07 +0200 Subject: [PATCH 6/7] docs(x/scheduler): update evts docs --- x/scheduler/api/scheduler/v1/events.pulsar.go | 2 +- x/scheduler/proto/scheduler/v1/events.proto | 2 +- x/scheduler/types/events.pb.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x/scheduler/api/scheduler/v1/events.pulsar.go b/x/scheduler/api/scheduler/v1/events.pulsar.go index daef0628c..59fb928d4 100644 --- a/x/scheduler/api/scheduler/v1/events.pulsar.go +++ b/x/scheduler/api/scheduler/v1/events.pulsar.go @@ -1718,7 +1718,7 @@ const ( ) // TaskScheduledEvent is emitted when a task is scheduled or rescheduled at a specific time. -// If a task is created with no scheduling (i.e. next_run_at is empty), this event is not emitted until the task is scheduled. +// If a task is created with no scheduling (i.e. scheduled_for is empty), this event is not emitted until the task is scheduled. // If an arbitrage decision is made to reschedule a task, this event is emitted. // For a periodic task, this event is emitted at each execution. type TaskScheduledEvent struct { diff --git a/x/scheduler/proto/scheduler/v1/events.proto b/x/scheduler/proto/scheduler/v1/events.proto index a9c08e097..a87cbe694 100644 --- a/x/scheduler/proto/scheduler/v1/events.proto +++ b/x/scheduler/proto/scheduler/v1/events.proto @@ -8,7 +8,7 @@ import "google/protobuf/duration.proto"; option go_package = "github.com/allora-network/allora-chain/x/scheduler/types"; // TaskScheduledEvent is emitted when a task is scheduled or rescheduled at a specific time. -// If a task is created with no scheduling (i.e. next_run_at is empty), this event is not emitted until the task is scheduled. +// If a task is created with no scheduling (i.e. scheduled_for is empty), this event is not emitted until the task is scheduled. // If an arbitrage decision is made to reschedule a task, this event is emitted. // For a periodic task, this event is emitted at each execution. message TaskScheduledEvent { diff --git a/x/scheduler/types/events.pb.go b/x/scheduler/types/events.pb.go index 23643fb29..50e2958f7 100644 --- a/x/scheduler/types/events.pb.go +++ b/x/scheduler/types/events.pb.go @@ -29,7 +29,7 @@ var _ = time.Kitchen const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // TaskScheduledEvent is emitted when a task is scheduled or rescheduled at a specific time. -// If a task is created with no scheduling (i.e. next_run_at is empty), this event is not emitted until the task is scheduled. +// If a task is created with no scheduling (i.e. scheduled_for is empty), this event is not emitted until the task is scheduled. // If an arbitrage decision is made to reschedule a task, this event is emitted. // For a periodic task, this event is emitted at each execution. type TaskScheduledEvent struct { From 64e85e72d57090dffdfb59070074d4c71e020428 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Tue, 21 Oct 2025 17:41:01 +0200 Subject: [PATCH 7/7] refactor(x/scheduler): emit events after state change --- x/scheduler/keeper/keeper.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/x/scheduler/keeper/keeper.go b/x/scheduler/keeper/keeper.go index 90c07fb76..cf3179b8d 100644 --- a/x/scheduler/keeper/keeper.go +++ b/x/scheduler/keeper/keeper.go @@ -171,15 +171,15 @@ func (k *Keeper) programTask(ctx context.Context, task types.Task) error { sdkCtx := sdk.UnwrapSDKContext(ctx) if key := getTaskScheduleKey(task); key != nil { - if err := sdkCtx.EventManager().EmitTypedEvent(&types.TaskScheduledEvent{ - Id: task.Id, - Typename: task.Typename, - At: task.ScheduledFor, - }); err != nil { + if err := k.tasksSchedule.Set(ctx, *key); err != nil { return err } - return k.tasksSchedule.Set(ctx, *key) + return sdkCtx.EventManager().EmitTypedEvent(&types.TaskScheduledEvent{ + Id: task.Id, + Typename: task.Typename, + At: task.ScheduledFor, + }) } return nil } @@ -197,15 +197,15 @@ func (k *Keeper) CancelTask(ctx context.Context, taskID types.TaskID) error { } if key := getTaskScheduleKey(task); key != nil { - if err := sdkCtx.EventManager().EmitTypedEvent(&types.TaskUnscheduledEvent{ - Id: task.Id, - Typename: task.Typename, - At: task.ScheduledFor, - }); err != nil { + if err := k.tasksSchedule.Remove(ctx, *key); err != nil { return err } - return k.tasksSchedule.Remove(ctx, *key) + return sdkCtx.EventManager().EmitTypedEvent(&types.TaskUnscheduledEvent{ + Id: task.Id, + Typename: task.Typename, + At: task.ScheduledFor, + }) } return nil }