增加清理老登录SESSION API

This commit is contained in:
GoEdgeLab
2024-05-03 12:09:45 +08:00
parent 3d5b5603bd
commit f5e49d2b29
4 changed files with 191 additions and 44 deletions

View File

@@ -3295,7 +3295,10 @@
"responseMessageName": "RPCSuccess",
"code": "rpc updateHTTPWebGlobalPagesEnabled(UpdateHTTPWebGlobalPagesEnabledRequest) returns (RPCSuccess);",
"doc": "更改系统自定义页面启用状态",
"roles": [],
"roles": [
"admin",
"user"
],
"isDeprecated": false
},
{
@@ -4399,6 +4402,17 @@
"admin"
],
"isDeprecated": false
},
{
"name": "clearOldLoginSessions",
"requestMessageName": "ClearOldLoginSessionsRequest",
"responseMessageName": "RPCSuccess",
"code": "rpc clearOldLoginSessions(ClearOldLoginSessionsRequest) returns (RPCSuccess);",
"doc": "清理老的SESSION",
"roles": [
"admin"
],
"isDeprecated": false
}
],
"filename": "service_login_session.proto",
@@ -14458,6 +14472,11 @@
"code": "message CleanLogsPermanentlyRequest {\n\tint32 days = 1;\n\tbool clearAll = 2;\n}",
"doc": "清理"
},
{
"name": "ClearOldLoginSessionsRequest",
"code": "message ClearOldLoginSessionsRequest {\n\tstring sid = 1; // 当前SESSION ID\n\tstring ip = 2; // 当前操作IP\n}",
"doc": "清理老的SESSION"
},
{
"name": "ClientAgent",
"code": "message ClientAgent {\n\tint64 id = 1;\n\tstring name = 2;\n\tstring code = 3;\n\tstring description = 4;\n\tint64 countIPs = 5;\n}",
@@ -16395,7 +16414,7 @@
},
{
"name": "DeleteLoginSessionRequest",
"code": "message DeleteLoginSessionRequest {\n\tstring sid = 1;\n}",
"code": "message DeleteLoginSessionRequest {\n\tstring sid = 1; // SESSION ID\n}",
"doc": "删除SESSION"
},
{
@@ -19490,12 +19509,12 @@
},
{
"name": "FindLoginSessionRequest",
"code": "message FindLoginSessionRequest {\n\tstring sid = 1;\n}",
"code": "message FindLoginSessionRequest {\n\tstring sid = 1; // SESSION ID\n}",
"doc": "查找SESSION"
},
{
"name": "FindLoginSessionResponse",
"code": "message FindLoginSessionResponse {\n\tLoginSession loginSession = 1;\n}",
"code": "message FindLoginSessionResponse {\n\tLoginSession loginSession = 1; // SESSION信息\n}",
"doc": ""
},
{
@@ -23815,7 +23834,7 @@
},
{
"name": "WriteLoginSessionValueRequest",
"code": "message WriteLoginSessionValueRequest {\n\tstring sid = 1;\n\tstring key = 2;\n\tstring value = 3;\n}",
"code": "message WriteLoginSessionValueRequest {\n\tstring sid = 1; // SESSION ID\n\tstring key = 2; // 数据Key\n\tstring value = 3; // 数据值\n}",
"doc": "写入SESSION数据"
}
],

View File

@@ -26,9 +26,9 @@ type WriteLoginSessionValueRequest struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"`
Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"` // SESSION ID
Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` // 数据Key
Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` // 数据值
}
func (x *WriteLoginSessionValueRequest) Reset() {
@@ -90,7 +90,7 @@ type DeleteLoginSessionRequest struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"`
Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"` // SESSION ID
}
func (x *DeleteLoginSessionRequest) Reset() {
@@ -138,7 +138,7 @@ type FindLoginSessionRequest struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"`
Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"` // SESSION ID
}
func (x *FindLoginSessionRequest) Reset() {
@@ -185,7 +185,7 @@ type FindLoginSessionResponse struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
LoginSession *LoginSession `protobuf:"bytes,1,opt,name=loginSession,proto3" json:"loginSession,omitempty"`
LoginSession *LoginSession `protobuf:"bytes,1,opt,name=loginSession,proto3" json:"loginSession,omitempty"` // SESSION信息
}
func (x *FindLoginSessionResponse) Reset() {
@@ -227,6 +227,62 @@ func (x *FindLoginSessionResponse) GetLoginSession() *LoginSession {
return nil
}
// 清理老的SESSION
type ClearOldLoginSessionsRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"` // 当前SESSION ID
Ip string `protobuf:"bytes,2,opt,name=ip,proto3" json:"ip,omitempty"` // 当前操作IP
}
func (x *ClearOldLoginSessionsRequest) Reset() {
*x = ClearOldLoginSessionsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_service_login_session_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ClearOldLoginSessionsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ClearOldLoginSessionsRequest) ProtoMessage() {}
func (x *ClearOldLoginSessionsRequest) ProtoReflect() protoreflect.Message {
mi := &file_service_login_session_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ClearOldLoginSessionsRequest.ProtoReflect.Descriptor instead.
func (*ClearOldLoginSessionsRequest) Descriptor() ([]byte, []int) {
return file_service_login_session_proto_rawDescGZIP(), []int{4}
}
func (x *ClearOldLoginSessionsRequest) GetSid() string {
if x != nil {
return x.Sid
}
return ""
}
func (x *ClearOldLoginSessionsRequest) GetIp() string {
if x != nil {
return x.Ip
}
return ""
}
var File_service_login_session_proto protoreflect.FileDescriptor
var file_service_login_session_proto_rawDesc = []byte{
@@ -252,23 +308,32 @@ var file_service_login_session_proto_rawDesc = []byte{
0x65, 0x12, 0x34, 0x0a, 0x0c, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f,
0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x67,
0x69, 0x6e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x6c, 0x6f, 0x67, 0x69, 0x6e,
0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x32, 0xf6, 0x01, 0x0a, 0x13, 0x4c, 0x6f, 0x67, 0x69,
0x6e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
0x4b, 0x0a, 0x16, 0x77, 0x72, 0x69, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x57,
0x72, 0x69, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70,
0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x43, 0x0a, 0x12,
0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x73, 0x73, 0x69,
0x6f, 0x6e, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4c, 0x6f,
0x67, 0x69, 0x6e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73,
0x73, 0x12, 0x4d, 0x0a, 0x10, 0x66, 0x69, 0x6e, 0x64, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x65,
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x4c,
0x6f, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x4c, 0x6f, 0x67, 0x69,
0x6e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x40, 0x0a, 0x1c, 0x43, 0x6c, 0x65, 0x61, 0x72,
0x4f, 0x6c, 0x64, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x32, 0xc1, 0x02, 0x0a, 0x13, 0x4c, 0x6f,
0x67, 0x69, 0x6e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x12, 0x4b, 0x0a, 0x16, 0x77, 0x72, 0x69, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53,
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x2e, 0x70, 0x62,
0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x73, 0x73, 0x69,
0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e,
0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x43,
0x0a, 0x12, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63,
0x65, 0x73, 0x73, 0x12, 0x4d, 0x0a, 0x10, 0x66, 0x69, 0x6e, 0x64, 0x4c, 0x6f, 0x67, 0x69, 0x6e,
0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e,
0x64, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x4c, 0x6f,
0x67, 0x69, 0x6e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x49, 0x0a, 0x15, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x4f, 0x6c, 0x64, 0x4c, 0x6f,
0x67, 0x69, 0x6e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x20, 0x2e, 0x70, 0x62,
0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x4f, 0x6c, 0x64, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x65,
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e,
0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x42, 0x06, 0x5a,
0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -283,25 +348,28 @@ func file_service_login_session_proto_rawDescGZIP() []byte {
return file_service_login_session_proto_rawDescData
}
var file_service_login_session_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_service_login_session_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_service_login_session_proto_goTypes = []interface{}{
(*WriteLoginSessionValueRequest)(nil), // 0: pb.WriteLoginSessionValueRequest
(*DeleteLoginSessionRequest)(nil), // 1: pb.DeleteLoginSessionRequest
(*FindLoginSessionRequest)(nil), // 2: pb.FindLoginSessionRequest
(*FindLoginSessionResponse)(nil), // 3: pb.FindLoginSessionResponse
(*LoginSession)(nil), // 4: pb.LoginSession
(*RPCSuccess)(nil), // 5: pb.RPCSuccess
(*ClearOldLoginSessionsRequest)(nil), // 4: pb.ClearOldLoginSessionsRequest
(*LoginSession)(nil), // 5: pb.LoginSession
(*RPCSuccess)(nil), // 6: pb.RPCSuccess
}
var file_service_login_session_proto_depIdxs = []int32{
4, // 0: pb.FindLoginSessionResponse.loginSession:type_name -> pb.LoginSession
5, // 0: pb.FindLoginSessionResponse.loginSession:type_name -> pb.LoginSession
0, // 1: pb.LoginSessionService.writeLoginSessionValue:input_type -> pb.WriteLoginSessionValueRequest
1, // 2: pb.LoginSessionService.deleteLoginSession:input_type -> pb.DeleteLoginSessionRequest
2, // 3: pb.LoginSessionService.findLoginSession:input_type -> pb.FindLoginSessionRequest
5, // 4: pb.LoginSessionService.writeLoginSessionValue:output_type -> pb.RPCSuccess
5, // 5: pb.LoginSessionService.deleteLoginSession:output_type -> pb.RPCSuccess
3, // 6: pb.LoginSessionService.findLoginSession:output_type -> pb.FindLoginSessionResponse
4, // [4:7] is the sub-list for method output_type
1, // [1:4] is the sub-list for method input_type
4, // 4: pb.LoginSessionService.clearOldLoginSessions:input_type -> pb.ClearOldLoginSessionsRequest
6, // 5: pb.LoginSessionService.writeLoginSessionValue:output_type -> pb.RPCSuccess
6, // 6: pb.LoginSessionService.deleteLoginSession:output_type -> pb.RPCSuccess
3, // 7: pb.LoginSessionService.findLoginSession:output_type -> pb.FindLoginSessionResponse
6, // 8: pb.LoginSessionService.clearOldLoginSessions:output_type -> pb.RPCSuccess
5, // [5:9] is the sub-list for method output_type
1, // [1:5] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
@@ -363,6 +431,18 @@ func file_service_login_session_proto_init() {
return nil
}
}
file_service_login_session_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ClearOldLoginSessionsRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@@ -370,7 +450,7 @@ func file_service_login_session_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_service_login_session_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumMessages: 5,
NumExtensions: 0,
NumServices: 1,
},

View File

@@ -22,6 +22,7 @@ const (
LoginSessionService_WriteLoginSessionValue_FullMethodName = "/pb.LoginSessionService/writeLoginSessionValue"
LoginSessionService_DeleteLoginSession_FullMethodName = "/pb.LoginSessionService/deleteLoginSession"
LoginSessionService_FindLoginSession_FullMethodName = "/pb.LoginSessionService/findLoginSession"
LoginSessionService_ClearOldLoginSessions_FullMethodName = "/pb.LoginSessionService/clearOldLoginSessions"
)
// LoginSessionServiceClient is the client API for LoginSessionService service.
@@ -34,6 +35,8 @@ type LoginSessionServiceClient interface {
DeleteLoginSession(ctx context.Context, in *DeleteLoginSessionRequest, opts ...grpc.CallOption) (*RPCSuccess, error)
// 查找SESSION
FindLoginSession(ctx context.Context, in *FindLoginSessionRequest, opts ...grpc.CallOption) (*FindLoginSessionResponse, error)
// 清理老的SESSION
ClearOldLoginSessions(ctx context.Context, in *ClearOldLoginSessionsRequest, opts ...grpc.CallOption) (*RPCSuccess, error)
}
type loginSessionServiceClient struct {
@@ -71,6 +74,15 @@ func (c *loginSessionServiceClient) FindLoginSession(ctx context.Context, in *Fi
return out, nil
}
func (c *loginSessionServiceClient) ClearOldLoginSessions(ctx context.Context, in *ClearOldLoginSessionsRequest, opts ...grpc.CallOption) (*RPCSuccess, error) {
out := new(RPCSuccess)
err := c.cc.Invoke(ctx, LoginSessionService_ClearOldLoginSessions_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// LoginSessionServiceServer is the server API for LoginSessionService service.
// All implementations should embed UnimplementedLoginSessionServiceServer
// for forward compatibility
@@ -81,6 +93,8 @@ type LoginSessionServiceServer interface {
DeleteLoginSession(context.Context, *DeleteLoginSessionRequest) (*RPCSuccess, error)
// 查找SESSION
FindLoginSession(context.Context, *FindLoginSessionRequest) (*FindLoginSessionResponse, error)
// 清理老的SESSION
ClearOldLoginSessions(context.Context, *ClearOldLoginSessionsRequest) (*RPCSuccess, error)
}
// UnimplementedLoginSessionServiceServer should be embedded to have forward compatible implementations.
@@ -96,6 +110,9 @@ func (UnimplementedLoginSessionServiceServer) DeleteLoginSession(context.Context
func (UnimplementedLoginSessionServiceServer) FindLoginSession(context.Context, *FindLoginSessionRequest) (*FindLoginSessionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method FindLoginSession not implemented")
}
func (UnimplementedLoginSessionServiceServer) ClearOldLoginSessions(context.Context, *ClearOldLoginSessionsRequest) (*RPCSuccess, error) {
return nil, status.Errorf(codes.Unimplemented, "method ClearOldLoginSessions not implemented")
}
// UnsafeLoginSessionServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to LoginSessionServiceServer will
@@ -162,6 +179,24 @@ func _LoginSessionService_FindLoginSession_Handler(srv interface{}, ctx context.
return interceptor(ctx, in, info, handler)
}
func _LoginSessionService_ClearOldLoginSessions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ClearOldLoginSessionsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LoginSessionServiceServer).ClearOldLoginSessions(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LoginSessionService_ClearOldLoginSessions_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LoginSessionServiceServer).ClearOldLoginSessions(ctx, req.(*ClearOldLoginSessionsRequest))
}
return interceptor(ctx, in, info, handler)
}
// LoginSessionService_ServiceDesc is the grpc.ServiceDesc for LoginSessionService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -181,6 +216,10 @@ var LoginSessionService_ServiceDesc = grpc.ServiceDesc{
MethodName: "findLoginSession",
Handler: _LoginSessionService_FindLoginSession_Handler,
},
{
MethodName: "clearOldLoginSessions",
Handler: _LoginSessionService_ClearOldLoginSessions_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "service_login_session.proto",

View File

@@ -16,25 +16,34 @@ service LoginSessionService {
// 查找SESSION
rpc findLoginSession(FindLoginSessionRequest) returns (FindLoginSessionResponse);
// 清理老的SESSION
rpc clearOldLoginSessions(ClearOldLoginSessionsRequest) returns (RPCSuccess);
}
// 写入SESSION数据
message WriteLoginSessionValueRequest {
string sid = 1;
string key = 2;
string value = 3;
string sid = 1; // SESSION ID
string key = 2; // 数据Key
string value = 3; // 数据值
}
// 删除SESSION
message DeleteLoginSessionRequest {
string sid = 1;
string sid = 1; // SESSION ID
}
// 查找SESSION
message FindLoginSessionRequest {
string sid = 1;
string sid = 1; // SESSION ID
}
message FindLoginSessionResponse {
LoginSession loginSession = 1;
LoginSession loginSession = 1; // SESSION信息
}
// 清理老的SESSION
message ClearOldLoginSessionsRequest {
string sid = 1; // 当前SESSION ID
string ip = 2; // 当前操作IP
}