From 7df8ef932b6371091516787fb7fe507c7f3112cb Mon Sep 17 00:00:00 2001 From: garethgeorge Date: Tue, 3 Sep 2024 19:13:21 -0700 Subject: [PATCH 1/2] rework relative scheduling to use an enum --- gen/go/v1/config.pb.go | 455 +++++++++--------- .../migrations/003relativescheduling.go | 23 +- .../migrations/003relativescheduling_test.go | 94 +--- internal/orchestrator/orchestrator.go | 2 +- .../orchestrator/tasks/scheduling_test.go | 27 +- internal/protoutil/schedule.go | 45 +- proto/v1/config.proto | 11 +- webui/gen/ts/v1/config_pb.ts | 61 +-- webui/src/components/ScheduleFormItem.tsx | 104 +--- 9 files changed, 321 insertions(+), 501 deletions(-) diff --git a/gen/go/v1/config.pb.go b/gen/go/v1/config.pb.go index 41bda45e1..9c3568134 100644 --- a/gen/go/v1/config.pb.go +++ b/gen/go/v1/config.pb.go @@ -122,6 +122,55 @@ func (CommandPrefix_CPUNiceLevel) EnumDescriptor() ([]byte, []int) { return file_v1_config_proto_rawDescGZIP(), []int{4, 1} } +type Schedule_Clock int32 + +const ( + Schedule_CLOCK_LOCAL Schedule_Clock = 0 + Schedule_CLOCK_UTC Schedule_Clock = 1 + Schedule_CLOCK_LAST_RUN_TIME Schedule_Clock = 2 +) + +// Enum value maps for Schedule_Clock. +var ( + Schedule_Clock_name = map[int32]string{ + 0: "CLOCK_LOCAL", + 1: "CLOCK_UTC", + 2: "CLOCK_LAST_RUN_TIME", + } + Schedule_Clock_value = map[string]int32{ + "CLOCK_LOCAL": 0, + "CLOCK_UTC": 1, + "CLOCK_LAST_RUN_TIME": 2, + } +) + +func (x Schedule_Clock) Enum() *Schedule_Clock { + p := new(Schedule_Clock) + *p = x + return p +} + +func (x Schedule_Clock) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Schedule_Clock) Descriptor() protoreflect.EnumDescriptor { + return file_v1_config_proto_enumTypes[2].Descriptor() +} + +func (Schedule_Clock) Type() protoreflect.EnumType { + return &file_v1_config_proto_enumTypes[2] +} + +func (x Schedule_Clock) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Schedule_Clock.Descriptor instead. +func (Schedule_Clock) EnumDescriptor() ([]byte, []int) { + return file_v1_config_proto_rawDescGZIP(), []int{8, 0} +} + type Hook_Condition int32 const ( @@ -187,11 +236,11 @@ func (x Hook_Condition) String() string { } func (Hook_Condition) Descriptor() protoreflect.EnumDescriptor { - return file_v1_config_proto_enumTypes[2].Descriptor() + return file_v1_config_proto_enumTypes[3].Descriptor() } func (Hook_Condition) Type() protoreflect.EnumType { - return &file_v1_config_proto_enumTypes[2] + return &file_v1_config_proto_enumTypes[3] } func (x Hook_Condition) Number() protoreflect.EnumNumber { @@ -245,11 +294,11 @@ func (x Hook_OnError) String() string { } func (Hook_OnError) Descriptor() protoreflect.EnumDescriptor { - return file_v1_config_proto_enumTypes[3].Descriptor() + return file_v1_config_proto_enumTypes[4].Descriptor() } func (Hook_OnError) Type() protoreflect.EnumType { - return &file_v1_config_proto_enumTypes[3] + return &file_v1_config_proto_enumTypes[4] } func (x Hook_OnError) Number() protoreflect.EnumNumber { @@ -294,11 +343,11 @@ func (x Hook_Webhook_Method) String() string { } func (Hook_Webhook_Method) Descriptor() protoreflect.EnumDescriptor { - return file_v1_config_proto_enumTypes[4].Descriptor() + return file_v1_config_proto_enumTypes[5].Descriptor() } func (Hook_Webhook_Method) Type() protoreflect.EnumType { - return &file_v1_config_proto_enumTypes[4] + return &file_v1_config_proto_enumTypes[5] } func (x Hook_Webhook_Method) Number() protoreflect.EnumNumber { @@ -1101,10 +1150,8 @@ type Schedule struct { // *Schedule_Cron // *Schedule_MaxFrequencyDays // *Schedule_MaxFrequencyHours - // *Schedule_CronSinceLastRun - // *Schedule_MinHoursSinceLastRun - // *Schedule_MinDaysSinceLastRun Schedule isSchedule_Schedule `protobuf_oneof:"schedule"` + Clock Schedule_Clock `protobuf:"varint,5,opt,name=clock,proto3,enum=v1.Schedule_Clock" json:"clock,omitempty"` // clock to use for scheduling. } func (x *Schedule) Reset() { @@ -1174,25 +1221,11 @@ func (x *Schedule) GetMaxFrequencyHours() int32 { return 0 } -func (x *Schedule) GetCronSinceLastRun() string { - if x, ok := x.GetSchedule().(*Schedule_CronSinceLastRun); ok { - return x.CronSinceLastRun - } - return "" -} - -func (x *Schedule) GetMinHoursSinceLastRun() int32 { - if x, ok := x.GetSchedule().(*Schedule_MinHoursSinceLastRun); ok { - return x.MinHoursSinceLastRun - } - return 0 -} - -func (x *Schedule) GetMinDaysSinceLastRun() int32 { - if x, ok := x.GetSchedule().(*Schedule_MinDaysSinceLastRun); ok { - return x.MinDaysSinceLastRun +func (x *Schedule) GetClock() Schedule_Clock { + if x != nil { + return x.Clock } - return 0 + return Schedule_CLOCK_LOCAL } type isSchedule_Schedule interface { @@ -1215,18 +1248,6 @@ type Schedule_MaxFrequencyHours struct { MaxFrequencyHours int32 `protobuf:"varint,4,opt,name=maxFrequencyHours,proto3,oneof"` // max frequency of runs in hours. } -type Schedule_CronSinceLastRun struct { - CronSinceLastRun string `protobuf:"bytes,100,opt,name=cronSinceLastRun,proto3,oneof"` // cron expression to run since the last run. -} - -type Schedule_MinHoursSinceLastRun struct { - MinHoursSinceLastRun int32 `protobuf:"varint,101,opt,name=minHoursSinceLastRun,proto3,oneof"` // max hours since the last run. -} - -type Schedule_MinDaysSinceLastRun struct { - MinDaysSinceLastRun int32 `protobuf:"varint,102,opt,name=minDaysSinceLastRun,proto3,oneof"` // max days since the last run. -} - func (*Schedule_Disabled) isSchedule_Schedule() {} func (*Schedule_Cron) isSchedule_Schedule() {} @@ -1235,12 +1256,6 @@ func (*Schedule_MaxFrequencyDays) isSchedule_Schedule() {} func (*Schedule_MaxFrequencyHours) isSchedule_Schedule() {} -func (*Schedule_CronSinceLastRun) isSchedule_Schedule() {} - -func (*Schedule_MinHoursSinceLastRun) isSchedule_Schedule() {} - -func (*Schedule_MinDaysSinceLastRun) isSchedule_Schedule() {} - type Hook struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2154,7 +2169,7 @@ var file_v1_config_proto_rawDesc = []byte{ 0x61, 0x74, 0x61, 0x5f, 0x73, 0x75, 0x62, 0x73, 0x65, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x18, 0x65, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x15, 0x72, 0x65, 0x61, 0x64, 0x44, 0x61, 0x74, 0x61, 0x53, 0x75, 0x62, 0x73, 0x65, 0x74, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, - 0x74, 0x42, 0x06, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0xc0, 0x02, 0x0a, 0x08, 0x53, 0x63, + 0x74, 0x42, 0x06, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0x94, 0x02, 0x0a, 0x08, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x04, 0x63, 0x72, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, @@ -2164,128 +2179,125 @@ var file_v1_config_proto_rawDesc = []byte{ 0x65, 0x6e, 0x63, 0x79, 0x44, 0x61, 0x79, 0x73, 0x12, 0x2e, 0x0a, 0x11, 0x6d, 0x61, 0x78, 0x46, 0x72, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x79, 0x48, 0x6f, 0x75, 0x72, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x11, 0x6d, 0x61, 0x78, 0x46, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x6e, 0x63, 0x79, 0x48, 0x6f, 0x75, 0x72, 0x73, 0x12, 0x2c, 0x0a, 0x10, 0x63, 0x72, 0x6f, 0x6e, - 0x53, 0x69, 0x6e, 0x63, 0x65, 0x4c, 0x61, 0x73, 0x74, 0x52, 0x75, 0x6e, 0x18, 0x64, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x10, 0x63, 0x72, 0x6f, 0x6e, 0x53, 0x69, 0x6e, 0x63, 0x65, 0x4c, - 0x61, 0x73, 0x74, 0x52, 0x75, 0x6e, 0x12, 0x34, 0x0a, 0x14, 0x6d, 0x69, 0x6e, 0x48, 0x6f, 0x75, - 0x72, 0x73, 0x53, 0x69, 0x6e, 0x63, 0x65, 0x4c, 0x61, 0x73, 0x74, 0x52, 0x75, 0x6e, 0x18, 0x65, - 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x14, 0x6d, 0x69, 0x6e, 0x48, 0x6f, 0x75, 0x72, 0x73, - 0x53, 0x69, 0x6e, 0x63, 0x65, 0x4c, 0x61, 0x73, 0x74, 0x52, 0x75, 0x6e, 0x12, 0x32, 0x0a, 0x13, - 0x6d, 0x69, 0x6e, 0x44, 0x61, 0x79, 0x73, 0x53, 0x69, 0x6e, 0x63, 0x65, 0x4c, 0x61, 0x73, 0x74, - 0x52, 0x75, 0x6e, 0x18, 0x66, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x13, 0x6d, 0x69, 0x6e, - 0x44, 0x61, 0x79, 0x73, 0x53, 0x69, 0x6e, 0x63, 0x65, 0x4c, 0x61, 0x73, 0x74, 0x52, 0x75, 0x6e, - 0x42, 0x0a, 0x0a, 0x08, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x22, 0x98, 0x0c, 0x0a, - 0x04, 0x48, 0x6f, 0x6f, 0x6b, 0x12, 0x32, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x76, 0x31, 0x2e, 0x48, - 0x6f, 0x6f, 0x6b, 0x2e, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, - 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2b, 0x0a, 0x08, 0x6f, 0x6e, 0x5f, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x76, 0x31, - 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x4f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x07, 0x6f, - 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x39, 0x0a, 0x0e, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, - 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, - 0x48, 0x00, 0x52, 0x0d, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, - 0x64, 0x12, 0x39, 0x0a, 0x0e, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x77, 0x65, 0x62, 0x68, - 0x6f, 0x6f, 0x6b, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x76, 0x31, 0x2e, 0x48, - 0x6f, 0x6f, 0x6b, 0x2e, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x48, 0x00, 0x52, 0x0d, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x12, 0x39, 0x0a, 0x0e, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x66, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x44, - 0x69, 0x73, 0x63, 0x6f, 0x72, 0x64, 0x48, 0x00, 0x52, 0x0d, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x44, 0x69, 0x73, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x36, 0x0a, 0x0d, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x67, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x18, 0x67, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, - 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x47, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x48, - 0x00, 0x52, 0x0c, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x12, - 0x33, 0x0a, 0x0c, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x6c, 0x61, 0x63, 0x6b, 0x18, - 0x68, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, - 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x0b, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, - 0x6c, 0x61, 0x63, 0x6b, 0x12, 0x3c, 0x0a, 0x0f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, - 0x68, 0x6f, 0x75, 0x74, 0x72, 0x72, 0x72, 0x18, 0x69, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, - 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x53, 0x68, 0x6f, 0x75, 0x74, 0x72, 0x72, 0x72, - 0x48, 0x00, 0x52, 0x0e, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x68, 0x6f, 0x75, 0x74, 0x72, - 0x72, 0x72, 0x1a, 0x23, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x18, 0x0a, - 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x1a, 0xa1, 0x01, 0x0a, 0x07, 0x57, 0x65, 0x62, 0x68, - 0x6f, 0x6f, 0x6b, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x5f, 0x75, - 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, - 0x6b, 0x55, 0x72, 0x6c, 0x12, 0x2f, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x57, - 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x06, 0x6d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, - 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, - 0x65, 0x22, 0x28, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x0b, 0x0a, 0x07, 0x55, - 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, - 0x01, 0x12, 0x08, 0x0a, 0x04, 0x50, 0x4f, 0x53, 0x54, 0x10, 0x02, 0x1a, 0x46, 0x0a, 0x07, 0x44, - 0x69, 0x73, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, - 0x6b, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x65, 0x62, - 0x68, 0x6f, 0x6f, 0x6b, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, - 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, - 0x61, 0x74, 0x65, 0x1a, 0x7c, 0x0a, 0x06, 0x47, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x12, 0x19, 0x0a, - 0x08, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x62, 0x61, 0x73, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1a, - 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x69, - 0x74, 0x6c, 0x65, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x65, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0d, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, - 0x65, 0x1a, 0x44, 0x0a, 0x05, 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x65, + 0x6e, 0x63, 0x79, 0x48, 0x6f, 0x75, 0x72, 0x73, 0x12, 0x28, 0x0a, 0x05, 0x63, 0x6c, 0x6f, 0x63, + 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, + 0x65, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x05, 0x63, 0x6c, 0x6f, + 0x63, 0x6b, 0x22, 0x40, 0x0a, 0x05, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x0f, 0x0a, 0x0b, 0x43, + 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, + 0x43, 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x55, 0x54, 0x43, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x43, + 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x4c, 0x41, 0x53, 0x54, 0x5f, 0x52, 0x55, 0x4e, 0x5f, 0x54, 0x49, + 0x4d, 0x45, 0x10, 0x02, 0x42, 0x0a, 0x0a, 0x08, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, + 0x22, 0x98, 0x0c, 0x0a, 0x04, 0x48, 0x6f, 0x6f, 0x6b, 0x12, 0x32, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, + 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x12, 0x2e, + 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2b, 0x0a, + 0x08, 0x6f, 0x6e, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x10, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x4f, 0x6e, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x52, 0x07, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x39, 0x0a, 0x0e, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x64, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x43, 0x6f, 0x6d, + 0x6d, 0x61, 0x6e, 0x64, 0x48, 0x00, 0x52, 0x0d, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, + 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x39, 0x0a, 0x0e, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, + 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x48, + 0x00, 0x52, 0x0d, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, + 0x12, 0x39, 0x0a, 0x0e, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x69, 0x73, 0x63, 0x6f, + 0x72, 0x64, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, + 0x6f, 0x6b, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x72, 0x64, 0x48, 0x00, 0x52, 0x0d, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x36, 0x0a, 0x0d, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x67, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x18, 0x67, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x47, 0x6f, 0x74, + 0x69, 0x66, 0x79, 0x48, 0x00, 0x52, 0x0c, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x6f, 0x74, + 0x69, 0x66, 0x79, 0x12, 0x33, 0x0a, 0x0c, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x6c, + 0x61, 0x63, 0x6b, 0x18, 0x68, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x76, 0x31, 0x2e, 0x48, + 0x6f, 0x6f, 0x6b, 0x2e, 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x0b, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x12, 0x3c, 0x0a, 0x0f, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x73, 0x68, 0x6f, 0x75, 0x74, 0x72, 0x72, 0x72, 0x18, 0x69, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x11, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x53, 0x68, 0x6f, 0x75, + 0x74, 0x72, 0x72, 0x72, 0x48, 0x00, 0x52, 0x0e, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x68, + 0x6f, 0x75, 0x74, 0x72, 0x72, 0x72, 0x1a, 0x23, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, + 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x1a, 0xa1, 0x01, 0x0a, 0x07, + 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x65, 0x62, 0x68, 0x6f, + 0x6f, 0x6b, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x65, + 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x55, 0x72, 0x6c, 0x12, 0x2f, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, + 0x6f, 0x6b, 0x2e, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6d, + 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, + 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, 0x28, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, + 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, + 0x47, 0x45, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x50, 0x4f, 0x53, 0x54, 0x10, 0x02, 0x1a, + 0x46, 0x0a, 0x07, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, - 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x1a, 0x49, 0x0a, 0x08, 0x53, 0x68, 0x6f, 0x75, 0x74, - 0x72, 0x72, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x68, 0x6f, 0x75, 0x74, 0x72, 0x72, 0x72, 0x5f, - 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x68, 0x6f, 0x75, 0x74, - 0x72, 0x72, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, - 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, - 0x74, 0x65, 0x22, 0xfc, 0x02, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x15, 0x0a, 0x11, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, - 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x44, 0x49, - 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x4e, 0x59, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x01, - 0x12, 0x1c, 0x0a, 0x18, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4e, - 0x41, 0x50, 0x53, 0x48, 0x4f, 0x54, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54, 0x10, 0x02, 0x12, 0x1a, - 0x0a, 0x16, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4e, 0x41, 0x50, - 0x53, 0x48, 0x4f, 0x54, 0x5f, 0x45, 0x4e, 0x44, 0x10, 0x03, 0x12, 0x1c, 0x0a, 0x18, 0x43, 0x4f, - 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4e, 0x41, 0x50, 0x53, 0x48, 0x4f, 0x54, - 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, 0x12, 0x1e, 0x0a, 0x1a, 0x43, 0x4f, 0x4e, 0x44, - 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4e, 0x41, 0x50, 0x53, 0x48, 0x4f, 0x54, 0x5f, 0x57, - 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x05, 0x12, 0x1e, 0x0a, 0x1a, 0x43, 0x4f, 0x4e, 0x44, - 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4e, 0x41, 0x50, 0x53, 0x48, 0x4f, 0x54, 0x5f, 0x53, - 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x06, 0x12, 0x19, 0x0a, 0x15, 0x43, 0x4f, 0x4e, 0x44, - 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x55, 0x4e, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x52, - 0x54, 0x10, 0x64, 0x12, 0x19, 0x0a, 0x15, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x50, 0x52, 0x55, 0x4e, 0x45, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x65, 0x12, 0x1b, - 0x0a, 0x17, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x55, 0x4e, - 0x45, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x66, 0x12, 0x1a, 0x0a, 0x15, 0x43, - 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x5f, 0x53, - 0x54, 0x41, 0x52, 0x54, 0x10, 0xc8, 0x01, 0x12, 0x1a, 0x0a, 0x15, 0x43, 0x4f, 0x4e, 0x44, 0x49, - 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, - 0x10, 0xc9, 0x01, 0x12, 0x1c, 0x0a, 0x17, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0xca, - 0x01, 0x22, 0xa9, 0x01, 0x0a, 0x07, 0x4f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x13, 0x0a, - 0x0f, 0x4f, 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, - 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4f, 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x43, - 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4f, 0x4e, 0x5f, 0x45, 0x52, - 0x52, 0x4f, 0x52, 0x5f, 0x46, 0x41, 0x54, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x4f, - 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x52, 0x45, 0x54, 0x52, 0x59, 0x5f, 0x31, 0x4d, - 0x49, 0x4e, 0x55, 0x54, 0x45, 0x10, 0x64, 0x12, 0x1c, 0x0a, 0x18, 0x4f, 0x4e, 0x5f, 0x45, 0x52, - 0x52, 0x4f, 0x52, 0x5f, 0x52, 0x45, 0x54, 0x52, 0x59, 0x5f, 0x31, 0x30, 0x4d, 0x49, 0x4e, 0x55, - 0x54, 0x45, 0x53, 0x10, 0x65, 0x12, 0x26, 0x0a, 0x22, 0x4f, 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, - 0x52, 0x5f, 0x52, 0x45, 0x54, 0x52, 0x59, 0x5f, 0x45, 0x58, 0x50, 0x4f, 0x4e, 0x45, 0x4e, 0x54, - 0x49, 0x41, 0x4c, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x4f, 0x46, 0x46, 0x10, 0x67, 0x42, 0x08, 0x0a, - 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x42, 0x0a, 0x04, 0x41, 0x75, 0x74, 0x68, 0x12, - 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x05, 0x75, - 0x73, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x76, 0x31, 0x2e, - 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x22, 0x51, 0x0a, 0x04, 0x55, - 0x73, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x0f, 0x70, 0x61, 0x73, 0x73, 0x77, - 0x6f, 0x72, 0x64, 0x5f, 0x62, 0x63, 0x72, 0x79, 0x70, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x00, 0x52, 0x0e, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x42, 0x63, 0x72, 0x79, - 0x70, 0x74, 0x42, 0x0a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x42, 0x2c, - 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x72, - 0x65, 0x74, 0x68, 0x67, 0x65, 0x6f, 0x72, 0x67, 0x65, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x72, 0x65, - 0x73, 0x74, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x1a, 0x7c, 0x0a, 0x06, 0x47, 0x6f, 0x74, 0x69, 0x66, + 0x79, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x61, 0x73, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x64, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x25, + 0x0a, 0x0e, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, + 0x18, 0x65, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x54, 0x65, 0x6d, + 0x70, 0x6c, 0x61, 0x74, 0x65, 0x1a, 0x44, 0x0a, 0x05, 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x12, 0x1f, + 0x0a, 0x0b, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x55, 0x72, 0x6c, 0x12, + 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x1a, 0x49, 0x0a, 0x08, 0x53, + 0x68, 0x6f, 0x75, 0x74, 0x72, 0x72, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x68, 0x6f, 0x75, 0x74, + 0x72, 0x72, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, + 0x68, 0x6f, 0x75, 0x74, 0x72, 0x72, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, 0xfc, 0x02, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x64, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x15, 0x0a, 0x11, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, + 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x43, + 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x4e, 0x59, 0x5f, 0x45, 0x52, 0x52, + 0x4f, 0x52, 0x10, 0x01, 0x12, 0x1c, 0x0a, 0x18, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, + 0x4e, 0x5f, 0x53, 0x4e, 0x41, 0x50, 0x53, 0x48, 0x4f, 0x54, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54, + 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x53, 0x4e, 0x41, 0x50, 0x53, 0x48, 0x4f, 0x54, 0x5f, 0x45, 0x4e, 0x44, 0x10, 0x03, 0x12, 0x1c, + 0x0a, 0x18, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4e, 0x41, 0x50, + 0x53, 0x48, 0x4f, 0x54, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, 0x12, 0x1e, 0x0a, 0x1a, + 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4e, 0x41, 0x50, 0x53, 0x48, + 0x4f, 0x54, 0x5f, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x05, 0x12, 0x1e, 0x0a, 0x1a, + 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4e, 0x41, 0x50, 0x53, 0x48, + 0x4f, 0x54, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x06, 0x12, 0x19, 0x0a, 0x15, + 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x55, 0x4e, 0x45, 0x5f, + 0x53, 0x54, 0x41, 0x52, 0x54, 0x10, 0x64, 0x12, 0x19, 0x0a, 0x15, 0x43, 0x4f, 0x4e, 0x44, 0x49, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x55, 0x4e, 0x45, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, + 0x10, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x50, 0x52, 0x55, 0x4e, 0x45, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x66, 0x12, + 0x1a, 0x0a, 0x15, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x48, 0x45, + 0x43, 0x4b, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54, 0x10, 0xc8, 0x01, 0x12, 0x1a, 0x0a, 0x15, 0x43, + 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x5f, 0x45, + 0x52, 0x52, 0x4f, 0x52, 0x10, 0xc9, 0x01, 0x12, 0x1c, 0x0a, 0x17, 0x43, 0x4f, 0x4e, 0x44, 0x49, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, + 0x53, 0x53, 0x10, 0xca, 0x01, 0x22, 0xa9, 0x01, 0x0a, 0x07, 0x4f, 0x6e, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x12, 0x13, 0x0a, 0x0f, 0x4f, 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x49, 0x47, + 0x4e, 0x4f, 0x52, 0x45, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4f, 0x4e, 0x5f, 0x45, 0x52, 0x52, + 0x4f, 0x52, 0x5f, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4f, + 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x46, 0x41, 0x54, 0x41, 0x4c, 0x10, 0x02, 0x12, + 0x1a, 0x0a, 0x16, 0x4f, 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x52, 0x45, 0x54, 0x52, + 0x59, 0x5f, 0x31, 0x4d, 0x49, 0x4e, 0x55, 0x54, 0x45, 0x10, 0x64, 0x12, 0x1c, 0x0a, 0x18, 0x4f, + 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x52, 0x45, 0x54, 0x52, 0x59, 0x5f, 0x31, 0x30, + 0x4d, 0x49, 0x4e, 0x55, 0x54, 0x45, 0x53, 0x10, 0x65, 0x12, 0x26, 0x0a, 0x22, 0x4f, 0x4e, 0x5f, + 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x52, 0x45, 0x54, 0x52, 0x59, 0x5f, 0x45, 0x58, 0x50, 0x4f, + 0x4e, 0x45, 0x4e, 0x54, 0x49, 0x41, 0x4c, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x4f, 0x46, 0x46, 0x10, + 0x67, 0x42, 0x08, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x42, 0x0a, 0x04, 0x41, + 0x75, 0x74, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, + 0x1e, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, + 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x22, + 0x51, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x0f, 0x70, + 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x62, 0x63, 0x72, 0x79, 0x70, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0e, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, + 0x42, 0x63, 0x72, 0x79, 0x70, 0x74, 0x42, 0x0a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, + 0x72, 0x64, 0x42, 0x2c, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x67, 0x61, 0x72, 0x65, 0x74, 0x68, 0x67, 0x65, 0x6f, 0x72, 0x67, 0x65, 0x2f, 0x62, 0x61, + 0x63, 0x6b, 0x72, 0x65, 0x73, 0x74, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x76, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2300,67 +2312,69 @@ func file_v1_config_proto_rawDescGZIP() []byte { return file_v1_config_proto_rawDescData } -var file_v1_config_proto_enumTypes = make([]protoimpl.EnumInfo, 5) +var file_v1_config_proto_enumTypes = make([]protoimpl.EnumInfo, 6) var file_v1_config_proto_msgTypes = make([]protoimpl.MessageInfo, 20) var file_v1_config_proto_goTypes = []interface{}{ (CommandPrefix_IONiceLevel)(0), // 0: v1.CommandPrefix.IONiceLevel (CommandPrefix_CPUNiceLevel)(0), // 1: v1.CommandPrefix.CPUNiceLevel - (Hook_Condition)(0), // 2: v1.Hook.Condition - (Hook_OnError)(0), // 3: v1.Hook.OnError - (Hook_Webhook_Method)(0), // 4: v1.Hook.Webhook.Method - (*HubConfig)(nil), // 5: v1.HubConfig - (*Config)(nil), // 6: v1.Config - (*Repo)(nil), // 7: v1.Repo - (*Plan)(nil), // 8: v1.Plan - (*CommandPrefix)(nil), // 9: v1.CommandPrefix - (*RetentionPolicy)(nil), // 10: v1.RetentionPolicy - (*PrunePolicy)(nil), // 11: v1.PrunePolicy - (*CheckPolicy)(nil), // 12: v1.CheckPolicy - (*Schedule)(nil), // 13: v1.Schedule - (*Hook)(nil), // 14: v1.Hook - (*Auth)(nil), // 15: v1.Auth - (*User)(nil), // 16: v1.User - (*HubConfig_InstanceInfo)(nil), // 17: v1.HubConfig.InstanceInfo - (*RetentionPolicy_TimeBucketedCounts)(nil), // 18: v1.RetentionPolicy.TimeBucketedCounts - (*Hook_Command)(nil), // 19: v1.Hook.Command - (*Hook_Webhook)(nil), // 20: v1.Hook.Webhook - (*Hook_Discord)(nil), // 21: v1.Hook.Discord - (*Hook_Gotify)(nil), // 22: v1.Hook.Gotify - (*Hook_Slack)(nil), // 23: v1.Hook.Slack - (*Hook_Shoutrrr)(nil), // 24: v1.Hook.Shoutrrr + (Schedule_Clock)(0), // 2: v1.Schedule.Clock + (Hook_Condition)(0), // 3: v1.Hook.Condition + (Hook_OnError)(0), // 4: v1.Hook.OnError + (Hook_Webhook_Method)(0), // 5: v1.Hook.Webhook.Method + (*HubConfig)(nil), // 6: v1.HubConfig + (*Config)(nil), // 7: v1.Config + (*Repo)(nil), // 8: v1.Repo + (*Plan)(nil), // 9: v1.Plan + (*CommandPrefix)(nil), // 10: v1.CommandPrefix + (*RetentionPolicy)(nil), // 11: v1.RetentionPolicy + (*PrunePolicy)(nil), // 12: v1.PrunePolicy + (*CheckPolicy)(nil), // 13: v1.CheckPolicy + (*Schedule)(nil), // 14: v1.Schedule + (*Hook)(nil), // 15: v1.Hook + (*Auth)(nil), // 16: v1.Auth + (*User)(nil), // 17: v1.User + (*HubConfig_InstanceInfo)(nil), // 18: v1.HubConfig.InstanceInfo + (*RetentionPolicy_TimeBucketedCounts)(nil), // 19: v1.RetentionPolicy.TimeBucketedCounts + (*Hook_Command)(nil), // 20: v1.Hook.Command + (*Hook_Webhook)(nil), // 21: v1.Hook.Webhook + (*Hook_Discord)(nil), // 22: v1.Hook.Discord + (*Hook_Gotify)(nil), // 23: v1.Hook.Gotify + (*Hook_Slack)(nil), // 24: v1.Hook.Slack + (*Hook_Shoutrrr)(nil), // 25: v1.Hook.Shoutrrr } var file_v1_config_proto_depIdxs = []int32{ - 17, // 0: v1.HubConfig.instances:type_name -> v1.HubConfig.InstanceInfo - 7, // 1: v1.Config.repos:type_name -> v1.Repo - 8, // 2: v1.Config.plans:type_name -> v1.Plan - 15, // 3: v1.Config.auth:type_name -> v1.Auth - 11, // 4: v1.Repo.prune_policy:type_name -> v1.PrunePolicy - 12, // 5: v1.Repo.check_policy:type_name -> v1.CheckPolicy - 14, // 6: v1.Repo.hooks:type_name -> v1.Hook - 9, // 7: v1.Repo.command_prefix:type_name -> v1.CommandPrefix - 13, // 8: v1.Plan.schedule:type_name -> v1.Schedule - 10, // 9: v1.Plan.retention:type_name -> v1.RetentionPolicy - 14, // 10: v1.Plan.hooks:type_name -> v1.Hook + 18, // 0: v1.HubConfig.instances:type_name -> v1.HubConfig.InstanceInfo + 8, // 1: v1.Config.repos:type_name -> v1.Repo + 9, // 2: v1.Config.plans:type_name -> v1.Plan + 16, // 3: v1.Config.auth:type_name -> v1.Auth + 12, // 4: v1.Repo.prune_policy:type_name -> v1.PrunePolicy + 13, // 5: v1.Repo.check_policy:type_name -> v1.CheckPolicy + 15, // 6: v1.Repo.hooks:type_name -> v1.Hook + 10, // 7: v1.Repo.command_prefix:type_name -> v1.CommandPrefix + 14, // 8: v1.Plan.schedule:type_name -> v1.Schedule + 11, // 9: v1.Plan.retention:type_name -> v1.RetentionPolicy + 15, // 10: v1.Plan.hooks:type_name -> v1.Hook 0, // 11: v1.CommandPrefix.io_nice:type_name -> v1.CommandPrefix.IONiceLevel 1, // 12: v1.CommandPrefix.cpu_nice:type_name -> v1.CommandPrefix.CPUNiceLevel - 18, // 13: v1.RetentionPolicy.policy_time_bucketed:type_name -> v1.RetentionPolicy.TimeBucketedCounts - 13, // 14: v1.PrunePolicy.schedule:type_name -> v1.Schedule - 13, // 15: v1.CheckPolicy.schedule:type_name -> v1.Schedule - 2, // 16: v1.Hook.conditions:type_name -> v1.Hook.Condition - 3, // 17: v1.Hook.on_error:type_name -> v1.Hook.OnError - 19, // 18: v1.Hook.action_command:type_name -> v1.Hook.Command - 20, // 19: v1.Hook.action_webhook:type_name -> v1.Hook.Webhook - 21, // 20: v1.Hook.action_discord:type_name -> v1.Hook.Discord - 22, // 21: v1.Hook.action_gotify:type_name -> v1.Hook.Gotify - 23, // 22: v1.Hook.action_slack:type_name -> v1.Hook.Slack - 24, // 23: v1.Hook.action_shoutrrr:type_name -> v1.Hook.Shoutrrr - 16, // 24: v1.Auth.users:type_name -> v1.User - 4, // 25: v1.Hook.Webhook.method:type_name -> v1.Hook.Webhook.Method - 26, // [26:26] is the sub-list for method output_type - 26, // [26:26] is the sub-list for method input_type - 26, // [26:26] is the sub-list for extension type_name - 26, // [26:26] is the sub-list for extension extendee - 0, // [0:26] is the sub-list for field type_name + 19, // 13: v1.RetentionPolicy.policy_time_bucketed:type_name -> v1.RetentionPolicy.TimeBucketedCounts + 14, // 14: v1.PrunePolicy.schedule:type_name -> v1.Schedule + 14, // 15: v1.CheckPolicy.schedule:type_name -> v1.Schedule + 2, // 16: v1.Schedule.clock:type_name -> v1.Schedule.Clock + 3, // 17: v1.Hook.conditions:type_name -> v1.Hook.Condition + 4, // 18: v1.Hook.on_error:type_name -> v1.Hook.OnError + 20, // 19: v1.Hook.action_command:type_name -> v1.Hook.Command + 21, // 20: v1.Hook.action_webhook:type_name -> v1.Hook.Webhook + 22, // 21: v1.Hook.action_discord:type_name -> v1.Hook.Discord + 23, // 22: v1.Hook.action_gotify:type_name -> v1.Hook.Gotify + 24, // 23: v1.Hook.action_slack:type_name -> v1.Hook.Slack + 25, // 24: v1.Hook.action_shoutrrr:type_name -> v1.Hook.Shoutrrr + 17, // 25: v1.Auth.users:type_name -> v1.User + 5, // 26: v1.Hook.Webhook.method:type_name -> v1.Hook.Webhook.Method + 27, // [27:27] is the sub-list for method output_type + 27, // [27:27] is the sub-list for method input_type + 27, // [27:27] is the sub-list for extension type_name + 27, // [27:27] is the sub-list for extension extendee + 0, // [0:27] is the sub-list for field type_name } func init() { file_v1_config_proto_init() } @@ -2624,9 +2638,6 @@ func file_v1_config_proto_init() { (*Schedule_Cron)(nil), (*Schedule_MaxFrequencyDays)(nil), (*Schedule_MaxFrequencyHours)(nil), - (*Schedule_CronSinceLastRun)(nil), - (*Schedule_MinHoursSinceLastRun)(nil), - (*Schedule_MinDaysSinceLastRun)(nil), } file_v1_config_proto_msgTypes[9].OneofWrappers = []interface{}{ (*Hook_ActionCommand)(nil), @@ -2644,7 +2655,7 @@ func file_v1_config_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_v1_config_proto_rawDesc, - NumEnums: 5, + NumEnums: 6, NumMessages: 20, NumExtensions: 0, NumServices: 0, diff --git a/internal/config/migrations/003relativescheduling.go b/internal/config/migrations/003relativescheduling.go index 6377ceabb..3f36ff129 100644 --- a/internal/config/migrations/003relativescheduling.go +++ b/internal/config/migrations/003relativescheduling.go @@ -4,25 +4,6 @@ import ( v1 "github.com/garethgeorge/backrest/gen/go/v1" ) -func convertToRelativeSchedule(sched *v1.Schedule) { - switch s := sched.GetSchedule().(type) { - case *v1.Schedule_MaxFrequencyDays: - sched.Schedule = &v1.Schedule_MinDaysSinceLastRun{ - MinDaysSinceLastRun: s.MaxFrequencyDays, - } - case *v1.Schedule_MaxFrequencyHours: - sched.Schedule = &v1.Schedule_MinHoursSinceLastRun{ - MinHoursSinceLastRun: s.MaxFrequencyHours, - } - case *v1.Schedule_Cron: - sched.Schedule = &v1.Schedule_CronSinceLastRun{ - CronSinceLastRun: s.Cron, - } - default: - // do nothing - } -} - func migration003RelativeScheduling(config *v1.Config) { // loop over plans and examine prune policy's for _, repo := range config.Repos { @@ -32,11 +13,11 @@ func migration003RelativeScheduling(config *v1.Config) { } if schedule := repo.GetPrunePolicy().GetSchedule(); schedule != nil { - convertToRelativeSchedule(schedule) + schedule.Clock = v1.Schedule_CLOCK_LAST_RUN_TIME } if schedule := repo.GetCheckPolicy().GetSchedule(); schedule != nil { - convertToRelativeSchedule(schedule) + schedule.Clock = v1.Schedule_CLOCK_LAST_RUN_TIME } } } diff --git a/internal/config/migrations/003relativescheduling_test.go b/internal/config/migrations/003relativescheduling_test.go index 52385503a..13bf4baa5 100644 --- a/internal/config/migrations/003relativescheduling_test.go +++ b/internal/config/migrations/003relativescheduling_test.go @@ -11,7 +11,7 @@ func Test003Migration(t *testing.T) { config := &v1.Config{ Repos: []*v1.Repo{ { - Id: "prune daily", + Id: "prune", PrunePolicy: &v1.PrunePolicy{ Schedule: &v1.Schedule{ Schedule: &v1.Schedule_MaxFrequencyDays{ @@ -27,98 +27,12 @@ func Test003Migration(t *testing.T) { }, }, }, - { - Id: "prune hourly", - PrunePolicy: &v1.PrunePolicy{ - Schedule: &v1.Schedule{ - Schedule: &v1.Schedule_MaxFrequencyHours{ - MaxFrequencyHours: 1, - }, - }, - }, - CheckPolicy: &v1.CheckPolicy{ - Schedule: &v1.Schedule{ - Schedule: &v1.Schedule_MaxFrequencyHours{ - MaxFrequencyHours: 1, - }, - }, - }, - }, - { - Id: "prune cron", - PrunePolicy: &v1.PrunePolicy{ - Schedule: &v1.Schedule{ - Schedule: &v1.Schedule_Cron{ - Cron: "0 0 * * *", - }, - }, - }, - CheckPolicy: &v1.CheckPolicy{ - Schedule: &v1.Schedule{ - Schedule: &v1.Schedule_Cron{ - Cron: "0 0 * * *", - }, - }, - }, - }, }, } - want := &v1.Config{ - Repos: []*v1.Repo{ - { - Id: "prune daily", - PrunePolicy: &v1.PrunePolicy{ - Schedule: &v1.Schedule{ - Schedule: &v1.Schedule_MinDaysSinceLastRun{ - MinDaysSinceLastRun: 1, - }, - }, - }, - CheckPolicy: &v1.CheckPolicy{ - Schedule: &v1.Schedule{ - Schedule: &v1.Schedule_MinDaysSinceLastRun{ - MinDaysSinceLastRun: 1, - }, - }, - }, - }, - { - Id: "prune hourly", - PrunePolicy: &v1.PrunePolicy{ - Schedule: &v1.Schedule{ - Schedule: &v1.Schedule_MinHoursSinceLastRun{ - MinHoursSinceLastRun: 1, - }, - }, - }, - CheckPolicy: &v1.CheckPolicy{ - Schedule: &v1.Schedule{ - Schedule: &v1.Schedule_MinHoursSinceLastRun{ - MinHoursSinceLastRun: 1, - }, - }, - }, - }, - { - Id: "prune cron", - PrunePolicy: &v1.PrunePolicy{ - Schedule: &v1.Schedule{ - Schedule: &v1.Schedule_CronSinceLastRun{ - CronSinceLastRun: "0 0 * * *", - }, - }, - }, - CheckPolicy: &v1.CheckPolicy{ - Schedule: &v1.Schedule{ - Schedule: &v1.Schedule_CronSinceLastRun{ - CronSinceLastRun: "0 0 * * *", - }, - }, - }, - }, - }, - } + want := proto.Clone(config).(*v1.Config) + want.Repos[0].PrunePolicy.Schedule.Clock = v1.Schedule_CLOCK_LAST_RUN_TIME + want.Repos[0].CheckPolicy.Schedule.Clock = v1.Schedule_CLOCK_LAST_RUN_TIME migration003RelativeScheduling(config) diff --git a/internal/orchestrator/orchestrator.go b/internal/orchestrator/orchestrator.go index f07f2743a..d536d8d57 100644 --- a/internal/orchestrator/orchestrator.go +++ b/internal/orchestrator/orchestrator.go @@ -171,7 +171,7 @@ func (o *Orchestrator) ScheduleDefaultTasks(config *v1.Config) error { } } - zap.L().Info("reset task queue, scheduling new task set.") + zap.L().Info("reset task queue, scheduling new task set", zap.String("timezone", time.Now().Location().String())) // Requeue tasks that are affected by the config change. if err := o.ScheduleTask(tasks.NewCollectGarbageTask(), tasks.TaskPriorityDefault); err != nil { diff --git a/internal/orchestrator/tasks/scheduling_test.go b/internal/orchestrator/tasks/scheduling_test.go index f588f36e3..f57c1317d 100644 --- a/internal/orchestrator/tasks/scheduling_test.go +++ b/internal/orchestrator/tasks/scheduling_test.go @@ -43,16 +43,18 @@ func TestScheduling(t *testing.T) { Id: "repo-relative", CheckPolicy: &v1.CheckPolicy{ Schedule: &v1.Schedule{ - Schedule: &v1.Schedule_MinHoursSinceLastRun{ - MinHoursSinceLastRun: 1, + Schedule: &v1.Schedule_MaxFrequencyHours{ + MaxFrequencyHours: 1, }, + Clock: v1.Schedule_CLOCK_LAST_RUN_TIME, }, }, PrunePolicy: &v1.PrunePolicy{ Schedule: &v1.Schedule{ - Schedule: &v1.Schedule_MinHoursSinceLastRun{ - MinHoursSinceLastRun: 1, + Schedule: &v1.Schedule_MaxFrequencyHours{ + MaxFrequencyHours: 1, }, + Clock: v1.Schedule_CLOCK_LAST_RUN_TIME, }, }, }, @@ -64,14 +66,16 @@ func TestScheduling(t *testing.T) { Schedule: &v1.Schedule_Cron{ Cron: "0 0 * * *", // every day at midnight }, + Clock: v1.Schedule_CLOCK_LOCAL, }, }, { Id: "plan-cron-since-last-run", Schedule: &v1.Schedule{ - Schedule: &v1.Schedule_CronSinceLastRun{ - CronSinceLastRun: "0 0 * * *", // every day at midnight + Schedule: &v1.Schedule_Cron{ + Cron: "0 0 * * *", // every day at midnight }, + Clock: v1.Schedule_CLOCK_LAST_RUN_TIME, }, }, { @@ -81,15 +85,17 @@ func TestScheduling(t *testing.T) { Schedule: &v1.Schedule_MaxFrequencyDays{ MaxFrequencyDays: 1, }, + Clock: v1.Schedule_CLOCK_LAST_RUN_TIME, }, }, { Id: "plan-min-days-since-last-run", Repo: "repo1", Schedule: &v1.Schedule{ - Schedule: &v1.Schedule_MinDaysSinceLastRun{ - MinDaysSinceLastRun: 1, + Schedule: &v1.Schedule_MaxFrequencyDays{ + MaxFrequencyDays: 1, }, + Clock: v1.Schedule_CLOCK_LAST_RUN_TIME, }, }, { @@ -105,9 +111,10 @@ func TestScheduling(t *testing.T) { Id: "plan-min-hours-since-last-run", Repo: "repo1", Schedule: &v1.Schedule{ - Schedule: &v1.Schedule_MinHoursSinceLastRun{ - MinHoursSinceLastRun: 1, + Schedule: &v1.Schedule_MaxFrequencyHours{ + MaxFrequencyHours: 1, }, + Clock: v1.Schedule_CLOCK_LAST_RUN_TIME, }, }, }, diff --git a/internal/protoutil/schedule.go b/internal/protoutil/schedule.go index cf09cbd94..c6fe0fac0 100644 --- a/internal/protoutil/schedule.go +++ b/internal/protoutil/schedule.go @@ -14,29 +14,32 @@ var ErrScheduleDisabled = errors.New("never") // ResolveSchedule resolves a schedule to the next time it should run based on last execution. // note that this is different from backup behavior which is always relative to the current time. func ResolveSchedule(sched *v1.Schedule, lastRan time.Time, curTime time.Time) (time.Time, error) { + + var t time.Time + switch sched.GetClock() { + case v1.Schedule_CLOCK_LOCAL: + t = curTime.Local() + case v1.Schedule_CLOCK_UTC: + t = curTime.UTC() + case v1.Schedule_CLOCK_LAST_RUN_TIME: + t = lastRan + default: + return time.Time{}, fmt.Errorf("unknown clock type: %T", s) + } + switch s := sched.GetSchedule().(type) { case *v1.Schedule_Disabled: return time.Time{}, ErrScheduleDisabled case *v1.Schedule_MaxFrequencyDays: - return curTime.Add(time.Duration(s.MaxFrequencyDays) * 24 * time.Hour), nil + return t.Add(time.Duration(s.MaxFrequencyDays) * 24 * time.Hour), nil case *v1.Schedule_MaxFrequencyHours: - return curTime.Add(time.Duration(s.MaxFrequencyHours) * time.Hour), nil + return t.Add(time.Duration(s.MaxFrequencyHours) * time.Hour), nil case *v1.Schedule_Cron: cron, err := cronexpr.ParseInLocation(s.Cron, time.Now().Location().String()) if err != nil { return time.Time{}, fmt.Errorf("parse cron %q: %w", s.Cron, err) } - return cron.Next(curTime), nil - case *v1.Schedule_MinHoursSinceLastRun: - return lastRan.Add(time.Duration(s.MinHoursSinceLastRun) * time.Hour), nil - case *v1.Schedule_MinDaysSinceLastRun: - return lastRan.Add(time.Duration(s.MinDaysSinceLastRun) * 24 * time.Hour), nil - case *v1.Schedule_CronSinceLastRun: - cron, err := cronexpr.ParseInLocation(s.CronSinceLastRun, time.Now().Location().String()) - if err != nil { - return time.Time{}, fmt.Errorf("parse cron %q: %w", s.CronSinceLastRun, err) - } - return cron.Next(lastRan), nil + return cron.Next(t), nil default: return time.Time{}, fmt.Errorf("unknown schedule type: %T", s) } @@ -60,22 +63,6 @@ func ValidateSchedule(sched *v1.Schedule) error { if err != nil { return fmt.Errorf("invalid cron %q: %w", s.Cron, err) } - case *v1.Schedule_MinHoursSinceLastRun: - if s.MinHoursSinceLastRun < 1 { - return errors.New("invalid min hours since last run") - } - case *v1.Schedule_MinDaysSinceLastRun: - if s.MinDaysSinceLastRun < 1 { - return errors.New("invalid min days since last run") - } - case *v1.Schedule_CronSinceLastRun: - if s.CronSinceLastRun == "" { - return errors.New("empty cron expression") - } - _, err := cronexpr.ParseInLocation(s.CronSinceLastRun, time.Now().Location().String()) - if err != nil { - return fmt.Errorf("invalid cron %q: %w", s.CronSinceLastRun, err) - } case *v1.Schedule_Disabled: if !s.Disabled { return errors.New("disabled boolean must be set to true") diff --git a/proto/v1/config.proto b/proto/v1/config.proto index 54ed03440..0e90b6437 100644 --- a/proto/v1/config.proto +++ b/proto/v1/config.proto @@ -124,10 +124,15 @@ message Schedule { string cron = 2 [json_name="cron"]; // cron expression describing the schedule. int32 maxFrequencyDays = 3 [json_name="maxFrequencyDays"]; // max frequency of runs in days. int32 maxFrequencyHours = 4 [json_name="maxFrequencyHours"]; // max frequency of runs in hours. - string cronSinceLastRun = 100 [json_name="cronSinceLastRun"]; // cron expression to run since the last run. - int32 minHoursSinceLastRun = 101 [json_name="minHoursSinceLastRun"]; // max hours since the last run. - int32 minDaysSinceLastRun = 102 [json_name="minDaysSinceLastRun"]; // max days since the last run. } + + enum Clock { + CLOCK_LOCAL = 0; + CLOCK_UTC = 1; + CLOCK_LAST_RUN_TIME = 2; + } + + Clock clock = 5 [json_name="clock"]; // clock to use for scheduling. } message Hook { diff --git a/webui/gen/ts/v1/config_pb.ts b/webui/gen/ts/v1/config_pb.ts index 6de152a3b..a78e300d8 100644 --- a/webui/gen/ts/v1/config_pb.ts +++ b/webui/gen/ts/v1/config_pb.ts @@ -848,32 +848,15 @@ export class Schedule extends Message { */ value: number; case: "maxFrequencyHours"; - } | { - /** - * cron expression to run since the last run. - * - * @generated from field: string cronSinceLastRun = 100; - */ - value: string; - case: "cronSinceLastRun"; - } | { - /** - * max hours since the last run. - * - * @generated from field: int32 minHoursSinceLastRun = 101; - */ - value: number; - case: "minHoursSinceLastRun"; - } | { - /** - * max days since the last run. - * - * @generated from field: int32 minDaysSinceLastRun = 102; - */ - value: number; - case: "minDaysSinceLastRun"; } | { case: undefined; value?: undefined } = { case: undefined }; + /** + * clock to use for scheduling. + * + * @generated from field: v1.Schedule.Clock clock = 5; + */ + clock = Schedule_Clock.LOCAL; + constructor(data?: PartialMessage) { super(); proto3.util.initPartial(data, this); @@ -886,9 +869,7 @@ export class Schedule extends Message { { no: 2, name: "cron", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "schedule" }, { no: 3, name: "maxFrequencyDays", kind: "scalar", T: 5 /* ScalarType.INT32 */, oneof: "schedule" }, { no: 4, name: "maxFrequencyHours", kind: "scalar", T: 5 /* ScalarType.INT32 */, oneof: "schedule" }, - { no: 100, name: "cronSinceLastRun", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "schedule" }, - { no: 101, name: "minHoursSinceLastRun", kind: "scalar", T: 5 /* ScalarType.INT32 */, oneof: "schedule" }, - { no: 102, name: "minDaysSinceLastRun", kind: "scalar", T: 5 /* ScalarType.INT32 */, oneof: "schedule" }, + { no: 5, name: "clock", kind: "enum", T: proto3.getEnumType(Schedule_Clock) }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): Schedule { @@ -908,6 +889,32 @@ export class Schedule extends Message { } } +/** + * @generated from enum v1.Schedule.Clock + */ +export enum Schedule_Clock { + /** + * @generated from enum value: CLOCK_LOCAL = 0; + */ + LOCAL = 0, + + /** + * @generated from enum value: CLOCK_UTC = 1; + */ + UTC = 1, + + /** + * @generated from enum value: CLOCK_LAST_RUN_TIME = 2; + */ + LAST_RUN_TIME = 2, +} +// Retrieve enum metadata with: proto3.getEnumType(Schedule_Clock) +proto3.util.setEnumType(Schedule_Clock, "v1.Schedule.Clock", [ + { no: 0, name: "CLOCK_LOCAL" }, + { no: 1, name: "CLOCK_UTC" }, + { no: 2, name: "CLOCK_LAST_RUN_TIME" }, +]); + /** * @generated from message v1.Hook */ diff --git a/webui/src/components/ScheduleFormItem.tsx b/webui/src/components/ScheduleFormItem.tsx index bf402132e..390a8eb95 100644 --- a/webui/src/components/ScheduleFormItem.tsx +++ b/webui/src/components/ScheduleFormItem.tsx @@ -1,6 +1,7 @@ import { Checkbox, Form, InputNumber, Radio, Row, Tooltip } from "antd"; import React from "react"; import Cron, { CronType, PeriodType } from "react-js-cron"; +import { Schedule_Clock } from "../../gen/ts/v1/config_pb"; interface ScheduleDefaults { maxFrequencyDays: number; @@ -8,6 +9,7 @@ interface ScheduleDefaults { cron: string; cronPeriods?: PeriodType[]; cronDropdowns?: CronType[]; + clock: Schedule_Clock; } export const ScheduleDefaultsInfrequent: ScheduleDefaults = { @@ -17,6 +19,7 @@ export const ScheduleDefaultsInfrequent: ScheduleDefaults = { cron: "0 0 1 * *", cronDropdowns: ["period", "months", "month-days", "week-days", "hours"], cronPeriods: ["month", "week"], + clock: Schedule_Clock.LAST_RUN_TIME, }; export const ScheduleDefaultsDaily: ScheduleDefaults = { @@ -33,6 +36,7 @@ export const ScheduleDefaultsDaily: ScheduleDefaults = { "week-days", ], cronPeriods: ["day", "hour", "month", "week"], + clock: Schedule_Clock.LOCAL, }; type SchedulingMode = @@ -40,18 +44,13 @@ type SchedulingMode = | "disabled" | "maxFrequencyDays" | "maxFrequencyHours" - | "cron" - | "cronSinceLastRun" - | "minHoursSinceLastRun" - | "minDaysSinceLastRun"; + | "cron"; export const ScheduleFormItem = ({ name, defaults, - allowedModes, }: { name: string[]; - defaults?: ScheduleDefaults; - allowedModes?: SchedulingMode[]; + defaults: ScheduleDefaults; }) => { const form = Form.useFormInstance(); const schedule = Form.useWatch(name, { form, preserve: true }) as any; @@ -69,12 +68,6 @@ export const ScheduleFormItem = ({ return "maxFrequencyHours"; } else if (schedule.cron) { return "cron"; - } else if (schedule.cronSinceLastRun) { - return "cronSinceLastRun"; - } else if (schedule.minHoursSinceLastRun) { - return "minHoursSinceLastRun"; - } else if (schedule.minDaysSinceLastRun) { - return "minDaysSinceLastRun"; } return ""; }; @@ -146,70 +139,6 @@ export const ScheduleFormItem = ({ /> ); - } else if (mode === "cronSinceLastRun") { - elem = ( - - { - form.setFieldValue(name.concat(["cronSinceLastRun"]), val); - }} - allowedDropdowns={defaults.cronDropdowns} - allowedPeriods={defaults.cronPeriods} - clearButton={false} - /> - - ); - } else if (mode === "minHoursSinceLastRun") { - elem = ( - - Interval in Hours} - type="number" - min={1} - /> - - ); - } else if (mode === "minDaysSinceLastRun") { - elem = ( - - Interval in Days} - type="number" - min={1} - /> - - ); } else if (mode === "disabled") { elem = ( )} - {(!allowedModes || allowedModes.includes("minHoursSinceLastRun")) && ( - - - Hours After Last Run - - - )} - {(!allowedModes || allowedModes.includes("minDaysSinceLastRun")) && ( - - - Days After Last Run - - - )} - {(!allowedModes || allowedModes.includes("cronSinceLastRun")) && ( - - - Last Run Relative Cron - - - )}
From c86c758fb5c85de6d424e83edc2890ebdbae95c0 Mon Sep 17 00:00:00 2001 From: garethgeorge Date: Tue, 3 Sep 2024 20:01:45 -0700 Subject: [PATCH 2/2] finish implementation --- gen/go/v1/config.pb.go | 256 +++++++++--------- internal/config/validate.go | 2 +- internal/orchestrator/orchestrator.go | 3 +- .../orchestrator/tasks/scheduling_test.go | 27 +- internal/protoutil/schedule.go | 9 +- proto/v1/config.proto | 7 +- webui/gen/ts/v1/config_pb.ts | 28 +- webui/src/components/ScheduleFormItem.tsx | 106 ++++++-- webui/src/views/AddRepoModal.tsx | 20 +- 9 files changed, 268 insertions(+), 190 deletions(-) diff --git a/gen/go/v1/config.pb.go b/gen/go/v1/config.pb.go index 9c3568134..6885151dd 100644 --- a/gen/go/v1/config.pb.go +++ b/gen/go/v1/config.pb.go @@ -125,22 +125,25 @@ func (CommandPrefix_CPUNiceLevel) EnumDescriptor() ([]byte, []int) { type Schedule_Clock int32 const ( - Schedule_CLOCK_LOCAL Schedule_Clock = 0 - Schedule_CLOCK_UTC Schedule_Clock = 1 - Schedule_CLOCK_LAST_RUN_TIME Schedule_Clock = 2 + Schedule_CLOCK_DEFAULT Schedule_Clock = 0 // same as CLOCK_LOCAL + Schedule_CLOCK_LOCAL Schedule_Clock = 1 + Schedule_CLOCK_UTC Schedule_Clock = 2 + Schedule_CLOCK_LAST_RUN_TIME Schedule_Clock = 3 ) // Enum value maps for Schedule_Clock. var ( Schedule_Clock_name = map[int32]string{ - 0: "CLOCK_LOCAL", - 1: "CLOCK_UTC", - 2: "CLOCK_LAST_RUN_TIME", + 0: "CLOCK_DEFAULT", + 1: "CLOCK_LOCAL", + 2: "CLOCK_UTC", + 3: "CLOCK_LAST_RUN_TIME", } Schedule_Clock_value = map[string]int32{ - "CLOCK_LOCAL": 0, - "CLOCK_UTC": 1, - "CLOCK_LAST_RUN_TIME": 2, + "CLOCK_DEFAULT": 0, + "CLOCK_LOCAL": 1, + "CLOCK_UTC": 2, + "CLOCK_LAST_RUN_TIME": 3, } ) @@ -1225,7 +1228,7 @@ func (x *Schedule) GetClock() Schedule_Clock { if x != nil { return x.Clock } - return Schedule_CLOCK_LOCAL + return Schedule_CLOCK_DEFAULT } type isSchedule_Schedule interface { @@ -2169,7 +2172,7 @@ var file_v1_config_proto_rawDesc = []byte{ 0x61, 0x74, 0x61, 0x5f, 0x73, 0x75, 0x62, 0x73, 0x65, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x18, 0x65, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x15, 0x72, 0x65, 0x61, 0x64, 0x44, 0x61, 0x74, 0x61, 0x53, 0x75, 0x62, 0x73, 0x65, 0x74, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, - 0x74, 0x42, 0x06, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0x94, 0x02, 0x0a, 0x08, 0x53, 0x63, + 0x74, 0x42, 0x06, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0xa7, 0x02, 0x0a, 0x08, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x04, 0x63, 0x72, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, @@ -2182,122 +2185,123 @@ var file_v1_config_proto_rawDesc = []byte{ 0x6e, 0x63, 0x79, 0x48, 0x6f, 0x75, 0x72, 0x73, 0x12, 0x28, 0x0a, 0x05, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x05, 0x63, 0x6c, 0x6f, - 0x63, 0x6b, 0x22, 0x40, 0x0a, 0x05, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x0f, 0x0a, 0x0b, 0x43, - 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, - 0x43, 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x55, 0x54, 0x43, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x43, - 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x4c, 0x41, 0x53, 0x54, 0x5f, 0x52, 0x55, 0x4e, 0x5f, 0x54, 0x49, - 0x4d, 0x45, 0x10, 0x02, 0x42, 0x0a, 0x0a, 0x08, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, - 0x22, 0x98, 0x0c, 0x0a, 0x04, 0x48, 0x6f, 0x6f, 0x6b, 0x12, 0x32, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, - 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x12, 0x2e, - 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2b, 0x0a, - 0x08, 0x6f, 0x6e, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x10, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x4f, 0x6e, 0x45, 0x72, 0x72, 0x6f, - 0x72, 0x52, 0x07, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x39, 0x0a, 0x0e, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x64, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x43, 0x6f, 0x6d, - 0x6d, 0x61, 0x6e, 0x64, 0x48, 0x00, 0x52, 0x0d, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, - 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x39, 0x0a, 0x0e, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, - 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x48, - 0x00, 0x52, 0x0d, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, - 0x12, 0x39, 0x0a, 0x0e, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x69, 0x73, 0x63, 0x6f, - 0x72, 0x64, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, - 0x6f, 0x6b, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x72, 0x64, 0x48, 0x00, 0x52, 0x0d, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x36, 0x0a, 0x0d, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x67, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x18, 0x67, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x47, 0x6f, 0x74, - 0x69, 0x66, 0x79, 0x48, 0x00, 0x52, 0x0c, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x6f, 0x74, - 0x69, 0x66, 0x79, 0x12, 0x33, 0x0a, 0x0c, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x6c, - 0x61, 0x63, 0x6b, 0x18, 0x68, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x76, 0x31, 0x2e, 0x48, - 0x6f, 0x6f, 0x6b, 0x2e, 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x0b, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x12, 0x3c, 0x0a, 0x0f, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x73, 0x68, 0x6f, 0x75, 0x74, 0x72, 0x72, 0x72, 0x18, 0x69, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x11, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x53, 0x68, 0x6f, 0x75, - 0x74, 0x72, 0x72, 0x72, 0x48, 0x00, 0x52, 0x0e, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x68, - 0x6f, 0x75, 0x74, 0x72, 0x72, 0x72, 0x1a, 0x23, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, - 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x1a, 0xa1, 0x01, 0x0a, 0x07, - 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x65, 0x62, 0x68, 0x6f, - 0x6f, 0x6b, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x65, - 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x55, 0x72, 0x6c, 0x12, 0x2f, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, - 0x6f, 0x6b, 0x2e, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6d, - 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, - 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, 0x28, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, - 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, - 0x47, 0x45, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x50, 0x4f, 0x53, 0x54, 0x10, 0x02, 0x1a, - 0x46, 0x0a, 0x07, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x65, + 0x63, 0x6b, 0x22, 0x53, 0x0a, 0x05, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x11, 0x0a, 0x0d, 0x43, + 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x00, 0x12, 0x0f, + 0x0a, 0x0b, 0x43, 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x10, 0x01, 0x12, + 0x0d, 0x0a, 0x09, 0x43, 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x55, 0x54, 0x43, 0x10, 0x02, 0x12, 0x17, + 0x0a, 0x13, 0x43, 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x4c, 0x41, 0x53, 0x54, 0x5f, 0x52, 0x55, 0x4e, + 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x03, 0x42, 0x0a, 0x0a, 0x08, 0x73, 0x63, 0x68, 0x65, 0x64, + 0x75, 0x6c, 0x65, 0x22, 0x98, 0x0c, 0x0a, 0x04, 0x48, 0x6f, 0x6f, 0x6b, 0x12, 0x32, 0x0a, 0x0a, + 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0e, + 0x32, 0x12, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x43, 0x6f, 0x6e, 0x64, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x2b, 0x0a, 0x08, 0x6f, 0x6e, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x4f, 0x6e, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x52, 0x07, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x39, 0x0a, + 0x0e, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, + 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, + 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x48, 0x00, 0x52, 0x0d, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x39, 0x0a, 0x0e, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x10, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x57, 0x65, 0x62, 0x68, 0x6f, + 0x6f, 0x6b, 0x48, 0x00, 0x52, 0x0d, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x65, 0x62, 0x68, + 0x6f, 0x6f, 0x6b, 0x12, 0x39, 0x0a, 0x0e, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x69, + 0x73, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x76, 0x31, + 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x72, 0x64, 0x48, 0x00, 0x52, + 0x0d, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x36, + 0x0a, 0x0d, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x67, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x18, + 0x67, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, + 0x47, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x48, 0x00, 0x52, 0x0c, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x47, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x12, 0x33, 0x0a, 0x0c, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x73, 0x6c, 0x61, 0x63, 0x6b, 0x18, 0x68, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x76, + 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x0b, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x12, 0x3c, 0x0a, 0x0f, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x68, 0x6f, 0x75, 0x74, 0x72, 0x72, 0x72, 0x18, 0x69, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x53, + 0x68, 0x6f, 0x75, 0x74, 0x72, 0x72, 0x72, 0x48, 0x00, 0x52, 0x0e, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x53, 0x68, 0x6f, 0x75, 0x74, 0x72, 0x72, 0x72, 0x1a, 0x23, 0x0a, 0x07, 0x43, 0x6f, 0x6d, + 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x1a, 0xa1, + 0x01, 0x0a, 0x07, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x74, - 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, - 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x1a, 0x7c, 0x0a, 0x06, 0x47, 0x6f, 0x74, 0x69, 0x66, - 0x79, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x61, 0x73, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x64, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x25, - 0x0a, 0x0e, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, - 0x18, 0x65, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x54, 0x65, 0x6d, - 0x70, 0x6c, 0x61, 0x74, 0x65, 0x1a, 0x44, 0x0a, 0x05, 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x12, 0x1f, - 0x0a, 0x0b, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x55, 0x72, 0x6c, 0x12, - 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x1a, 0x49, 0x0a, 0x08, 0x53, - 0x68, 0x6f, 0x75, 0x74, 0x72, 0x72, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x68, 0x6f, 0x75, 0x74, - 0x72, 0x72, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, - 0x68, 0x6f, 0x75, 0x74, 0x72, 0x72, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, - 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, - 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, 0xfc, 0x02, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x64, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x15, 0x0a, 0x11, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, - 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x43, - 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x4e, 0x59, 0x5f, 0x45, 0x52, 0x52, - 0x4f, 0x52, 0x10, 0x01, 0x12, 0x1c, 0x0a, 0x18, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, - 0x4e, 0x5f, 0x53, 0x4e, 0x41, 0x50, 0x53, 0x48, 0x4f, 0x54, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54, - 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, - 0x53, 0x4e, 0x41, 0x50, 0x53, 0x48, 0x4f, 0x54, 0x5f, 0x45, 0x4e, 0x44, 0x10, 0x03, 0x12, 0x1c, - 0x0a, 0x18, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4e, 0x41, 0x50, - 0x53, 0x48, 0x4f, 0x54, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, 0x12, 0x1e, 0x0a, 0x1a, - 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4e, 0x41, 0x50, 0x53, 0x48, - 0x4f, 0x54, 0x5f, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x05, 0x12, 0x1e, 0x0a, 0x1a, - 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4e, 0x41, 0x50, 0x53, 0x48, - 0x4f, 0x54, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x06, 0x12, 0x19, 0x0a, 0x15, - 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x55, 0x4e, 0x45, 0x5f, - 0x53, 0x54, 0x41, 0x52, 0x54, 0x10, 0x64, 0x12, 0x19, 0x0a, 0x15, 0x43, 0x4f, 0x4e, 0x44, 0x49, - 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x55, 0x4e, 0x45, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, - 0x10, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, - 0x50, 0x52, 0x55, 0x4e, 0x45, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x66, 0x12, - 0x1a, 0x0a, 0x15, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x48, 0x45, - 0x43, 0x4b, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54, 0x10, 0xc8, 0x01, 0x12, 0x1a, 0x0a, 0x15, 0x43, - 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x5f, 0x45, - 0x52, 0x52, 0x4f, 0x52, 0x10, 0xc9, 0x01, 0x12, 0x1c, 0x0a, 0x17, 0x43, 0x4f, 0x4e, 0x44, 0x49, - 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, - 0x53, 0x53, 0x10, 0xca, 0x01, 0x22, 0xa9, 0x01, 0x0a, 0x07, 0x4f, 0x6e, 0x45, 0x72, 0x72, 0x6f, - 0x72, 0x12, 0x13, 0x0a, 0x0f, 0x4f, 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x49, 0x47, - 0x4e, 0x4f, 0x52, 0x45, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4f, 0x4e, 0x5f, 0x45, 0x52, 0x52, - 0x4f, 0x52, 0x5f, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4f, - 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x46, 0x41, 0x54, 0x41, 0x4c, 0x10, 0x02, 0x12, - 0x1a, 0x0a, 0x16, 0x4f, 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x52, 0x45, 0x54, 0x52, - 0x59, 0x5f, 0x31, 0x4d, 0x49, 0x4e, 0x55, 0x54, 0x45, 0x10, 0x64, 0x12, 0x1c, 0x0a, 0x18, 0x4f, - 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x52, 0x45, 0x54, 0x52, 0x59, 0x5f, 0x31, 0x30, - 0x4d, 0x49, 0x4e, 0x55, 0x54, 0x45, 0x53, 0x10, 0x65, 0x12, 0x26, 0x0a, 0x22, 0x4f, 0x4e, 0x5f, - 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x52, 0x45, 0x54, 0x52, 0x59, 0x5f, 0x45, 0x58, 0x50, 0x4f, - 0x4e, 0x45, 0x4e, 0x54, 0x49, 0x41, 0x4c, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x4f, 0x46, 0x46, 0x10, - 0x67, 0x42, 0x08, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x42, 0x0a, 0x04, 0x41, - 0x75, 0x74, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, - 0x1e, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, - 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x22, - 0x51, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x0f, 0x70, - 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x62, 0x63, 0x72, 0x79, 0x70, 0x74, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0e, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, - 0x42, 0x63, 0x72, 0x79, 0x70, 0x74, 0x42, 0x0a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, - 0x72, 0x64, 0x42, 0x2c, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x67, 0x61, 0x72, 0x65, 0x74, 0x68, 0x67, 0x65, 0x6f, 0x72, 0x67, 0x65, 0x2f, 0x62, 0x61, - 0x63, 0x6b, 0x72, 0x65, 0x73, 0x74, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x76, 0x31, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x0a, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x55, 0x72, 0x6c, 0x12, 0x2f, 0x0a, 0x06, 0x6d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x76, 0x31, + 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x2e, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x2e, 0x4d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x1a, 0x0a, 0x08, + 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, 0x28, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, + 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x50, 0x4f, 0x53, 0x54, + 0x10, 0x02, 0x1a, 0x46, 0x0a, 0x07, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x1f, 0x0a, + 0x0b, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x55, 0x72, 0x6c, 0x12, 0x1a, + 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x1a, 0x7c, 0x0a, 0x06, 0x47, 0x6f, + 0x74, 0x69, 0x66, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x75, 0x72, 0x6c, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x61, 0x73, 0x65, 0x55, 0x72, 0x6c, 0x12, + 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, + 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, + 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, + 0x61, 0x74, 0x65, 0x18, 0x65, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x69, 0x74, 0x6c, 0x65, + 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x1a, 0x44, 0x0a, 0x05, 0x53, 0x6c, 0x61, 0x63, + 0x6b, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x5f, 0x75, 0x72, 0x6c, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x55, + 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x1a, 0x49, + 0x0a, 0x08, 0x53, 0x68, 0x6f, 0x75, 0x74, 0x72, 0x72, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x68, + 0x6f, 0x75, 0x74, 0x72, 0x72, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x73, 0x68, 0x6f, 0x75, 0x74, 0x72, 0x72, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, + 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, 0xfc, 0x02, 0x0a, 0x09, 0x43, 0x6f, + 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x15, 0x0a, 0x11, 0x43, 0x4f, 0x4e, 0x44, 0x49, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x17, + 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x4e, 0x59, 0x5f, + 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x01, 0x12, 0x1c, 0x0a, 0x18, 0x43, 0x4f, 0x4e, 0x44, 0x49, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4e, 0x41, 0x50, 0x53, 0x48, 0x4f, 0x54, 0x5f, 0x53, 0x54, + 0x41, 0x52, 0x54, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, + 0x4f, 0x4e, 0x5f, 0x53, 0x4e, 0x41, 0x50, 0x53, 0x48, 0x4f, 0x54, 0x5f, 0x45, 0x4e, 0x44, 0x10, + 0x03, 0x12, 0x1c, 0x0a, 0x18, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, + 0x4e, 0x41, 0x50, 0x53, 0x48, 0x4f, 0x54, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, 0x12, + 0x1e, 0x0a, 0x1a, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4e, 0x41, + 0x50, 0x53, 0x48, 0x4f, 0x54, 0x5f, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x05, 0x12, + 0x1e, 0x0a, 0x1a, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4e, 0x41, + 0x50, 0x53, 0x48, 0x4f, 0x54, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x06, 0x12, + 0x19, 0x0a, 0x15, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x55, + 0x4e, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54, 0x10, 0x64, 0x12, 0x19, 0x0a, 0x15, 0x43, 0x4f, + 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x55, 0x4e, 0x45, 0x5f, 0x45, 0x52, + 0x52, 0x4f, 0x52, 0x10, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, + 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x55, 0x4e, 0x45, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, + 0x10, 0x66, 0x12, 0x1a, 0x0a, 0x15, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x43, 0x48, 0x45, 0x43, 0x4b, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54, 0x10, 0xc8, 0x01, 0x12, 0x1a, + 0x0a, 0x15, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x48, 0x45, 0x43, + 0x4b, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0xc9, 0x01, 0x12, 0x1c, 0x0a, 0x17, 0x43, 0x4f, + 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x5f, 0x53, 0x55, + 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0xca, 0x01, 0x22, 0xa9, 0x01, 0x0a, 0x07, 0x4f, 0x6e, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x12, 0x13, 0x0a, 0x0f, 0x4f, 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, + 0x5f, 0x49, 0x47, 0x4e, 0x4f, 0x52, 0x45, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4f, 0x4e, 0x5f, + 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x10, 0x01, 0x12, 0x12, + 0x0a, 0x0e, 0x4f, 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x46, 0x41, 0x54, 0x41, 0x4c, + 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x4f, 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x52, + 0x45, 0x54, 0x52, 0x59, 0x5f, 0x31, 0x4d, 0x49, 0x4e, 0x55, 0x54, 0x45, 0x10, 0x64, 0x12, 0x1c, + 0x0a, 0x18, 0x4f, 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x52, 0x45, 0x54, 0x52, 0x59, + 0x5f, 0x31, 0x30, 0x4d, 0x49, 0x4e, 0x55, 0x54, 0x45, 0x53, 0x10, 0x65, 0x12, 0x26, 0x0a, 0x22, + 0x4f, 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x52, 0x45, 0x54, 0x52, 0x59, 0x5f, 0x45, + 0x58, 0x50, 0x4f, 0x4e, 0x45, 0x4e, 0x54, 0x49, 0x41, 0x4c, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x4f, + 0x46, 0x46, 0x10, 0x67, 0x42, 0x08, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x42, + 0x0a, 0x04, 0x41, 0x75, 0x74, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x08, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, 0x65, + 0x72, 0x73, 0x22, 0x51, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x29, + 0x0a, 0x0f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x62, 0x63, 0x72, 0x79, 0x70, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0e, 0x70, 0x61, 0x73, 0x73, 0x77, + 0x6f, 0x72, 0x64, 0x42, 0x63, 0x72, 0x79, 0x70, 0x74, 0x42, 0x0a, 0x0a, 0x08, 0x70, 0x61, 0x73, + 0x73, 0x77, 0x6f, 0x72, 0x64, 0x42, 0x2c, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x72, 0x65, 0x74, 0x68, 0x67, 0x65, 0x6f, 0x72, 0x67, 0x65, + 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x72, 0x65, 0x73, 0x74, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, + 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/internal/config/validate.go b/internal/config/validate.go index 9a09562a1..1cdab899e 100644 --- a/internal/config/validate.go +++ b/internal/config/validate.go @@ -107,7 +107,7 @@ func validatePlan(plan *v1.Plan, repos map[string]*v1.Repo) error { if plan.Schedule != nil { if e := protoutil.ValidateSchedule(plan.Schedule); e != nil { - err = multierror.Append(err, fmt.Errorf("schedule: %w", e)) + err = multierror.Append(err, fmt.Errorf("backup schedule: %w", e)) } } diff --git a/internal/orchestrator/orchestrator.go b/internal/orchestrator/orchestrator.go index d536d8d57..1dba8c3e6 100644 --- a/internal/orchestrator/orchestrator.go +++ b/internal/orchestrator/orchestrator.go @@ -63,8 +63,7 @@ func NewOrchestrator(resticBin string, cfg *v1.Config, log *oplog.OpLog, logStor cfg = proto.Clone(cfg).(*v1.Config) // create the orchestrator. - var o *Orchestrator - o = &Orchestrator{ + o := &Orchestrator{ OpLog: log, config: cfg, // repoPool created with a memory store to ensure the config is updated in an atomic operation with the repo pool's config value. diff --git a/internal/orchestrator/tasks/scheduling_test.go b/internal/orchestrator/tasks/scheduling_test.go index f57c1317d..a8384e3f3 100644 --- a/internal/orchestrator/tasks/scheduling_test.go +++ b/internal/orchestrator/tasks/scheduling_test.go @@ -69,6 +69,15 @@ func TestScheduling(t *testing.T) { Clock: v1.Schedule_CLOCK_LOCAL, }, }, + { + Id: "plan-cron-utc", + Schedule: &v1.Schedule{ + Schedule: &v1.Schedule_Cron{ + Cron: "0 0 * * *", // every day at midnight + }, + Clock: v1.Schedule_CLOCK_UTC, + }, + }, { Id: "plan-cron-since-last-run", Schedule: &v1.Schedule{ @@ -85,7 +94,7 @@ func TestScheduling(t *testing.T) { Schedule: &v1.Schedule_MaxFrequencyDays{ MaxFrequencyDays: 1, }, - Clock: v1.Schedule_CLOCK_LAST_RUN_TIME, + Clock: v1.Schedule_CLOCK_LOCAL, }, }, { @@ -209,6 +218,22 @@ func TestScheduling(t *testing.T) { }, wantTime: mustParseTime(t, "1970-01-02T00:00:00-08:00"), }, + { + name: "backup schedule cron utc", + task: NewScheduledBackupTask(config.FindPlan(cfg, "plan-cron-utc")), + ops: []*v1.Operation{ + { + InstanceId: "instance1", + RepoId: "repo1", + PlanId: "plan-cron-utc", + Op: &v1.Operation_OperationBackup{ + OperationBackup: &v1.OperationBackup{}, + }, + UnixTimeEndMs: farFuture.UnixMilli(), + }, + }, + wantTime: mustParseTime(t, "1970-01-02T08:00:00Z"), + }, { name: "backup schedule cron since last run", task: NewScheduledBackupTask(config.FindPlan(cfg, "plan-cron-since-last-run")), diff --git a/internal/protoutil/schedule.go b/internal/protoutil/schedule.go index c6fe0fac0..f6155822b 100644 --- a/internal/protoutil/schedule.go +++ b/internal/protoutil/schedule.go @@ -14,21 +14,20 @@ var ErrScheduleDisabled = errors.New("never") // ResolveSchedule resolves a schedule to the next time it should run based on last execution. // note that this is different from backup behavior which is always relative to the current time. func ResolveSchedule(sched *v1.Schedule, lastRan time.Time, curTime time.Time) (time.Time, error) { - var t time.Time switch sched.GetClock() { - case v1.Schedule_CLOCK_LOCAL: + case v1.Schedule_CLOCK_DEFAULT, v1.Schedule_CLOCK_LOCAL: t = curTime.Local() case v1.Schedule_CLOCK_UTC: t = curTime.UTC() case v1.Schedule_CLOCK_LAST_RUN_TIME: t = lastRan default: - return time.Time{}, fmt.Errorf("unknown clock type: %T", s) + return time.Time{}, fmt.Errorf("unknown clock type: %v", sched.GetClock().String()) } switch s := sched.GetSchedule().(type) { - case *v1.Schedule_Disabled: + case *v1.Schedule_Disabled, nil: return time.Time{}, ErrScheduleDisabled case *v1.Schedule_MaxFrequencyDays: return t.Add(time.Duration(s.MaxFrequencyDays) * 24 * time.Hour), nil @@ -63,6 +62,8 @@ func ValidateSchedule(sched *v1.Schedule) error { if err != nil { return fmt.Errorf("invalid cron %q: %w", s.Cron, err) } + case nil: + return nil case *v1.Schedule_Disabled: if !s.Disabled { return errors.New("disabled boolean must be set to true") diff --git a/proto/v1/config.proto b/proto/v1/config.proto index 0e90b6437..aefbc310d 100644 --- a/proto/v1/config.proto +++ b/proto/v1/config.proto @@ -127,9 +127,10 @@ message Schedule { } enum Clock { - CLOCK_LOCAL = 0; - CLOCK_UTC = 1; - CLOCK_LAST_RUN_TIME = 2; + CLOCK_DEFAULT = 0; // same as CLOCK_LOCAL + CLOCK_LOCAL = 1; + CLOCK_UTC = 2; + CLOCK_LAST_RUN_TIME = 3; } Clock clock = 5 [json_name="clock"]; // clock to use for scheduling. diff --git a/webui/gen/ts/v1/config_pb.ts b/webui/gen/ts/v1/config_pb.ts index a78e300d8..634df94ba 100644 --- a/webui/gen/ts/v1/config_pb.ts +++ b/webui/gen/ts/v1/config_pb.ts @@ -855,7 +855,7 @@ export class Schedule extends Message { * * @generated from field: v1.Schedule.Clock clock = 5; */ - clock = Schedule_Clock.LOCAL; + clock = Schedule_Clock.DEFAULT; constructor(data?: PartialMessage) { super(); @@ -894,25 +894,33 @@ export class Schedule extends Message { */ export enum Schedule_Clock { /** - * @generated from enum value: CLOCK_LOCAL = 0; + * same as CLOCK_LOCAL + * + * @generated from enum value: CLOCK_DEFAULT = 0; + */ + DEFAULT = 0, + + /** + * @generated from enum value: CLOCK_LOCAL = 1; */ - LOCAL = 0, + LOCAL = 1, /** - * @generated from enum value: CLOCK_UTC = 1; + * @generated from enum value: CLOCK_UTC = 2; */ - UTC = 1, + UTC = 2, /** - * @generated from enum value: CLOCK_LAST_RUN_TIME = 2; + * @generated from enum value: CLOCK_LAST_RUN_TIME = 3; */ - LAST_RUN_TIME = 2, + LAST_RUN_TIME = 3, } // Retrieve enum metadata with: proto3.getEnumType(Schedule_Clock) proto3.util.setEnumType(Schedule_Clock, "v1.Schedule.Clock", [ - { no: 0, name: "CLOCK_LOCAL" }, - { no: 1, name: "CLOCK_UTC" }, - { no: 2, name: "CLOCK_LAST_RUN_TIME" }, + { no: 0, name: "CLOCK_DEFAULT" }, + { no: 1, name: "CLOCK_LOCAL" }, + { no: 2, name: "CLOCK_UTC" }, + { no: 3, name: "CLOCK_LAST_RUN_TIME" }, ]); /** diff --git a/webui/src/components/ScheduleFormItem.tsx b/webui/src/components/ScheduleFormItem.tsx index 390a8eb95..0f10aaf18 100644 --- a/webui/src/components/ScheduleFormItem.tsx +++ b/webui/src/components/ScheduleFormItem.tsx @@ -1,7 +1,16 @@ -import { Checkbox, Form, InputNumber, Radio, Row, Tooltip } from "antd"; +import { + Checkbox, + Form, + InputNumber, + Radio, + Row, + Tooltip, + Typography, +} from "antd"; import React from "react"; import Cron, { CronType, PeriodType } from "react-js-cron"; import { Schedule_Clock } from "../../gen/ts/v1/config_pb"; +import { proto3 } from "@bufbuild/protobuf"; interface ScheduleDefaults { maxFrequencyDays: number; @@ -55,7 +64,12 @@ export const ScheduleFormItem = ({ const form = Form.useFormInstance(); const schedule = Form.useWatch(name, { form, preserve: true }) as any; - defaults = defaults || ScheduleDefaultsInfrequent; + if (schedule !== undefined && schedule.clock === undefined) { + form.setFieldValue( + name.concat("clock"), + clockEnumValueToString(defaults.clock) + ); + } const determineMode = (): SchedulingMode => { if (!schedule) { @@ -180,35 +194,64 @@ export const ScheduleFormItem = ({ } }} > - {(!allowedModes || allowedModes.includes("disabled")) && ( - - - Disabled - - - )} - {(!allowedModes || allowedModes.includes("maxFrequencyHours")) && ( - - - Interval Hours - - - )} - {(!allowedModes || allowedModes.includes("maxFrequencyDays")) && ( - - - Interval Days - - - )} - {(!allowedModes || allowedModes.includes("cron")) && ( - - - Startup Relative Cron - - - )} + + + Disabled + + + + + Interval Hours + + + + + Interval Days + + + + + Cron + + + + Clock for schedule:{" "} + + + Clock provides the time that the schedule is evaluated relative + to. +
    +
  • Local - current time in the local timezone.
  • +
  • UTC - current time in the UTC timezone.
  • +
  • + Last Run Time - relative to the last time the task ran. Good + for devices that aren't always powered on e.g. laptops. +
  • +
+ + } + > + + + + Local + + + UTC + + + Last Run Time + + + +
@@ -217,3 +260,6 @@ export const ScheduleFormItem = ({ ); }; + +const clockEnumValueToString = (clock: Schedule_Clock) => + proto3.getEnumType(Schedule_Clock).findNumber(clock)!.name; diff --git a/webui/src/views/AddRepoModal.tsx b/webui/src/views/AddRepoModal.tsx index 99bbb70b7..d623c1a30 100644 --- a/webui/src/views/AddRepoModal.tsx +++ b/webui/src/views/AddRepoModal.tsx @@ -37,7 +37,11 @@ import { import { ConfirmButton } from "../components/SpinButton"; import { useConfig } from "../components/ConfigProvider"; import Cron from "react-js-cron"; -import { ScheduleFormItem } from "../components/ScheduleFormItem"; +import { + ScheduleDefaultsDaily, + ScheduleDefaultsInfrequent, + ScheduleFormItem, +} from "../components/ScheduleFormItem"; import { proto3 } from "@bufbuild/protobuf"; import { isWindows } from "../state/buildcfg"; @@ -478,12 +482,7 @@ export const AddRepoModal = ({ template }: { template: Repo | null }) => { @@ -522,12 +521,7 @@ export const AddRepoModal = ({ template }: { template: Repo | null }) => {