Add current tick information to the server-status

This commit is contained in:
Marc Di Luzio 2020-07-07 18:40:38 +01:00
parent 1412579c6c
commit 3ba7652c74
5 changed files with 85 additions and 64 deletions

View file

@ -14,7 +14,8 @@ func (s *Server) ServerStatus(context.Context, *rove.ServerStatusRequest) (*rove
response := &rove.ServerStatusResponse{ response := &rove.ServerStatusResponse{
Ready: true, Ready: true,
Version: version.Version, Version: version.Version,
Tick: int32(s.tick), TickRate: int32(s.minutesPerTick),
CurrentTick: int32(s.world.CurrentTicks),
} }
// TODO: Verify the accountant is up and ready too // TODO: Verify the accountant is up and ready too

View file

@ -175,7 +175,8 @@ func InnerMain(command string, args ...string) error {
default: default:
fmt.Printf("Ready: %t\n", response.Ready) fmt.Printf("Ready: %t\n", response.Ready)
fmt.Printf("Version: %s\n", response.Version) fmt.Printf("Version: %s\n", response.Version)
fmt.Printf("Tick: %d\n", response.Tick) fmt.Printf("Tick Rate: %d\n", response.TickRate)
fmt.Printf("Current Tick: %d\n", response.CurrentTick)
fmt.Printf("Next Tick: %s\n", response.NextTick) fmt.Printf("Next Tick: %s\n", response.NextTick)
} }

View file

@ -670,14 +670,16 @@ type ServerStatusResponse struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// The time the next tick will occur // The version of the server in v{major}.{minor}-{delta}-{sha} form
NextTick string `protobuf:"bytes,1,opt,name=next_tick,json=nextTick,proto3" json:"next_tick,omitempty"` Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
// Whether the server is ready to accept requests // Whether the server is ready to accept requests
Ready bool `protobuf:"varint,2,opt,name=ready,proto3" json:"ready,omitempty"` Ready bool `protobuf:"varint,2,opt,name=ready,proto3" json:"ready,omitempty"`
// The tick rate of the server in minutes (how many minutes per tick) // The tick rate of the server in minutes (how many minutes per tick)
Tick int32 `protobuf:"varint,3,opt,name=tick,proto3" json:"tick,omitempty"` TickRate int32 `protobuf:"varint,3,opt,name=tickRate,proto3" json:"tickRate,omitempty"`
// The version of the server in v{major}.{minor}-{delta}-{sha} form // The current tick of the server
Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` CurrentTick int32 `protobuf:"varint,4,opt,name=currentTick,proto3" json:"currentTick,omitempty"`
// The time the next tick will occur
NextTick string `protobuf:"bytes,5,opt,name=next_tick,json=nextTick,proto3" json:"next_tick,omitempty"`
} }
func (x *ServerStatusResponse) Reset() { func (x *ServerStatusResponse) Reset() {
@ -712,9 +714,9 @@ func (*ServerStatusResponse) Descriptor() ([]byte, []int) {
return file_rove_rove_proto_rawDescGZIP(), []int{11} return file_rove_rove_proto_rawDescGZIP(), []int{11}
} }
func (x *ServerStatusResponse) GetNextTick() string { func (x *ServerStatusResponse) GetVersion() string {
if x != nil { if x != nil {
return x.NextTick return x.Version
} }
return "" return ""
} }
@ -726,16 +728,23 @@ func (x *ServerStatusResponse) GetReady() bool {
return false return false
} }
func (x *ServerStatusResponse) GetTick() int32 { func (x *ServerStatusResponse) GetTickRate() int32 {
if x != nil { if x != nil {
return x.Tick return x.TickRate
} }
return 0 return 0
} }
func (x *ServerStatusResponse) GetVersion() string { func (x *ServerStatusResponse) GetCurrentTick() int32 {
if x != nil { if x != nil {
return x.Version return x.CurrentTick
}
return 0
}
func (x *ServerStatusResponse) GetNextTick() string {
if x != nil {
return x.NextTick
} }
return "" return ""
} }
@ -855,45 +864,47 @@ var file_rove_rove_proto_rawDesc = []byte{
0x32, 0x0d, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x32, 0x0d, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52,
0x0e, 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x22, 0x0e, 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x22,
0x15, 0x0a, 0x13, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x15, 0x0a, 0x13, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x77, 0x0a, 0x14, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xa1, 0x01, 0x0a, 0x14, 0x53, 0x65, 0x72, 0x76, 0x65,
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x0a, 0x09, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x74, 0x69, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x09, 0x52, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x54, 0x69, 0x63, 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x65, 0x61,
0x65, 0x61, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x72, 0x65, 0x61, 0x64, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x72, 0x65, 0x61, 0x64, 0x79, 0x12,
0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x1a, 0x0a, 0x08, 0x74, 0x69, 0x63, 0x6b, 0x52, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
0x04, 0x74, 0x69, 0x63, 0x6b, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x05, 0x52, 0x08, 0x74, 0x69, 0x63, 0x6b, 0x52, 0x61, 0x74, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x63,
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x63, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05,
0x24, 0x0a, 0x06, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x52, 0x0b, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x63, 0x6b, 0x12, 0x1b, 0x0a,
0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x09, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x74, 0x69, 0x63, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
0x28, 0x05, 0x52, 0x01, 0x79, 0x32, 0x91, 0x03, 0x0a, 0x04, 0x52, 0x6f, 0x76, 0x65, 0x12, 0x5d, 0x52, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x54, 0x69, 0x63, 0x6b, 0x22, 0x24, 0x0a, 0x06, 0x56, 0x65,
0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79,
0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x32, 0x91, 0x03, 0x0a, 0x04, 0x52, 0x6f, 0x76, 0x65, 0x12, 0x5d, 0x0a, 0x0c, 0x53, 0x65, 0x72,
0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19, 0x2e, 0x72, 0x6f, 0x76, 0x65,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71,
0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x4f, 0x0a, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76,
0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65,
0x1a, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x72, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x4f, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x73, 0x74, 0x65, 0x72, 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x52, 0x65, 0x67, 0x69,
0x22, 0x09, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x3a, 0x01, 0x2a, 0x12, 0x4b, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x6f,
0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x76, 0x65, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x6e, 0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x22, 0x09, 0x2f, 0x72, 0x65,
0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x3a, 0x01, 0x2a, 0x12, 0x4b, 0x0a, 0x07, 0x43, 0x6f, 0x6d,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x22, 0x08, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d,
0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x3a, 0x01, 0x2a, 0x12, 0x43, 0x0a, 0x05, 0x52, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x72, 0x6f, 0x76,
0x61, 0x64, 0x61, 0x72, 0x12, 0x12, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x65, 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x22, 0x08, 0x2f, 0x63, 0x6f, 0x6d, 0x6d,
0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x11, 0x82, 0x61, 0x6e, 0x64, 0x3a, 0x01, 0x2a, 0x12, 0x43, 0x0a, 0x05, 0x52, 0x61, 0x64, 0x61, 0x72, 0x12,
0xd3, 0xe4, 0x93, 0x02, 0x0b, 0x22, 0x06, 0x2f, 0x72, 0x61, 0x64, 0x61, 0x72, 0x3a, 0x01, 0x2a, 0x12, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x71, 0x75,
0x12, 0x47, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x13, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72,
0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x11, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b,
0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x22, 0x06, 0x2f, 0x72, 0x61, 0x64, 0x61, 0x72, 0x3a, 0x01, 0x2a, 0x12, 0x47, 0x0a, 0x06, 0x53,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x22, 0x07, 0x2f, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x13, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x53, 0x74, 0x61,
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x3a, 0x01, 0x2a, 0x42, 0x21, 0x5a, 0x1f, 0x67, 0x69, 0x74, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x6f, 0x76,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x64, 0x69, 0x6c, 0x75, 0x7a, 0x2f, 0x72, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x6f, 0x76, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x62, 0x06, 0x70, 0x72, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x22, 0x07, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75,
0x6f, 0x74, 0x6f, 0x33, 0x73, 0x3a, 0x01, 0x2a, 0x42, 0x21, 0x5a, 0x1f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x6f, 0x6d, 0x2f, 0x6d, 0x64, 0x69, 0x6c, 0x75, 0x7a, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x2f, 0x70,
0x6b, 0x67, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View file

@ -285,23 +285,28 @@
"roveServerStatusResponse": { "roveServerStatusResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"next_tick": { "version": {
"type": "string", "type": "string",
"title": "The time the next tick will occur" "title": "The version of the server in v{major}.{minor}-{delta}-{sha} form"
}, },
"ready": { "ready": {
"type": "boolean", "type": "boolean",
"format": "boolean", "format": "boolean",
"title": "Whether the server is ready to accept requests" "title": "Whether the server is ready to accept requests"
}, },
"tick": { "tickRate": {
"type": "integer", "type": "integer",
"format": "int32", "format": "int32",
"title": "The tick rate of the server in minutes (how many minutes per tick)" "title": "The tick rate of the server in minutes (how many minutes per tick)"
}, },
"version": { "currentTick": {
"type": "integer",
"format": "int32",
"title": "The current tick of the server"
},
"next_tick": {
"type": "string", "type": "string",
"title": "The version of the server in v{major}.{minor}-{delta}-{sha} form" "title": "The time the next tick will occur"
} }
} }
}, },

View file

@ -156,17 +156,20 @@ message StatusResponse {
message ServerStatusRequest {} message ServerStatusRequest {}
message ServerStatusResponse { message ServerStatusResponse {
// The time the next tick will occur // The version of the server in v{major}.{minor}-{delta}-{sha} form
string next_tick = 1; string version = 1;
// Whether the server is ready to accept requests // Whether the server is ready to accept requests
bool ready = 2; bool ready = 2;
// The tick rate of the server in minutes (how many minutes per tick) // The tick rate of the server in minutes (how many minutes per tick)
int32 tick = 3; int32 tickRate = 3;
// The version of the server in v{major}.{minor}-{delta}-{sha} form // The current tick of the server
string version = 4; int32 currentTick = 4;
// The time the next tick will occur
string next_tick = 5;
} }
message Vector { message Vector {