Browse Source

refactor sync op log

arthur.wu 2 years ago
parent
commit
748629120d

+ 11 - 0
src/InteractionCenter/InteractionCenterService.cs

@@ -0,0 +1,11 @@
+using WingServerCommon.Service;
+using WingInterfaceLibrary.Interface.DBInterface;
+
+namespace src.InteractionCenter
+{
+    public class InteractionCenterService : JsonRpcService
+    {
+        protected IOpLogDBService OpLogDBService;
+        
+    }
+}

+ 45 - 0
src/InteractionCenter/MasterInteractionCenterService.cs

@@ -0,0 +1,45 @@
+using System;
+using WingServerCommon.Service;
+using WingInterfaceLibrary.OpLog;
+using System.Threading.Tasks;
+using System.Collections.Generic;
+using WingInterfaceLibrary.Interface.DBInterface;
+
+namespace src.InteractionCenter
+{
+    public class MasterInteractionCenterService : InteractionCenterService, IMasterInteractionCenterService
+    {
+        protected IOpLogDBService OpLogDBService;
+        public override void Load(JsonRpcClientPool jsonRpcClientPool)
+        {
+            base.Load(jsonRpcClientPool);
+            OpLogDBService = GetProxy<IOpLogDBService>();                        
+        }
+
+        
+        /// <summary>
+        /// Get op logs from master server
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns>The op log list</returns>
+        public async Task<List<OperationLogDTO>> GetOpLogsFromMaster(GetOpLogsFormMasterRequest request)
+        {            
+            return await OpLogDBService.GetOpLog(request);
+        }     
+
+        /// <summary>
+        /// Synchronize op log to master server
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        public async Task<bool> SyncOpLogToMaster(SyncOpLogToMasterRequest request)
+        {            
+            return await OpLogDBService.SyncOpLog(request);
+        }           
+    }
+
+    public class SlaveInteractionCenterService : InteractionCenterService, ISlaveInteractionCenterService
+    {
+                  
+    }
+}

+ 2 - 1
src/WingCloudServer.csproj

@@ -7,7 +7,8 @@
 
   <ItemGroup>    
     <PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="5.0.0" />
-    <PackageReference Include="WingServerCommon" Version="*" />
+    <PackageReference Include="WingInterfaceLibrary" Version="1.0.6.3" />
+    <PackageReference Include="WingServerCommon" Version="1.0.0.26" />
   </ItemGroup>
   
   <ItemGroup>

+ 14 - 1
src/WingServer.cs

@@ -120,8 +120,21 @@ namespace WingCloudServer
                 method.Invoke(service.Value, new object[] { rpcClientPool });
             }
 
+            //load service if distrubuted system
+            if (ConfigurationManager.IsDistributed)
+            {
+                if(ConfigurationManager.IsMaster)
+                {
+                    //_rpcHttpServer.RegisterService(IMaster); TODO
+                }
+                else
+                {
+                    //TODO
+                }
+            }
+
             //load extdll
-            InitSkiaSharp();
+            InitSkiaSharp(); //TODO should not copy skiasharp dll here
         }
 
         private Type LoadService(string folder, object serviceName)