Skip to content

Commit

Permalink
v3.0 引入全新Remoting架构,排除基础模型类,统一由Remoting提供。下游项目可能有引用这些模型类,需要调整命名空间,特别是…
Browse files Browse the repository at this point in the history
…IoT相关项目。
  • Loading branch information
nnhy committed Jun 23, 2024
1 parent edfec02 commit 1035a3e
Show file tree
Hide file tree
Showing 23 changed files with 111 additions and 81 deletions.
1 change: 1 addition & 0 deletions StarAgent/StarService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using NewLife.Model;
using NewLife.Net;
using NewLife.Remoting;
using NewLife.Remoting.Models;
using NewLife.Threading;
using Stardust;
using Stardust.Managers;
Expand Down
2 changes: 1 addition & 1 deletion Stardust.Data/Entity/Model.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
<Column Name="Argument" DataType="String" Length="500" Description="参数" />
<Column Name="StartTime" DataType="DateTime" Description="开始执行时间。用于提前下发指令后延期执行,暂时不支持取消" />
<Column Name="Expire" DataType="DateTime" Description="过期时间。未指定时表示不限制" />
<Column Name="Status" DataType="Int32" Description="状态。命令状态" Type="Stardust.Models.CommandStatus" />
<Column Name="Status" DataType="Int32" Description="状态。命令状态" Type="NewLife.Remoting.Models.CommandStatus" />
<Column Name="Times" DataType="Int32" Description="次数。一共执行多少次,超过10次后取消" />
<Column Name="Result" DataType="String" Length="500" Description="结果" />
<Column Name="TraceId" DataType="String" Description="追踪。最新一次查看采样,可用于关联多个片段,建立依赖关系,随线程上下文、Http、Rpc传递" Category="扩展" />
Expand Down
3 changes: 1 addition & 2 deletions Stardust.Data/Entity/应用命令.Biz.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
using NewLife;
using NewLife.Data;
using NewLife.Log;
using Stardust.Models;
using NewLife.Remoting.Models;
using XCode;
using XCode.Membership;

namespace Stardust.Data;

Expand Down
6 changes: 3 additions & 3 deletions Stardust.Data/Entity/应用命令.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ public partial class AppCommand
[BindColumn("Expire", "过期时间。未指定时表示不限制", "")]
public DateTime Expire { get => _Expire; set { if (OnPropertyChanging("Expire", value)) { _Expire = value; OnPropertyChanged("Expire"); } } }

private Stardust.Models.CommandStatus _Status;
private NewLife.Remoting.Models.CommandStatus _Status;
/// <summary>状态。命令状态</summary>
[DisplayName("状态")]
[Description("状态。命令状态")]
[DataObjectField(false, false, false, 0)]
[BindColumn("Status", "状态。命令状态", "")]
public Stardust.Models.CommandStatus Status { get => _Status; set { if (OnPropertyChanging("Status", value)) { _Status = value; OnPropertyChanged("Status"); } } }
public NewLife.Remoting.Models.CommandStatus Status { get => _Status; set { if (OnPropertyChanging("Status", value)) { _Status = value; OnPropertyChanged("Status"); } } }

private Int32 _Times;
/// <summary>次数。一共执行多少次,超过10次后取消</summary>
Expand Down Expand Up @@ -205,7 +205,7 @@ public override Object this[String name]
case "Argument": _Argument = Convert.ToString(value); break;
case "StartTime": _StartTime = value.ToDateTime(); break;
case "Expire": _Expire = value.ToDateTime(); break;
case "Status": _Status = (Stardust.Models.CommandStatus)value.ToInt(); break;
case "Status": _Status = (NewLife.Remoting.Models.CommandStatus)value.ToInt(); break;
case "Times": _Times = value.ToInt(); break;
case "Result": _Result = Convert.ToString(value); break;
case "TraceId": _TraceId = Convert.ToString(value); break;
Expand Down
2 changes: 1 addition & 1 deletion Stardust.Data/Nodes/Model.xml
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
<Column Name="Argument" DataType="String" Length="500" Description="参数" />
<Column Name="StartTime" DataType="DateTime" Description="开始执行时间。用于提前下发指令后延期执行,暂时不支持取消" />
<Column Name="Expire" DataType="DateTime" Description="过期时间。未指定时表示不限制" />
<Column Name="Status" DataType="Int32" Description="状态。命令状态" Type="Stardust.Models.CommandStatus" />
<Column Name="Status" DataType="Int32" Description="状态。命令状态" Type="NewLife.Remoting.Models.CommandStatus" />
<Column Name="Times" DataType="Int32" Description="次数。一共执行多少次,超过10次后取消" />
<Column Name="Result" DataType="String" Length="500" Description="结果" />
<Column Name="TraceId" DataType="String" Description="追踪。最新一次查看采样,可用于关联多个片段,建立依赖关系,随线程上下文、Http、Rpc传递" Category="扩展" />
Expand Down
3 changes: 2 additions & 1 deletion Stardust.Data/Nodes/节点命令.Biz.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using NewLife;
using NewLife.Data;
using NewLife.Log;
using NewLife.Remoting.Models;
using Stardust.Models;
using XCode;

Expand Down Expand Up @@ -77,7 +78,7 @@ public static NodeCommand FindById(Int32 id)
/// <param name="nodeId">节点</param>
/// <param name="status">状态</param>
/// <returns>实体列表</returns>
public static IList<NodeCommand> FindAllByNodeIDAndStatus(Int32 nodeId, Stardust.Models.CommandStatus status)
public static IList<NodeCommand> FindAllByNodeIDAndStatus(Int32 nodeId, CommandStatus status)
{
// 实体缓存
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.NodeID == nodeId && e.Status == status);
Expand Down
6 changes: 3 additions & 3 deletions Stardust.Data/Nodes/节点命令.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ public partial class NodeCommand
[BindColumn("Expire", "过期时间。未指定时表示不限制", "")]
public DateTime Expire { get => _Expire; set { if (OnPropertyChanging("Expire", value)) { _Expire = value; OnPropertyChanged("Expire"); } } }

private Stardust.Models.CommandStatus _Status;
private NewLife.Remoting.Models.CommandStatus _Status;
/// <summary>状态。命令状态</summary>
[DisplayName("状态")]
[Description("状态。命令状态")]
[DataObjectField(false, false, false, 0)]
[BindColumn("Status", "状态。命令状态", "")]
public Stardust.Models.CommandStatus Status { get => _Status; set { if (OnPropertyChanging("Status", value)) { _Status = value; OnPropertyChanged("Status"); } } }
public NewLife.Remoting.Models.CommandStatus Status { get => _Status; set { if (OnPropertyChanging("Status", value)) { _Status = value; OnPropertyChanged("Status"); } } }

private Int32 _Times;
/// <summary>次数。一共执行多少次,超过10次后取消</summary>
Expand Down Expand Up @@ -206,7 +206,7 @@ public override Object this[String name]
case "Argument": _Argument = Convert.ToString(value); break;
case "StartTime": _StartTime = value.ToDateTime(); break;
case "Expire": _Expire = value.ToDateTime(); break;
case "Status": _Status = (Stardust.Models.CommandStatus)value.ToInt(); break;
case "Status": _Status = (NewLife.Remoting.Models.CommandStatus)value.ToInt(); break;
case "Times": _Times = value.ToInt(); break;
case "Result": _Result = Convert.ToString(value); break;
case "TraceId": _TraceId = Convert.ToString(value); break;
Expand Down
2 changes: 1 addition & 1 deletion Stardust.Extensions/Stardust.Extensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Description>星尘,分布式服务框架扩展。节点管理,监控中心,配置中心,发布中心,注册中心</Description>
<Company>新生命开发团队</Company>
<Copyright>©2002-2024 NewLife</Copyright>
<VersionPrefix>2.9</VersionPrefix>
<VersionPrefix>3.0</VersionPrefix>
<VersionSuffix>$([System.DateTime]::Now.ToString(`yyyy.MMdd`))</VersionSuffix>
<Version>$(VersionPrefix).$(VersionSuffix)</Version>
<FileVersion>$(Version)</FileVersion>
Expand Down
5 changes: 3 additions & 2 deletions Stardust.Server/Controllers/AppController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using NewLife.Http;
using NewLife.Log;
using NewLife.Remoting;
using NewLife.Remoting.Models;
using NewLife.Serialization;
using Stardust.Data;
using Stardust.Data.Configs;
Expand Down Expand Up @@ -190,7 +191,7 @@ private async Task ConsumeMessage(WebSocket socket, App app, String clientId, St
{
WriteHistory("WebSocket发送", false, "消息无效或已过期。" + mqMsg, clientId, ip);

var log = AppCommand.FindById(msg.Id);
var log = AppCommand.FindById((Int32)msg.Id);
if (log != null)
{
if (log.TraceId.IsNullOrEmpty()) log.TraceId = span?.TraceId;
Expand All @@ -205,7 +206,7 @@ private async Task ConsumeMessage(WebSocket socket, App app, String clientId, St
// 向客户端传递埋点信息,构建完整调用链
msg.TraceId = span + "";

var log = AppCommand.FindById(msg.Id);
var log = AppCommand.FindById((Int32)msg.Id);
if (log != null)
{
if (log.TraceId.IsNullOrEmpty()) log.TraceId = span?.TraceId;
Expand Down
5 changes: 3 additions & 2 deletions Stardust.Server/Controllers/NodeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using NewLife.Http;
using NewLife.Log;
using NewLife.Remoting;
using NewLife.Remoting.Models;
using NewLife.Serialization;
using NewLife.Web;
using Stardust.Data.Deployment;
Expand Down Expand Up @@ -343,7 +344,7 @@ private async Task ConsumeMessage(WebSocket socket, Node node, String ip, Cancel
{
WriteHistory(node, "WebSocket发送", false, "消息无效或已过期。" + mqMsg, ip);

var log = NodeCommand.FindById(msg.Id);
var log = NodeCommand.FindById((Int32)msg.Id);
if (log != null)
{
if (log.TraceId.IsNullOrEmpty()) log.TraceId = span?.TraceId;
Expand All @@ -358,7 +359,7 @@ private async Task ConsumeMessage(WebSocket socket, Node node, String ip, Cancel
// 向客户端传递埋点信息,构建完整调用链
msg.TraceId = span + "";

var log = NodeCommand.FindById(msg.Id);
var log = NodeCommand.FindById((Int32)msg.Id);
if (log != null)
{
if (log.TraceId.IsNullOrEmpty()) log.TraceId = span?.TraceId;
Expand Down
3 changes: 1 addition & 2 deletions Stardust.Server/Services/AppQueueService.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using NewLife.Caching;
using NewLife.Log;
using NewLife.Remoting.Models;
using NewLife.Serialization;
using Stardust.Models;

namespace Stardust.Server.Services;

Expand Down
6 changes: 3 additions & 3 deletions Stardust.Server/Services/NodeService.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Reflection;
using NewLife;
using NewLife;
using NewLife.Caching;
using NewLife.Log;
using NewLife.Remoting;
using NewLife.Remoting.Models;
using NewLife.Security;
using NewLife.Serialization;
using NewLife.Web;
Expand Down Expand Up @@ -576,7 +576,7 @@ public void RemoveOnline(Node node)
/// <returns></returns>
public Int32 CommandReply(Node node, CommandReplyModel model, String token)
{
var cmd = NodeCommand.FindById(model.Id);
var cmd = NodeCommand.FindById((Int32)model.Id);
if (cmd == null) return 0;

cmd.Status = model.Status;
Expand Down
3 changes: 2 additions & 1 deletion Stardust.Server/Services/RegistryService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using NewLife;
using NewLife.Log;
using NewLife.Remoting;
using NewLife.Remoting.Models;
using NewLife.Security;
using NewLife.Serialization;
using Stardust.Data;
Expand Down Expand Up @@ -410,7 +411,7 @@ public async Task<AppCommand> SendCommand(App app, String command, String argume

public AppCommand CommandReply(App app, CommandReplyModel model)
{
var cmd = AppCommand.FindById(model.Id);
var cmd = AppCommand.FindById((Int32)model.Id);
if (cmd == null) return null;

// 防止越权
Expand Down
1 change: 1 addition & 0 deletions Stardust.ServerTests/Controllers/WebSocketTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using NewLife.Log;
using NewLife.Model;
using NewLife.Remoting;
using NewLife.Remoting.Models;
using NewLife.Security;
using NewLife.Serialization;
using NewLife.Threading;
Expand Down
1 change: 1 addition & 0 deletions Stardust/AppClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Stardust.Services;
using NewLife.Caching;
using System.Net.NetworkInformation;
using NewLife.Remoting.Models;

#if NET45_OR_GREATER || NETCOREAPP || NETSTANDARD
using System.Net.WebSockets;
Expand Down
1 change: 1 addition & 0 deletions Stardust/LocalStarClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using NewLife.Log;
using NewLife.Messaging;
using NewLife.Remoting;
using NewLife.Remoting.Models;
using Stardust.Models;
#if NET45_OR_GREATER || NETCOREAPP || NETSTANDARD
using TaskEx = System.Threading.Tasks.Task;
Expand Down
1 change: 1 addition & 0 deletions Stardust/Managers/ServiceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using NewLife.Http;
using NewLife.IO;
using NewLife.Log;
using NewLife.Remoting.Models;
using NewLife.Serialization;
using NewLife.Threading;
using Stardust.Models;
Expand Down
43 changes: 27 additions & 16 deletions Stardust/Models/LoginInfo.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
namespace Stardust.Models;
using NewLife.Remoting.Models;

namespace Stardust.Models;

/// <summary>节点登录信息</summary>
public class LoginInfo
public class LoginInfo : ILoginRequest
{
#region 属性
/// <summary>节点编码</summary>
Expand All @@ -13,25 +15,34 @@ public class LoginInfo
/// <summary>产品编码</summary>
public String? ProductCode { get; set; }

/// <summary>实例。应用可能多实例部署,ip@proccessid</summary>
public String? ClientId { get; set; }

/// <summary>版本</summary>
public String? Version { get; set; }

/// <summary>节点信息</summary>
public NodeInfo? Node { get; set; }
#endregion
}

/// <summary>节点登录响应</summary>
public class LoginResponse
{
#region 属性
/// <summary>节点编码</summary>
public String? Code { get; set; }
///// <summary>节点登录响应</summary>
//public class LoginResponse : ILoginResponse
//{
// #region 属性
// /// <summary>节点编码</summary>
// public String? Code { get; set; }

/// <summary>节点密钥</summary>
public String? Secret { get; set; }
// /// <summary>节点密钥</summary>
// public String? Secret { get; set; }

/// <summary>名称</summary>
public String? Name { get; set; }
// /// <summary>名称</summary>
// public String? Name { get; set; }

/// <summary>令牌</summary>
public String? Token { get; set; }
#endregion
}
// /// <summary>令牌</summary>
// public String? Token { get; set; }

// /// <summary>服务器时间。Unix毫秒(UTC)</summary>
// public Int64 Time { get; set; }
// #endregion
//}
Loading

0 comments on commit 1035a3e

Please sign in to comment.