make python app load a bit eariler, making startup a bit faster

This commit is contained in:
Alex Bezdieniezhnykh
2025-02-13 18:13:15 +02:00
parent e329e5bb67
commit cfd5483a18
31 changed files with 183 additions and 124 deletions
+10 -1
View File
@@ -1,7 +1,16 @@
namespace Azaion.CommonSecurity.DTO;
using MessagePack;
namespace Azaion.CommonSecurity.DTO;
[MessagePackObject]
public class ApiCredentials(string email, string password) : EventArgs
{
[Key(nameof(Email))]
public string Email { get; set; } = email;
[Key(nameof(Password))]
public string Password { get; set; } = password;
[Key(nameof(Folder))]
public string Folder { get; set; } = null!;
}
@@ -3,22 +3,36 @@
namespace Azaion.CommonSecurity.DTO.Commands;
[MessagePackObject]
public class RemoteCommand(CommandType commandType, string? filename = null, byte[]? data = null)
public class RemoteCommand(CommandType commandType, byte[]? data = null)
{
[Key("CommandType")]
public CommandType CommandType { get; set; } = commandType;
[Key("Filename")]
public string? Filename { get; set; } = filename;
[Key("Data")]
public byte[]? Data { get; set; } = data;
public static byte[] Serialize<T>(CommandType commandType, T data) where T : class
{
var dataBytes = MessagePackSerializer.Serialize(data);
return MessagePackSerializer.Serialize(new RemoteCommand(commandType, dataBytes ));
}
}
[MessagePackObject]
public class LoadFileData(string filename, string? folder = null )
{
[Key(nameof(Folder))]
public string? Folder { get; set; } = folder;
[Key(nameof(Filename))]
public string Filename { get; set; } = filename;
}
public enum CommandType
{
None = 0,
GetUser = 10,
Login = 10,
Load = 20,
Inference = 30,
StopInference = 40,
+2 -2
View File
@@ -6,8 +6,8 @@ namespace Azaion.CommonSecurity.DTO;
[MessagePackObject]
public class User
{
[Key("i")]public string Id { get; set; }
[Key("e")]public string Email { get; set; }
[Key("i")] public string Id { get; set; } = "";
[Key("e")] public string Email { get; set; } = "";
[Key("r")]public RoleEnum Role { get; set; }
//For deserializing