Commit 3279a70c authored by wcb's avatar wcb
Browse files

Merge branch 'develop' into 'master'

Develop

See merge request !17
1 merge request!17Develop
Pipeline #173 passed with stages
in 2 minutes and 6 seconds
Showing with 418 additions and 380 deletions
+418 -380
kind: pipeline
name: default
steps:
- name: publish_dev_private_registry
image: plugins/docker
pull: if-not-exists
settings:
repo: docker.sloong.com/sloongnet_webui
registry: docker.sloong.com
cache_from: docker.sloong.com/sloongnet_webui
use_cache: true
username:
from_secret: docker_username
password:
from_secret: docker_password
tags:
- dev
when:
branch:
- develop
event:
exclude:
- pull_request
- name: publish_private_registry
image: plugins/docker
pull: if-not-exists
settings:
repo: docker.sloong.com/sloongnet_webui
registry: docker.sloong.com
cache_from: docker.sloong.com/sloongnet_webui
use_cache: true
username:
from_secret: docker_username
password:
from_secret: docker_password
tags:
- latest
- stable
when:
branch:
- master
event:
exclude:
- pull_request
- name: publish_release_private_registry
image: plugins/docker
pull: if-not-exists
settings:
repo: docker.sloong.com/sloongnet_webui
registry: docker.sloong.com
cache_from: docker.sloong.com/sloongnet_webui
use_cache: true
username:
from_secret: docker_username
password:
from_secret: docker_password
tags:
- latest
- ${DRONE_TAG}
when:
event: tag
- name: publish_docker_hub
image: plugins/docker
pull: if-not-exists
settings:
repo: sloong/sloongnet_webui
cache_from: sloong/sloongnet_webui
use_cache: true
username:
from_secret: docker_hub_username
password:
from_secret: docker_hub_password
tags:
- latest
- ${DRONE_TAG}
when:
event: tag
image: docker:20
before_script:
- echo $CI_JOB_NAME
- echo $CI_PROJECT_DIR
stages:
- test
- publish
- deploy
unit-test-job:
stage: test
script:
- echo "Running unit tests... This will take about 60 seconds."
- sleep 60
- echo "Code coverage is 90%"
lint-test-job:
stage: test
script:
- echo "Linting code... This will take about 10 seconds."
- sleep 10
- echo "No lint issues found."
publish_dev:
stage: publish
tags:
- linux
- docker
only:
- develop
before_script:
- docker login -u $CI_DEPENDENCY_PROXY_USER -p $CI_DEPENDENCY_PROXY_PASSWORD $CI_DEPENDENCY_PROXY_SERVER
script:
- docker build -t docker.sloong.com/sloongnet_webui:dev -f $CI_PROJECT_DIR/Dockerfile $CI_PROJECT_DIR
- docker image list
- docker push docker.sloong.com/sloongnet_webui:dev
publish_latest:
stage: publish
tags:
- linux
- docker
only:
- master
before_script:
- docker login -u $CI_DEPENDENCY_PROXY_USER -p $CI_DEPENDENCY_PROXY_PASSWORD $CI_DEPENDENCY_PROXY_SERVER
script:
- docker build -t docker.sloong.com/sloongnet_webui -f $CI_PROJECT_DIR/Dockerfile $CI_PROJECT_DIR
- docker tag docker.sloong.com/sloongnet_webui sloong/sloongnet_webui
- docker image list
- docker push docker.sloong.com/sloongnet_webui
- docker login -u $CI_DEPENDENCY_DOCKERHUB_USER -p $CI_DEPENDENCY_DOCKERHUB_PASSWORD
- docker push sloong/sloongnet_webui
publish_tags:
stage: publish
tags:
- linux
- docker
only:
- tags
before_script:
- docker login -u $CI_DEPENDENCY_PROXY_USER -p $CI_DEPENDENCY_PROXY_PASSWORD $CI_DEPENDENCY_PROXY_SERVER
script:
- docker build -t docker.sloong.com/sloongnet_webui:$CI_COMMIT_TAG -f $CI_PROJECT_DIR/Dockerfile $CI_PROJECT_DIR
- docker tag docker.sloong.com/sloongnet_webui:$CI_COMMIT_TAG sloong/sloongnet_webui:$CI_COMMIT_TAG
- docker image list
- docker push docker.sloong.com/sloongnet_webui:$CI_COMMIT_TAG
- docker login -u $CI_DEPENDENCY_DOCKERHUB_USER -p $CI_DEPENDENCY_DOCKERHUB_PASSWORD
- docker push sloong/sloongnet_webui:$CI_COMMIT_TAG
deploy-job:
stage: deploy
script:
- echo "Deploying application..."
- echo "Application successfully deployed."
......@@ -8,7 +8,7 @@
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"program": "${workspaceFolder}/src/manage.py",
"args": [
"runserver",
"--noreload"
......
......@@ -2,8 +2,8 @@
###
# @Author: WCB
# @Date: 2019-12-11 14:28:05
# @LastEditors: Chuanbin Wang
# @LastEditTime: 2021-09-17 14:12:32
# @LastEditors: wcb wcb@sloong.com
# @LastEditTime: 2022-12-08 19:46:53
# @Description: file content
###
pwd
......@@ -15,5 +15,5 @@ cd $SCRIPTFOLDER/../
VERSION_STR=$(cat version)
docker build -t sloongnet_webui:$VERSION_STR -f $SCRIPTFOLDER/../Dockerfile $SCRIPTFOLDER/../
docker tag sloongnet_webui:$VERSION_STR sloongnet_webui:latest
docker tag sloongnet_webui docker.sloong.com/sloongnet_webui
docker tag sloongnet_webui:$VERSION_STR sloongnet_webui:debug
......@@ -20,6 +20,7 @@ class MessagePackage:
def Request(self, func: int, req_pack: betterproto.Message, extend=None, type=Base.DataPackagePackageType.Request):
self.Pack.type = type
self.Pack.function = func
# self.Pack.id =
if req_pack:
self.Pack.content = bytes(req_pack)
if extend:
......
......@@ -2,6 +2,7 @@
# sources: base.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import List
import betterproto
......@@ -26,6 +27,18 @@ class PRIORITY_LEVEL(betterproto.Enum):
Inessential = 4
class TimelineOperation(betterproto.Enum):
Created = 0
Send = 1
Received = 2
StartProcess = 3
Processing = 4
EndProcess = 5
Response = 6
Request = 7
Forward = 8
class DataPackagePackageType(betterproto.Enum):
Request = 0
Response = 1
......@@ -34,11 +47,24 @@ class DataPackagePackageType(betterproto.Enum):
Heartbeat = 4
@dataclass
class Timeline(betterproto.Message):
node: int = betterproto.int64_field(1)
points: List["TimelineTimepoint"] = betterproto.message_field(2)
@dataclass
class TimelineTimepoint(betterproto.Message):
opt: "TimelineOperation" = betterproto.enum_field(1)
point: float = betterproto.fixed64_field(2)
note: str = betterproto.string_field(3)
@dataclass
class DataPackage(betterproto.Message):
type: "DataPackagePackageType" = betterproto.enum_field(1)
# unique identifier
id: float = betterproto.fixed64_field(2)
i_d: float = betterproto.fixed64_field(2)
# Priority level
priority: "PRIORITY_LEVEL" = betterproto.enum_field(3)
# In request pacakge, value is function id. In event package, value is event
......@@ -60,3 +86,5 @@ class DataPackage(betterproto.Message):
hash: bytes = betterproto.bytes_field(8)
# unique identifier for sender
sender: float = betterproto.fixed64_field(9)
# Package process timeline. if no set when request, no return when response.
timelines: List["Timeline"] = betterproto.message_field(10)
......@@ -2,6 +2,7 @@
# sources: core.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import List
import betterproto
......@@ -24,13 +25,11 @@ class DATA_ITEM(betterproto.Enum):
Invalid = 0
ServerConfiguration = 1
ModuleConfiguration = 2
Logger = 3
NodeUUID = 4
ReferencedInformation = 5
CustomMix = 100
class MODULE_TYPE(betterproto.Enum):
class PREDEFINE_TAGS(betterproto.Enum):
"""/ Module type for module configuration."""
Manager = 0
......@@ -58,15 +57,15 @@ class EVENT_TYPE(betterproto.Enum):
ReadyForWork = 5
# / Send package to manager node./ Send by anyone./ Receive by application.
SendPackageToManager = 4
# / Send data package. / the event parameter type is SendPackageEvent/ Send
# by anyone. / Receive by network hub.
# / Send data package./ the event parameter type is SendPackageEvent/ Send by
# anyone./ Receive by network hub.
SendPackage = 11
# / Whent the connection is breaked. this event will be sent/ the event
# parameter is ConnectionBreakedEvent/ Send by network hub. / Receive by
# parameter is ConnectionBreakedEvent/ Send by network hub./ Receive by
# anyone.
ConnectionBreaked = 12
# / When you want bread a connection, send the event/ the event parameter is
# BreadConnectionEvent/ Send by anyone. / Receive by network hub.
# BreadConnectionEvent/ Send by anyone./ Receive by network hub.
BreadConnection = 13
# / If you want to modify the monitor for socket send status, use this
# event./ The event parameter type is MonitorSendStatusEvent./ Send by
......@@ -87,6 +86,9 @@ class EVENT_TYPE(betterproto.Enum):
# / When the new connection is established. call the event/ The event
# parameter type is NewConnectionHookEvent
NewConnectionHook = 21
# / Set the node event log level./ The event parameter type is NodeLogLevel/
# Send by network hub./ Receive by application.
SetNodeLogLevel = 22
# ////////////////////////////////////////////////////////////////////////
# Custom event start index. Used by other module (>100)//////////////////////
# //////////////////////////////////////////////////
......@@ -99,6 +101,7 @@ class ControlEvent(betterproto.Enum):
InvalidEvent = 0
Restart = 1
Stop = 2
# / Control the node log level./ The event parameter type is NodeLogLevel.
ControlLogLevel = 3
# / Control the replay data record type./ The event parameter is int32, the
# value list:(0) disable; (1) enable with content; (2) enable with full
......@@ -106,41 +109,61 @@ class ControlEvent(betterproto.Enum):
ControlReplayDataRecord = 4
@dataclass
class NodeLogLevel(betterproto.Message):
# / 作用于全局的日志级别
level: "LogLevel" = betterproto.enum_field(1)
command_level: "LogLevel" = betterproto.enum_field(2)
log_file_level: "LogLevel" = betterproto.enum_field(3)
net_level: "LogLevel" = betterproto.enum_field(4)
@dataclass
class GLOBAL_CONFIG(betterproto.Message):
# Network
listen_address: str = betterproto.string_field(1)
listen_port: int = betterproto.int32_field(2)
# Log
log_path: str = betterproto.string_field(3)
log_level: "LogLevel" = betterproto.enum_field(4)
log_operation: int = betterproto.int32_field(5)
# Performance/ The network worker thread quantity. send and receive. for
# epoll.
network_thread_quantity: int = betterproto.int32_field(7)
network: "GLOBAL_CONFIGNetworkConfig" = betterproto.message_field(1)
log: "GLOBAL_CONFIGLogConfig" = betterproto.message_field(2)
performance: "GLOBAL_CONFIGPerformanceConfig" = betterproto.message_field(3)
module: "GLOBAL_CONFIGModuleConfig" = betterproto.message_field(4)
@dataclass
class GLOBAL_CONFIGNetworkConfig(betterproto.Message):
listen_port: int = betterproto.int32_field(1)
connect_time: int = betterproto.int32_field(2)
receive_time: int = betterproto.int32_field(3)
# SSL
enable_s_s_l: bool = betterproto.bool_field(4)
cert_file_path: str = betterproto.string_field(5)
key_file_path: str = betterproto.string_field(6)
cert_passwd: str = betterproto.string_field(7)
@dataclass
class GLOBAL_CONFIGLogConfig(betterproto.Message):
path: str = betterproto.string_field(1)
level: "LogLevel" = betterproto.enum_field(2)
@dataclass
class GLOBAL_CONFIGPerformanceConfig(betterproto.Message):
# / The network worker thread quantity. send and receive. for epoll.
network_thread_quantity: int = betterproto.int32_field(1)
# / The process worker thread quantity.
process_thread_quantity: int = betterproto.int32_field(8)
# / Priority Size for the list. the priority level cannot bigger than this
# value.
PRIORITYSIZE_RESVERVED: int = betterproto.int32_field(9)
# Timeout
connect_time: int = betterproto.int32_field(10)
receive_time: int = betterproto.int32_field(11)
# Module
module_name: str = betterproto.string_field(12)
module_type: "MODULE_TYPE" = betterproto.enum_field(13)
module_path: str = betterproto.string_field(14)
module_config: bytes = betterproto.bytes_field(15)
# / The referenced template id./ And then this node can send request to the
# referenced node./ And the referenced template work node online/offline will
# notifies to this node.
module_reference: str = betterproto.string_field(16)
process_thread_quantity: int = betterproto.int32_field(2)
@dataclass
class GLOBAL_CONFIGModuleConfig(betterproto.Message):
path: str = betterproto.string_field(1)
config: bytes = betterproto.bytes_field(2)
# / Configuration this config require the node have some tag./ Support add
# multi tag
required_tags: List[str] = betterproto.string_field(3)
# / The referenced template tags. All templates that match any of the tags in
# the reference list will be notified/ And then this node can send request to
# the referenced node./ And the referenced template work node online/offline
# will notifies to this node.
reference: List[str] = betterproto.string_field(4)
# / The id range for module provide functions. it canbe: single function
# (xx); function ranges(xx-xx); full functions(*)./ can have many forms, use
# the commma(,) to split it.
module_functoins: str = betterproto.string_field(17)
# SSL
enable_s_s_l: bool = betterproto.bool_field(18)
cert_file_path: str = betterproto.string_field(19)
key_file_path: str = betterproto.string_field(20)
cert_passwd: str = betterproto.string_field(21)
# (xx); function ranges(xx-xx); full functions(*).
functoins: List[str] = betterproto.string_field(5)
'''
File: /mnt/d/Projects/sloongnet/web-interface/src/protocol/Manager.py
Created Date: 2022-04-09 12:35:16
Author: Chuanbin Wang - wcb@sloong.com
---------------
Last Modified: 2022-04-09 12:35:28
Modified By: Chuanbin Wang - wcb@sloong.com
---------------
Copyright 2015-2022 Sloong.com. All Rights Reserved
@.................................................................@
@........................................&........................@
@......................................&&.........................@
@....................................&&&..........................@
@.................................&&&&............................@
@...............................&&&&..............................@
@.............................&&&&&&..............................@
@...........................&&&&&&....&&&..&&&&&&&&&&&&&&&........@
@..................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&..............@
@................&...&&&&&&&&&&&&&&&&&&&&&&&&&&&&.................@
@.......................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&.........@
@...................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&...............@
@..................&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&............@
@...............&&&&&@ &&&&&&&&&&..&&&&&&&&&&&&&&&&&&&...........@
@..............&&&&&&&&&&&&&&&.&&....&&&&&&&&&&&&&..&&&&&.........@
@..........&&&&&&&&&&&&&&&&&&...&.....&&&&&&&&&&&&&...&&&&........@
@........&&&&&&&&&&&&&&&&&&&.........&&&&&&&&&&&&&&&....&&&.......@
@.......&&&&&&&&.....................&&&&&&&&&&&&&&&&.....&&......@
@........&&&&&.....................&&&&&&&&&&&&&&&&&&.............@
@..........&...................&&&&&&&&&&&&&&&&&&&&&&&............@
@................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&............@
@..................&&&&&&&&&&&&&&&&&&&&&&&&&&&&..&&&&&............@
@..............&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....&&&&&............@
@...........&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&......&&&&............@
@.........&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&.........&&&&............@
@.......&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&...........&&&&............@
@......&&&&&&&&&&&&&&&&&&&...&&&&&&...............&&&.............@
@.....&&&&&&&&&&&&&&&&............................&&..............@
@....&&&&&&&&&&&&&&&.................&&...........................@
@...&&&&&&&&&&&&&&&.....................&&&&......................@
@...&&&&&&&&&&.&&&........................&&&&&...................@
@..&&&&&&&&&&&..&&..........................&&&&&&&...............@
@..&&&&&&&&&&&&...&............&&&.....&&&&...&&&&&&&.............@
@..&&&&&&&&&&&&&.................&&&.....&&&&&&&&&&&&&&...........@
@..&&&&&&&&&&&&&&&&..............&&&&&&&&&&&&&&&&&&&&&&&&.........@
@..&&.&&&&&&&&&&&&&&&&&.........&&&&&&&&&&&&&&&&&&&&&&&&&&&.......@
@...&&..&&&&&&&&&&&&.........&&&&&&&&&&&&&&&&...&&&&&&&&&&&&......@
@....&..&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&...........&&&&&&&&.....@
@.......&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&..............&&&&&&&....@
@.......&&&&&.&&&&&&&&&&&&&&&&&&..&&&&&&&&...&..........&&&&&&....@
@........&&&.....&&&&&&&&&&&&&.....&&&&&&&&&&...........&..&&&&...@
@.......&&&........&&&.&&&&&&&&&.....&&&&&.................&&&&...@
@.......&&&...............&&&&&&&.......&&&&&&&&............&&&...@
@........&&...................&&&&&&.........................&&&..@
@.........&.....................&&&&........................&&....@
@...............................&&&.......................&&......@
@................................&&......................&&.......@
@.................................&&..............................@
@..................................&..............................@
@.................................................................@
Description:
'''
'''
File: /mnt/d/Projects/sloongnet/web-interface/src/protocol/Manager.py
Created Date: 2022-04-09 12:34:16
Author: Chuanbin Wang - wcb@sloong.com
---------------
Last Modified: 2022-04-09 12:35:16
Modified By: Chuanbin Wang - wcb@sloong.com
---------------
Copyright 2015-2022 Sloong.com. All Rights Reserved
@.................................................................@
@........................................&........................@
@......................................&&.........................@
@....................................&&&..........................@
@.................................&&&&............................@
@...............................&&&&..............................@
@.............................&&&&&&..............................@
@...........................&&&&&&....&&&..&&&&&&&&&&&&&&&........@
@..................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&..............@
@................&...&&&&&&&&&&&&&&&&&&&&&&&&&&&&.................@
@.......................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&.........@
@...................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&...............@
@..................&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&............@
@...............&&&&&@ &&&&&&&&&&..&&&&&&&&&&&&&&&&&&&...........@
@..............&&&&&&&&&&&&&&&.&&....&&&&&&&&&&&&&..&&&&&.........@
@..........&&&&&&&&&&&&&&&&&&...&.....&&&&&&&&&&&&&...&&&&........@
@........&&&&&&&&&&&&&&&&&&&.........&&&&&&&&&&&&&&&....&&&.......@
@.......&&&&&&&&.....................&&&&&&&&&&&&&&&&.....&&......@
@........&&&&&.....................&&&&&&&&&&&&&&&&&&.............@
@..........&...................&&&&&&&&&&&&&&&&&&&&&&&............@
@................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&............@
@..................&&&&&&&&&&&&&&&&&&&&&&&&&&&&..&&&&&............@
@..............&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....&&&&&............@
@...........&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&......&&&&............@
@.........&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&.........&&&&............@
@.......&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&...........&&&&............@
@......&&&&&&&&&&&&&&&&&&&...&&&&&&...............&&&.............@
@.....&&&&&&&&&&&&&&&&............................&&..............@
@....&&&&&&&&&&&&&&&.................&&...........................@
@...&&&&&&&&&&&&&&&.....................&&&&......................@
@...&&&&&&&&&&.&&&........................&&&&&...................@
@..&&&&&&&&&&&..&&..........................&&&&&&&...............@
@..&&&&&&&&&&&&...&............&&&.....&&&&...&&&&&&&.............@
@..&&&&&&&&&&&&&.................&&&.....&&&&&&&&&&&&&&...........@
@..&&&&&&&&&&&&&&&&..............&&&&&&&&&&&&&&&&&&&&&&&&.........@
@..&&.&&&&&&&&&&&&&&&&&.........&&&&&&&&&&&&&&&&&&&&&&&&&&&.......@
@...&&..&&&&&&&&&&&&.........&&&&&&&&&&&&&&&&...&&&&&&&&&&&&......@
@....&..&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&...........&&&&&&&&.....@
@.......&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&..............&&&&&&&....@
@.......&&&&&.&&&&&&&&&&&&&&&&&&..&&&&&&&&...&..........&&&&&&....@
@........&&&.....&&&&&&&&&&&&&.....&&&&&&&&&&...........&..&&&&...@
@.......&&&........&&&.&&&&&&&&&.....&&&&&.................&&&&...@
@.......&&&...............&&&&&&&.......&&&&&&&&............&&&...@
@........&&...................&&&&&&.........................&&&..@
@.........&.....................&&&&........................&&....@
@...............................&&&.......................&&......@
@................................&&......................&&.......@
@.................................&&..............................@
@..................................&..............................@
@.................................................................@
Description:
'''
# Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: manager.proto
# plugin: python-betterproto
......@@ -201,12 +77,6 @@ class PostReplayDataRequestType(betterproto.Enum):
Receive = 1
class RegisterWorkerRequestRunType(betterproto.Enum):
Default = 0
IncludeMode = 1
ExcludeMode = 2
@dataclass
class EventReferenceModuleOnline(betterproto.Message):
item: "NodeItem" = betterproto.message_field(1)
......@@ -244,9 +114,8 @@ class PostReplayDataRequest(betterproto.Message):
@dataclass
class RegisterWorkerRequest(betterproto.Message):
run_mode: "RegisterWorkerRequestRunType" = betterproto.enum_field(1)
template_id: List[int] = betterproto.int32_field(2)
module_types: List[Core.MODULE_TYPE] = betterproto.enum_field(3)
# Node support tags.
tags: List[str] = betterproto.string_field(1)
@dataclass
......@@ -272,8 +141,8 @@ class RegisterNodeResponse(betterproto.Message):
class ReferenceTemplateInfo(betterproto.Message):
template_id: int = betterproto.int32_field(1)
template_name: str = betterproto.string_field(2)
type: Core.MODULE_TYPE = betterproto.enum_field(3)
provide_functions: str = betterproto.string_field(4)
defined_tags: List[str] = betterproto.string_field(3)
provide_functions: List[str] = betterproto.string_field(4)
node_infos: List["NodeItem"] = betterproto.message_field(5)
......@@ -302,7 +171,7 @@ class QueryTemplateRequest(betterproto.Message):
"""Query template info by ID or type."""
template_id: List[int] = betterproto.int32_field(1)
template_type: List[int] = betterproto.int32_field(2)
template_tags: List[str] = betterproto.string_field(2)
query_all: bool = betterproto.bool_field(3)
......@@ -368,4 +237,4 @@ class ReconnectRegisterRequest(betterproto.Message):
@dataclass
class SetNodeLogLevelRequest(betterproto.Message):
nodes: List[float] = betterproto.fixed64_field(1)
log_level: Core.LogLevel = betterproto.enum_field(2)
level: Core.NodeLogLevel = betterproto.message_field(2)
syntax = "proto3";
option cc_enable_arenas = false;
package Base;
// Result
......@@ -22,6 +25,30 @@ enum PRIORITY_LEVEL
Inessential = 4;
}
message Timeline
{
enum Operation
{
Created = 0;
Send = 1;
Received = 2;
StartProcess = 3;
Processing = 4;
EndProcess = 5;
Response = 6;
Request = 7;
Forward = 8;
}
int64 Node = 1;
message Timepoint
{
Operation Opt = 1;
fixed64 Point = 2;
string Note = 3;
}
repeated Timepoint Points = 2;
}
message DataPackage
{
enum PackageType
......@@ -52,4 +79,6 @@ message DataPackage
bytes Hash = 8;
// unique identifier for sender
fixed64 Sender = 9;
// Package process timeline. if no set when request, no return when response.
repeated Timeline Timelines = 10;
}
// Protobuf for Core Module
// If other module is develop by C/C++, and want base on Core module, use this protocol
syntax = "proto3";
option cc_enable_arenas = false;
package Core;
// LogLevel
......@@ -21,14 +24,12 @@ enum DATA_ITEM
Invalid = 0;
ServerConfiguration = 1;
ModuleConfiguration = 2;
Logger = 3;
NodeUUID = 4;
ReferencedInformation = 5;
CustomMix = 100;
}
/// Module type for module configuration.
enum MODULE_TYPE
enum PREDEFINE_TAGS
{
Manager = 0;
AuthCenter = 1;
......@@ -43,9 +44,9 @@ enum MODULE_TYPE
enum EVENT_TYPE
{
InvalidEventType = 0;
/// Application is ready to running.
/// Send by application.
/// Send by application.
ProgramStart = 1;
/// Application will be exit.
......@@ -67,25 +68,24 @@ enum EVENT_TYPE
/// Receive by application.
SendPackageToManager = 4;
/// Send data package.
/// Send data package.
/// the event parameter type is SendPackageEvent
/// Send by anyone.
/// Send by anyone.
/// Receive by network hub.
SendPackage = 11;
/// Whent the connection is breaked. this event will be sent
/// the event parameter is ConnectionBreakedEvent
/// Send by network hub.
/// Send by network hub.
/// Receive by anyone.
ConnectionBreaked = 12;
/// When you want bread a connection, send the event
/// the event parameter is BreadConnectionEvent
/// Send by anyone.
/// Receive by network hub.
/// Send by anyone.
/// Receive by network hub.
BreadConnection = 13;
/// If you want to modify the monitor for socket send status, use this event.
/// The event parameter type is MonitorSendStatusEvent.
/// Send by anyone.
......@@ -98,7 +98,6 @@ enum EVENT_TYPE
/// Receive by network hub.
RegisterConnection = 16;
/// Get information for connection.
/// The event parameter type is GetConnectionInfoEvent.
/// Send by anyone.
......@@ -121,6 +120,12 @@ enum EVENT_TYPE
/// The event parameter type is NewConnectionHookEvent
NewConnectionHook = 21;
/// Set the node event log level.
/// The event parameter type is NodeLogLevel
/// Send by network hub.
/// Receive by application.
SetNodeLogLevel = 22;
//////////////////////////////////////////////////////////////////////////
// Custom event start index. Used by other module (>100)
//////////////////////////////////////////////////////////////////////////
......@@ -133,53 +138,69 @@ enum ControlEvent
InvalidEvent = 0;
Restart = 1;
Stop = 2;
/// Control the node log level.
/// The event parameter type is NodeLogLevel.
ControlLogLevel = 3;
/// Control the replay data record type.
/// The event parameter is int32, the value list:(0) disable; (1) enable with content; (2) enable with full package.
ControlReplayDataRecord = 4;
}
message NodeLogLevel
{
/// 作用于全局的日志级别
LogLevel Level = 1;
LogLevel CommandLevel = 2;
LogLevel LogFileLevel = 3;
LogLevel NetLevel = 4;
}
message GLOBAL_CONFIG
{
// Network
string ListenAddress = 1;
int32 ListenPort = 2;
// Log
string LogPath = 3;
LogLevel LogLevel = 4;
int32 LogOperation = 5;
// Performance
/// The network worker thread quantity. send and receive. for epoll.
int32 NetworkThreadQuantity = 7;
/// The process worker thread quantity.
int32 ProcessThreadQuantity = 8;
/// Priority Size for the list. the priority level cannot bigger than this value.
int32 PRIORITYSIZE_RESVERVED = 9;
// Timeout
int32 ConnectTime = 10;
int32 ReceiveTime = 11;
// Module
string ModuleName = 12;
MODULE_TYPE ModuleType = 13;
string ModulePath = 14;
bytes ModuleConfig = 15;
/// The referenced template id.
/// And then this node can send request to the referenced node.
/// And the referenced template work node online/offline will notifies to this node.
string ModuleReference = 16;
/// The id range for module provide functions. it canbe: single function (xx); function ranges(xx-xx); full functions(*).
/// can have many forms, use the commma(,) to split it.
string ModuleFunctoins = 17;
// SSL
bool EnableSSL = 18;
string CertFilePath = 19;
string KeyFilePath = 20;
string CertPasswd = 21;
message NetworkConfig
{
int32 ListenPort = 1;
int32 ConnectTime = 2;
int32 ReceiveTime = 3;
// SSL
bool EnableSSL = 4;
string CertFilePath = 5;
string KeyFilePath = 6;
string CertPasswd = 7;
}
NetworkConfig Network = 1;
message LogConfig
{
string Path = 1;
LogLevel Level = 2;
}
LogConfig Log = 2;
message PerformanceConfig
{
/// The network worker thread quantity. send and receive. for epoll.
int32 NetworkThreadQuantity = 1;
/// The process worker thread quantity.
int32 ProcessThreadQuantity = 2;
}
PerformanceConfig Performance = 3;
message ModuleConfig
{
string Path = 1;
bytes Config = 2;
/// Configuration this config require the node have some tag.
/// Support add multi tag
repeated string RequiredTags = 3;
/// The referenced template tags. All templates that match any of the tags in the reference list will be notified
/// And then this node can send request to the referenced node.
/// And the referenced template work node online/offline will notifies to this node.
repeated string Reference = 4;
/// The id range for module provide functions. it canbe: single function (xx); function ranges(xx-xx); full functions(*).
repeated string Functoins = 5;
}
ModuleConfig Module = 4;
}
syntax = "proto3";
option cc_enable_arenas = false;
import "core.proto";
package Manager;
......@@ -132,18 +135,8 @@ message PostReplayDataRequest
message RegisterWorkerRequest
{
// In defualt no should set, just send request with empty content.
// Just ues this when a worker node is for specified template.
enum RunType
{
Default = 0;
IncludeMode = 1;
// Be careful set the template id in exclud mode. This is not recommended. the new template will always be not excluded if you forget to edit the template. so be sure what you want do.
ExcludeMode = 2;
};
RunType RunMode = 1;
repeated int32 TemplateID = 2;
repeated Core.MODULE_TYPE ModuleTypes = 3;
// Node support tags.
repeated string Tags=1;
}
message RegisterWorkerResponse
......@@ -163,8 +156,8 @@ message ReferenceTemplateInfo
{
int32 TemplateID = 1;
string TemplateName = 2;
Core.MODULE_TYPE Type = 3;
string ProvideFunctions = 4;
repeated string DefinedTags = 3;
repeated string ProvideFunctions = 4;
repeated NodeItem NodeInfos = 5;
}
......@@ -178,7 +171,7 @@ message SetTemplateRequest { TemplateItem SetInfo = 1; }
message QueryTemplateRequest
{
repeated int32 TemplateID = 1;
repeated int32 TemplateType = 2;
repeated string TemplateTags = 2;
bool QueryAll = 3;
}
......@@ -228,5 +221,5 @@ message ReconnectRegisterRequest
message SetNodeLogLevelRequest
{
repeated fixed64 Nodes = 1;
Core.LogLevel LogLevel = 2;
Core.NodeLogLevel Level = 2;
}
\ No newline at end of file
......@@ -14,7 +14,7 @@ cd $SCRIPTFOLDER
ENGINEFOLER=$SCRIPTFOLDER/../../../engine
cp $ENGINEFOLER/src/protocol/base.proto $SCRIPTFOLDER/
cp $ENGINEFOLER/src/modules/core/protocol/core.proto $SCRIPTFOLDER/
cp $ENGINEFOLER/src/modules/manager/protocol/manager.proto $SCRIPTFOLDER/
cp $ENGINEFOLER/src/protocol/core.proto $SCRIPTFOLDER/
cp $ENGINEFOLER/src/protocol/manager.proto $SCRIPTFOLDER/
./rebuild.sh
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
###
# File: /mnt/c/Users/wcb/Documents/Projects/sloongnet/web-interface/src/settings/forms/config_form.py
# Created Date: 2022-12-13, 4:56:00
# Author: Chuanbin Wang - wcb@sloong.com
# ---------------
# Last Modified: 2023-01-16 03:54:47
# Modified By: Chuanbin Wang - wcb@sloong.com
# ---------------
# Copyright 2015-2022 Sloong.com. All Rights Reserved
# @.................................................................@
# @........................................&........................@
# @......................................&&.........................@
# @....................................&&&..........................@
# @.................................&&&&............................@
# @...............................&&&&..............................@
# @.............................&&&&&&..............................@
# @...........................&&&&&&....&&&..&&&&&&&&&&&&&&&........@
# @..................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&..............@
# @................&...&&&&&&&&&&&&&&&&&&&&&&&&&&&&.................@
# @.......................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&.........@
# @...................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&...............@
# @..................&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&............@
# @...............&&&&&@ &&&&&&&&&&..&&&&&&&&&&&&&&&&&&&...........@
# @..............&&&&&&&&&&&&&&&.&&....&&&&&&&&&&&&&..&&&&&.........@
# @..........&&&&&&&&&&&&&&&&&&...&.....&&&&&&&&&&&&&...&&&&........@
# @........&&&&&&&&&&&&&&&&&&&.........&&&&&&&&&&&&&&&....&&&.......@
# @.......&&&&&&&&.....................&&&&&&&&&&&&&&&&.....&&......@
# @........&&&&&.....................&&&&&&&&&&&&&&&&&&.............@
# @..........&...................&&&&&&&&&&&&&&&&&&&&&&&............@
# @................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&............@
# @..................&&&&&&&&&&&&&&&&&&&&&&&&&&&&..&&&&&............@
# @..............&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....&&&&&............@
# @...........&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&......&&&&............@
# @.........&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&.........&&&&............@
# @.......&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&...........&&&&............@
# @......&&&&&&&&&&&&&&&&&&&...&&&&&&...............&&&.............@
# @.....&&&&&&&&&&&&&&&&............................&&..............@
# @....&&&&&&&&&&&&&&&.................&&...........................@
# @...&&&&&&&&&&&&&&&.....................&&&&......................@
# @...&&&&&&&&&&.&&&........................&&&&&...................@
# @..&&&&&&&&&&&..&&..........................&&&&&&&...............@
# @..&&&&&&&&&&&&...&............&&&.....&&&&...&&&&&&&.............@
# @..&&&&&&&&&&&&&.................&&&.....&&&&&&&&&&&&&&...........@
# @..&&&&&&&&&&&&&&&&..............&&&&&&&&&&&&&&&&&&&&&&&&.........@
# @..&&.&&&&&&&&&&&&&&&&&.........&&&&&&&&&&&&&&&&&&&&&&&&&&&.......@
# @...&&..&&&&&&&&&&&&.........&&&&&&&&&&&&&&&&...&&&&&&&&&&&&......@
# @....&..&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&...........&&&&&&&&.....@
# @.......&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&..............&&&&&&&....@
# @.......&&&&&.&&&&&&&&&&&&&&&&&&..&&&&&&&&...&..........&&&&&&....@
# @........&&&.....&&&&&&&&&&&&&.....&&&&&&&&&&...........&..&&&&...@
# @.......&&&........&&&.&&&&&&&&&.....&&&&&.................&&&&...@
# @.......&&&...............&&&&&&&.......&&&&&&&&............&&&...@
# @........&&...................&&&&&&.........................&&&..@
# @.........&.....................&&&&........................&&....@
# @...............................&&&.......................&&......@
# @................................&&......................&&.......@
# @.................................&&..............................@
# @..................................&..............................@
# @.................................................................@
# Description:
###
'''
@Author: WCB
@Date: 2019-12-14 10:43:20
LastEditors: Chuanbin Wang
LastEditTime: 2021-03-24 11:42:49
LastEditors: wcb wcb@sloong.com
LastEditTime: 2022-12-13 16:54:29
@Description: file content
'''
from typing import List
from django import forms
from manage.models import ConfigurationItemModule
from protocol import Core
......@@ -46,10 +110,10 @@ class GlobalConfigForm(forms.Form):
process_thread_quantity = forms.IntegerField(
initial=3, min_value=1, max_value=200)
module_path = forms.CharField(initial="./modules/")
module_type = forms.ChoiceField(
choices=[(int(v), k) for k, v in Core.MODULE_TYPE.__members__.items()], widget=forms.Select(attrs={"onchange": "onModlueTypeChanged();"})
)
module_name = forms.CharField(initial="")
# module_type = forms.ChoiceField(
# choices=[(int(v), k) for k, v in Core.MODULE_TYPE.__members__.items()], widget=forms.Select(attrs={"onchange": "onModlueTypeChanged();"})
# )
module_tags = forms.CharField(initial="")
module_config = forms.CharField(widget=forms.Textarea, initial="")
module_reference = forms.CharField(initial="", required=False)
module_functions = forms.CharField(initial="", required=True)
......@@ -59,45 +123,53 @@ class GlobalConfigForm(forms.Form):
form = GlobalConfigForm()
protocol_data = Core.GLOBAL_CONFIG()
protocol_data.parse(protocol_str)
form.fields['enable_ssl'].initial = protocol_data.enable_s_s_l
form.fields['listen_port'].initial = protocol_data.listen_port
form.fields['cert_file_path'].initial = protocol_data.cert_file_path
form.fields['key_file_path'].initial = protocol_data.key_file_path
form.fields['cert_passwd'].initial = protocol_data.cert_passwd
form.fields['connect_time'].initial = protocol_data.connect_time
form.fields['receive_time'].initial = protocol_data.receive_time
form.fields['log_path'].initial = protocol_data.log_path
form.fields['log_level'].initial = protocol_data.log_level
form.fields['network_thread_quantity'].initial = protocol_data.network_thread_quantity
form.fields['process_thread_quantity'].initial = protocol_data.process_thread_quantity
form.fields['module_path'].initial = protocol_data.module_path
form.fields['module_type'].initial = protocol_data.module_type
form.fields['module_name'].initial = protocol_data.module_name
form.fields['module_config'].initial = protocol_data.module_config.decode()
form.fields['module_reference'].initial = protocol_data.module_reference
form.fields['module_functions'].initial = protocol_data.module_functoins
form.fields['enable_ssl'].initial = protocol_data.network.enable_s_s_l
form.fields['listen_port'].initial = protocol_data.network.listen_port
form.fields['cert_file_path'].initial = protocol_data.network.cert_file_path
form.fields['key_file_path'].initial = protocol_data.network.key_file_path
form.fields['cert_passwd'].initial = protocol_data.network.cert_passwd
form.fields['connect_time'].initial = protocol_data.network.connect_time
form.fields['receive_time'].initial = protocol_data.network.receive_time
form.fields['log_path'].initial = protocol_data.log.path
form.fields['log_level'].initial = protocol_data.log.level
form.fields['network_thread_quantity'].initial = protocol_data.performance.network_thread_quantity
form.fields['process_thread_quantity'].initial = protocol_data.performance.process_thread_quantity
form.fields['module_path'].initial = protocol_data.module.path
form.fields['module_tags'].initial = " ".join(protocol_data.module.required_tags)
form.fields['module_config'].initial = protocol_data.module.config.decode()
form.fields['module_reference'].initial = " ".join(protocol_data.module.reference)
form.fields['module_functions'].initial = " ".join(protocol_data.module.functoins)
return form
def to_protocol(self):
config = Core.GLOBAL_CONFIG()
config.listen_port = int(self.cleaned_data['listen_port'])
config.enable_s_s_l = bool(self.cleaned_data['enable_ssl'])
config.cert_file_path = self.cleaned_data['cert_file_path']
config.key_file_path = self.cleaned_data['key_file_path']
config.cert_passwd = self.cleaned_data['cert_passwd']
config.connect_time = int(self.cleaned_data['connect_time'])
config.receive_time = int(self.cleaned_data['receive_time'])
config.log_path = self.cleaned_data['log_path']
config.log_level = int(self.cleaned_data['log_level'])
config.log_operation = int(0)
config.network_thread_quantity = int(
config.network.listen_port = int(self.cleaned_data['listen_port'])
config.network.enable_s_s_l = bool(self.cleaned_data['enable_ssl'])
config.network.cert_file_path = self.cleaned_data['cert_file_path']
config.network.key_file_path = self.cleaned_data['key_file_path']
config.network.cert_passwd = self.cleaned_data['cert_passwd']
config.network.connect_time = int(self.cleaned_data['connect_time'])
config.network.receive_time = int(self.cleaned_data['receive_time'])
config.log.path = self.cleaned_data['log_path']
config.log.level = int(self.cleaned_data['log_level'])
config.performance.network_thread_quantity = int(
self.cleaned_data['network_thread_quantity'])
config.process_thread_quantity = int(
config.performance.process_thread_quantity = int(
self.cleaned_data['process_thread_quantity'])
config.module_path = self.cleaned_data['module_path']
config.module_type = int(self.cleaned_data['module_type'])
config.module_name = self.cleaned_data['module_name']
config.module_config = self.cleaned_data['module_config'].encode()
config.module_reference = self.cleaned_data['module_reference']
config.module_functoins = self.cleaned_data['module_functions']
config.module.path = self.cleaned_data['module_path']
tags :List[str] = []
for item in self.cleaned_data['module_tags'].split(" "):
tags.append(item.strip())
config.module.required_tags = tags
config.module.config = self.cleaned_data['module_config'].encode()
ref: str =self.cleaned_data['module_reference']
reflist:List[str] = []
for item in ref.split(" "):
item = item.strip()
if len(item) == 0:
continue
reflist.append(item)
config.module.reference = reflist
config.module.functoins = self.cleaned_data['module_functions'].split(" ")
return config
......@@ -21,6 +21,7 @@
<th>Address</th>
<th>UUID</th>
<th>ActiveTime</th>
<th>LogLevel</th>
<td>Option</td>
</tr>
</thead>
......@@ -32,6 +33,10 @@
<td>{{ item.address }}:{{ item.port }}</td>
<td>{{ item.uuid }}</td>
<td>{{ item.active_time }}</td>
<td>
<a href="/settings/node/loglevel/{{ item.uuid }}/"><button type="button" class="btn btn-default">Stop</button></a>
{{ item.log_level }}
</td>
<td>
<a href="/settings/node/stop/{{ item.uuid }}/"><button type="button" class="btn btn-default">Stop</button></a>
<a href="/settings/node/restart/{{ item.uuid }}/"><button type="button" class="btn btn-default">Restart</button></a>
......
version="0.1.3.85"
version="0.1.3.89"
product_text="Sloong Network Engine"
COPYRIGHT_TEXT="Copyright 2015-2022 Sloong.com. All Rights Reserved "
0.1.3.85
0.1.3.89
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment