github.com/polarismesh/polaris@v1.17.8/admin/api.go (about) 1 /** 2 * Tencent is pleased to support the open source community by making Polaris available. 3 * 4 * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 5 * 6 * Licensed under the BSD 3-Clause License (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * https://opensource.org/licenses/BSD-3-Clause 11 * 12 * Unless required by applicable law or agreed to in writing, software distributed 13 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 14 * CONDITIONS OF ANY KIND, either express or implied. See the License for the 15 * specific language governing permissions and limitations under the License. 16 */ 17 18 package admin 19 20 import ( 21 "context" 22 23 apiservice "github.com/polarismesh/specification/source/go/api/v1/service_manage" 24 25 connlimit "github.com/polarismesh/polaris/common/conn/limit" 26 "github.com/polarismesh/polaris/common/model" 27 ) 28 29 type ConnReq struct { 30 Protocol string 31 Host string 32 Port int 33 Amount int 34 } 35 36 type ConnCountResp struct { 37 Protocol string 38 Total int32 39 Host map[string]int32 40 } 41 42 type ConnStatsResp struct { 43 Protocol string 44 ActiveConnTotal int32 45 StatsTotal int 46 StatsSize int 47 Stats []*connlimit.HostConnStat 48 } 49 50 type ScopeLevel struct { 51 Name string 52 Level string 53 } 54 55 // AdminOperateServer Maintain related operation 56 type AdminOperateServer interface { 57 // GetServerConnections Get connection count 58 GetServerConnections(ctx context.Context, req *ConnReq) (*ConnCountResp, error) 59 // GetServerConnStats 获取连接缓存里面的统计信息 60 GetServerConnStats(ctx context.Context, req *ConnReq) (*ConnStatsResp, error) 61 // CloseConnections Close connection by ip 62 CloseConnections(ctx context.Context, reqs []ConnReq) error 63 // FreeOSMemory Free system memory 64 FreeOSMemory(ctx context.Context) error 65 // CleanInstance Clean deleted instance 66 CleanInstance(ctx context.Context, req *apiservice.Instance) *apiservice.Response 67 68 // BatchCleanInstances Batch clean deleted instances 69 BatchCleanInstances(ctx context.Context, batchSize uint32) (uint32, error) 70 // GetLastHeartbeat Get last heartbeat 71 GetLastHeartbeat(ctx context.Context, req *apiservice.Instance) *apiservice.Response 72 73 // GetLogOutputLevel Get log output level 74 GetLogOutputLevel(ctx context.Context) ([]ScopeLevel, error) 75 // SetLogOutputLevel Set log output level by scope 76 SetLogOutputLevel(ctx context.Context, scope string, level string) error 77 // ListLeaderElections 78 ListLeaderElections(ctx context.Context) ([]*model.LeaderElection, error) 79 // ReleaseLeaderElection 80 ReleaseLeaderElection(ctx context.Context, electKey string) error 81 // GetCMDBInfo get cmdb info 82 GetCMDBInfo(ctx context.Context) ([]model.LocationView, error) 83 }