From d0b8a855ea9dc1f61a6eeb6ecda88eebee27c5b0 Mon Sep 17 00:00:00 2001 From: Rohit Rajsurya Prasad Date: Thu, 7 Nov 2024 16:51:14 +0530 Subject: [PATCH] adding start & end time --- api/checkers/v1/types.pulsar.go | 170 +++++++++++++++++++++++++++----- proto/checkers/v1/types.proto | 2 + x/checkers/keeper/msg_server.go | 10 ++ x/checkers/types/types.pb.go | 128 ++++++++++++++++++------ 4 files changed, 255 insertions(+), 55 deletions(-) diff --git a/api/checkers/v1/types.pulsar.go b/api/checkers/v1/types.pulsar.go index 72268d5..b74dcfe 100644 --- a/api/checkers/v1/types.pulsar.go +++ b/api/checkers/v1/types.pulsar.go @@ -944,11 +944,13 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { } var ( - md_StoredGame protoreflect.MessageDescriptor - fd_StoredGame_board protoreflect.FieldDescriptor - fd_StoredGame_turn protoreflect.FieldDescriptor - fd_StoredGame_black protoreflect.FieldDescriptor - fd_StoredGame_red protoreflect.FieldDescriptor + md_StoredGame protoreflect.MessageDescriptor + fd_StoredGame_board protoreflect.FieldDescriptor + fd_StoredGame_turn protoreflect.FieldDescriptor + fd_StoredGame_black protoreflect.FieldDescriptor + fd_StoredGame_red protoreflect.FieldDescriptor + fd_StoredGame_start_time protoreflect.FieldDescriptor + fd_StoredGame_end_time protoreflect.FieldDescriptor ) func init() { @@ -958,6 +960,8 @@ func init() { fd_StoredGame_turn = md_StoredGame.Fields().ByName("turn") fd_StoredGame_black = md_StoredGame.Fields().ByName("black") fd_StoredGame_red = md_StoredGame.Fields().ByName("red") + fd_StoredGame_start_time = md_StoredGame.Fields().ByName("start_time") + fd_StoredGame_end_time = md_StoredGame.Fields().ByName("end_time") } var _ protoreflect.Message = (*fastReflection_StoredGame)(nil) @@ -1049,6 +1053,18 @@ func (x *fastReflection_StoredGame) Range(f func(protoreflect.FieldDescriptor, p return } } + if x.StartTime != int64(0) { + value := protoreflect.ValueOfInt64(x.StartTime) + if !f(fd_StoredGame_start_time, value) { + return + } + } + if x.EndTime != int64(0) { + value := protoreflect.ValueOfInt64(x.EndTime) + if !f(fd_StoredGame_end_time, value) { + return + } + } } // Has reports whether a field is populated. @@ -1072,6 +1088,10 @@ func (x *fastReflection_StoredGame) Has(fd protoreflect.FieldDescriptor) bool { return x.Black != "" case "checkers.v1.StoredGame.red": return x.Red != "" + case "checkers.v1.StoredGame.start_time": + return x.StartTime != int64(0) + case "checkers.v1.StoredGame.end_time": + return x.EndTime != int64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: checkers.v1.StoredGame")) @@ -1096,6 +1116,10 @@ func (x *fastReflection_StoredGame) Clear(fd protoreflect.FieldDescriptor) { x.Black = "" case "checkers.v1.StoredGame.red": x.Red = "" + case "checkers.v1.StoredGame.start_time": + x.StartTime = int64(0) + case "checkers.v1.StoredGame.end_time": + x.EndTime = int64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: checkers.v1.StoredGame")) @@ -1124,6 +1148,12 @@ func (x *fastReflection_StoredGame) Get(descriptor protoreflect.FieldDescriptor) case "checkers.v1.StoredGame.red": value := x.Red return protoreflect.ValueOfString(value) + case "checkers.v1.StoredGame.start_time": + value := x.StartTime + return protoreflect.ValueOfInt64(value) + case "checkers.v1.StoredGame.end_time": + value := x.EndTime + return protoreflect.ValueOfInt64(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: checkers.v1.StoredGame")) @@ -1152,6 +1182,10 @@ func (x *fastReflection_StoredGame) Set(fd protoreflect.FieldDescriptor, value p x.Black = value.Interface().(string) case "checkers.v1.StoredGame.red": x.Red = value.Interface().(string) + case "checkers.v1.StoredGame.start_time": + x.StartTime = value.Int() + case "checkers.v1.StoredGame.end_time": + x.EndTime = value.Int() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: checkers.v1.StoredGame")) @@ -1180,6 +1214,10 @@ func (x *fastReflection_StoredGame) Mutable(fd protoreflect.FieldDescriptor) pro panic(fmt.Errorf("field black of message checkers.v1.StoredGame is not mutable")) case "checkers.v1.StoredGame.red": panic(fmt.Errorf("field red of message checkers.v1.StoredGame is not mutable")) + case "checkers.v1.StoredGame.start_time": + panic(fmt.Errorf("field start_time of message checkers.v1.StoredGame is not mutable")) + case "checkers.v1.StoredGame.end_time": + panic(fmt.Errorf("field end_time of message checkers.v1.StoredGame is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: checkers.v1.StoredGame")) @@ -1201,6 +1239,10 @@ func (x *fastReflection_StoredGame) NewField(fd protoreflect.FieldDescriptor) pr return protoreflect.ValueOfString("") case "checkers.v1.StoredGame.red": return protoreflect.ValueOfString("") + case "checkers.v1.StoredGame.start_time": + return protoreflect.ValueOfInt64(int64(0)) + case "checkers.v1.StoredGame.end_time": + return protoreflect.ValueOfInt64(int64(0)) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: checkers.v1.StoredGame")) @@ -1286,6 +1328,12 @@ func (x *fastReflection_StoredGame) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + if x.StartTime != 0 { + n += 1 + runtime.Sov(uint64(x.StartTime)) + } + if x.EndTime != 0 { + n += 1 + runtime.Sov(uint64(x.EndTime)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -1315,6 +1363,16 @@ func (x *fastReflection_StoredGame) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.EndTime != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.EndTime)) + i-- + dAtA[i] = 0x38 + } + if x.StartTime != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.StartTime)) + i-- + dAtA[i] = 0x30 + } if len(x.Red) > 0 { i -= len(x.Red) copy(dAtA[i:], x.Red) @@ -1520,6 +1578,44 @@ func (x *fastReflection_StoredGame) ProtoMethods() *protoiface.Methods { } x.Red = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 6: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) + } + x.StartTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.StartTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field EndTime", wireType) + } + x.EndTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.EndTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -2144,10 +2240,12 @@ type StoredGame struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Board string `protobuf:"bytes,1,opt,name=board,proto3" json:"board,omitempty"` - Turn string `protobuf:"bytes,2,opt,name=turn,proto3" json:"turn,omitempty"` - Black string `protobuf:"bytes,3,opt,name=black,proto3" json:"black,omitempty"` - Red string `protobuf:"bytes,4,opt,name=red,proto3" json:"red,omitempty"` + Board string `protobuf:"bytes,1,opt,name=board,proto3" json:"board,omitempty"` + Turn string `protobuf:"bytes,2,opt,name=turn,proto3" json:"turn,omitempty"` + Black string `protobuf:"bytes,3,opt,name=black,proto3" json:"black,omitempty"` + Red string `protobuf:"bytes,4,opt,name=red,proto3" json:"red,omitempty"` + StartTime int64 `protobuf:"varint,6,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` + EndTime int64 `protobuf:"varint,7,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` } func (x *StoredGame) Reset() { @@ -2198,6 +2296,20 @@ func (x *StoredGame) GetRed() string { return "" } +func (x *StoredGame) GetStartTime() int64 { + if x != nil { + return x.StartTime + } + return 0 +} + +func (x *StoredGame) GetEndTime() int64 { + if x != nil { + return x.EndTime + } + return 0 +} + type IndexedStoredGame struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2260,7 +2372,7 @@ var file_checkers_v1_types_proto_rawDesc = []byte{ 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x64, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x47, 0x61, 0x6d, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x15, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x64, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x47, 0x61, 0x6d, 0x65, 0x4c, 0x69, 0x73, - 0x74, 0x22, 0x92, 0x01, 0x0a, 0x0a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x47, 0x61, 0x6d, 0x65, + 0x74, 0x22, 0xcc, 0x01, 0x0a, 0x0a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x47, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x75, 0x72, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x75, 0x72, 0x6e, 0x12, 0x2e, 0x0a, 0x05, 0x62, 0x6c, @@ -2269,23 +2381,27 @@ var file_checkers_v1_types_proto_rawDesc = []byte{ 0x69, 0x6e, 0x67, 0x52, 0x05, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x12, 0x2a, 0x0a, 0x03, 0x72, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x52, 0x03, 0x72, 0x65, 0x64, 0x22, 0x68, 0x0a, 0x11, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, - 0x64, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x47, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, - 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, - 0x78, 0x12, 0x3d, 0x0a, 0x0a, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x47, 0x61, 0x6d, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x72, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x47, 0x61, 0x6d, 0x65, 0x42, 0x04, - 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0a, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x47, 0x61, 0x6d, 0x65, - 0x42, 0x94, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x72, - 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x54, 0x79, 0x70, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x28, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2d, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x61, - 0x6c, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x72, 0x73, 0x2f, 0x76, - 0x31, 0x3b, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x72, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, - 0x58, 0x58, 0xaa, 0x02, 0x0b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x72, 0x73, 0x2e, 0x56, 0x31, - 0xca, 0x02, 0x0b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x72, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, - 0x17, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x72, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x65, 0x72, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x67, 0x52, 0x03, 0x72, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, + 0x22, 0x68, 0x0a, 0x11, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x64, 0x53, 0x74, 0x6f, 0x72, 0x65, + 0x64, 0x47, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x3d, 0x0a, 0x0a, 0x73, + 0x74, 0x6f, 0x72, 0x65, 0x64, 0x47, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x72, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, + 0x6f, 0x72, 0x65, 0x64, 0x47, 0x61, 0x6d, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0a, + 0x73, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x47, 0x61, 0x6d, 0x65, 0x42, 0x94, 0x01, 0x0a, 0x0f, 0x63, + 0x6f, 0x6d, 0x2e, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x72, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0a, + 0x54, 0x79, 0x70, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x63, 0x68, + 0x61, 0x69, 0x6e, 0x2d, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x63, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x72, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x68, 0x65, 0x63, + 0x6b, 0x65, 0x72, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x58, 0x58, 0xaa, 0x02, 0x0b, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x65, 0x72, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0b, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x65, 0x72, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x17, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x65, 0x72, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x72, 0x73, 0x3a, 0x3a, 0x56, + 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/checkers/v1/types.proto b/proto/checkers/v1/types.proto index ef05bff..c189667 100644 --- a/proto/checkers/v1/types.proto +++ b/proto/checkers/v1/types.proto @@ -20,6 +20,8 @@ message StoredGame { string turn = 2; string black = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; string red = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + int64 start_time = 6; + int64 end_time = 7; } message IndexedStoredGame { diff --git a/x/checkers/keeper/msg_server.go b/x/checkers/keeper/msg_server.go index 9595894..15e994a 100644 --- a/x/checkers/keeper/msg_server.go +++ b/x/checkers/keeper/msg_server.go @@ -8,6 +8,8 @@ import ( "cosmossdk.io/collections" "chain-minimal/x/checkers/types" "chain-minimal/x/checkers/rules" + sdk "github.com/cosmos/cosmos-sdk/types" + ) type msgServer struct { @@ -29,13 +31,21 @@ func (ms msgServer) CheckersCreateGm(ctx context.Context, msg *types.ReqCheckers if _, err := ms.k.StoredGames.Get(ctx, msg.Index); err == nil || errors.Is(err, collections.ErrEncoding) { return nil, fmt.Errorf("game already exists at index: %s", msg.Index) } + newBoard := rules.New() + sdkCtx := sdk.UnwrapSDKContext(ctx) + blockTime := sdkCtx.HeaderInfo().Time + storedGame := types.StoredGame{ Board: newBoard.String(), Turn: rules.PieceStrings[newBoard.Turn], Black: msg.Black, Red: msg.Red, + StartTime: blockTime.Unix(), + EndTime: 0, + + } if err := storedGame.Validate(); err != nil { return nil, err diff --git a/x/checkers/types/types.pb.go b/x/checkers/types/types.pb.go index 6b991e8..a3c9b2a 100644 --- a/x/checkers/types/types.pb.go +++ b/x/checkers/types/types.pb.go @@ -116,10 +116,12 @@ func (m *GenesisState) GetIndexedStoredGameList() []IndexedStoredGame { } type StoredGame struct { - Board string `protobuf:"bytes,1,opt,name=board,proto3" json:"board,omitempty"` - Turn string `protobuf:"bytes,2,opt,name=turn,proto3" json:"turn,omitempty"` - Black string `protobuf:"bytes,3,opt,name=black,proto3" json:"black,omitempty"` - Red string `protobuf:"bytes,4,opt,name=red,proto3" json:"red,omitempty"` + Board string `protobuf:"bytes,1,opt,name=board,proto3" json:"board,omitempty"` + Turn string `protobuf:"bytes,2,opt,name=turn,proto3" json:"turn,omitempty"` + Black string `protobuf:"bytes,3,opt,name=black,proto3" json:"black,omitempty"` + Red string `protobuf:"bytes,4,opt,name=red,proto3" json:"red,omitempty"` + StartTime int64 `protobuf:"varint,6,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` + EndTime int64 `protobuf:"varint,7,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` } func (m *StoredGame) Reset() { *m = StoredGame{} } @@ -183,6 +185,20 @@ func (m *StoredGame) GetRed() string { return "" } +func (m *StoredGame) GetStartTime() int64 { + if m != nil { + return m.StartTime + } + return 0 +} + +func (m *StoredGame) GetEndTime() int64 { + if m != nil { + return m.EndTime + } + return 0 +} + type IndexedStoredGame struct { Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` StoredGame StoredGame `protobuf:"bytes,2,opt,name=storedGame,proto3" json:"storedGame"` @@ -245,30 +261,32 @@ func init() { func init() { proto.RegisterFile("checkers/v1/types.proto", fileDescriptor_a83873e75c08dea2) } var fileDescriptor_a83873e75c08dea2 = []byte{ - // 356 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xbf, 0x4e, 0x02, 0x41, - 0x10, 0xc6, 0xef, 0xf8, 0x17, 0x9d, 0xb3, 0x71, 0xc5, 0x70, 0x52, 0xac, 0xe4, 0x2a, 0x62, 0xc2, - 0x5d, 0xc0, 0xc6, 0xc6, 0x42, 0x1a, 0x62, 0x62, 0x61, 0xa0, 0xa3, 0x31, 0xcb, 0xdd, 0x06, 0x36, - 0x70, 0xb7, 0x64, 0x77, 0x25, 0xf8, 0x16, 0xc6, 0xde, 0xb7, 0xf0, 0x21, 0x28, 0x89, 0x95, 0x95, - 0x31, 0xf0, 0x22, 0xe6, 0x76, 0x01, 0x41, 0x4c, 0xec, 0x76, 0xbe, 0xf9, 0xcd, 0xdc, 0x37, 0x73, - 0x03, 0xa5, 0x70, 0x40, 0xc3, 0x21, 0x15, 0x32, 0x98, 0xd4, 0x03, 0xf5, 0x34, 0xa6, 0xd2, 0x1f, - 0x0b, 0xae, 0x38, 0x72, 0xd6, 0x09, 0x7f, 0x52, 0x2f, 0x9f, 0x85, 0x5c, 0xc6, 0x5c, 0x3e, 0xe8, - 0x54, 0x60, 0x02, 0xc3, 0x95, 0x8b, 0x7d, 0xde, 0xe7, 0x46, 0x4f, 0x5f, 0x46, 0xf5, 0x0e, 0xa0, - 0x70, 0x4f, 0x04, 0x89, 0xa5, 0xf7, 0x6a, 0xc3, 0x51, 0x8b, 0x26, 0x54, 0x32, 0xd9, 0x51, 0x44, - 0x51, 0x54, 0x87, 0xc2, 0x58, 0xa7, 0x5c, 0xbb, 0x62, 0x57, 0x9d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4c, 0x7a, 0x05, 0xfd, 0xa7, 0x2f, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xbe, 0xe7, 0x32, 0x16, - 0x42, 0x02, 0x00, 0x00, + // 396 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0xb1, 0x8e, 0x13, 0x31, + 0x10, 0x5d, 0xdf, 0xe6, 0xf6, 0xee, 0xbc, 0x34, 0x98, 0xa0, 0xdb, 0x3b, 0x09, 0x13, 0x6d, 0x15, + 0x21, 0xdd, 0xae, 0x12, 0x1a, 0x1a, 0x0a, 0xd2, 0x9c, 0x90, 0x28, 0xd0, 0x86, 0x2a, 0x4d, 0xe4, + 0xac, 0x47, 0x89, 0x95, 0xac, 0x1d, 0xd9, 0x26, 0x0a, 0x7f, 0xc1, 0x0f, 0xf0, 0x17, 0x7c, 0x44, + 0x0a, 0x8a, 0x88, 0x8a, 0x0a, 0xa1, 0xe4, 0x47, 0xd0, 0xda, 0x09, 0x24, 0x04, 0xe9, 0x3a, 0xcf, + 0x7b, 0x6f, 0x66, 0xfc, 0x9e, 0x06, 0x5f, 0x97, 0x13, 0x28, 0xa7, 0xa0, 0x4d, 0xbe, 0xe8, 0xe4, + 0xf6, 0xd3, 0x1c, 0x4c, 0x36, 0xd7, 0xca, 0x2a, 0x12, 0xef, 0x89, 0x6c, 0xd1, 0xb9, 0xbd, 0x29, + 0x95, 0xa9, 0x94, 0x19, 0x3a, 0x2a, 0xf7, 0x85, 0xd7, 0xdd, 0x36, 0xc7, 0x6a, 0xac, 0x3c, 0x5e, + 0xbf, 0x3c, 0x9a, 0x5e, 0xe2, 0xe8, 0x3d, 0xd3, 0xac, 0x32, 0xe9, 0x17, 0x84, 0x1f, 0xdd, 0x83, + 0x04, 0x23, 0x4c, 0xdf, 0x32, 0x0b, 0xa4, 0x83, 0xa3, 0xb9, 0xa3, 0x12, 0xd4, 0x42, 0xed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 0xa2, 0xf5, 0x86, 0xa2, 0x5f, 0x1b, 0x8a, 0x3e, 0x6f, 0x69, + 0xb0, 0xde, 0xd2, 0xe0, 0xc7, 0x96, 0x06, 0x03, 0x5a, 0x4e, 0x98, 0x90, 0x77, 0x95, 0x90, 0xa2, + 0x62, 0xb3, 0x7c, 0x99, 0xff, 0xb9, 0x31, 0x77, 0x60, 0xa3, 0xc8, 0xdd, 0xc8, 0xcb, 0xdf, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x9d, 0x12, 0x55, 0x77, 0x7c, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -361,6 +379,16 @@ func (m *StoredGame) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.EndTime != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.EndTime)) + i-- + dAtA[i] = 0x38 + } + if m.StartTime != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.StartTime)) + i-- + dAtA[i] = 0x30 + } if len(m.Red) > 0 { i -= len(m.Red) copy(dAtA[i:], m.Red) @@ -491,6 +519,12 @@ func (m *StoredGame) Size() (n int) { if l > 0 { n += 1 + l + sovTypes(uint64(l)) } + if m.StartTime != 0 { + n += 1 + sovTypes(uint64(m.StartTime)) + } + if m.EndTime != 0 { + n += 1 + sovTypes(uint64(m.EndTime)) + } return n } @@ -839,6 +873,44 @@ func (m *StoredGame) Unmarshal(dAtA []byte) error { } m.Red = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) + } + m.StartTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EndTime", wireType) + } + m.EndTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EndTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:])