This document outlines the structure and purpose of the main files inside the SharpCore Kernel and its related modules: Staging
, Logging
, and Core
logic. Each section explains the responsibility of each file or module to assist future contributors and users.
- Role: Entry point for standalone kernel execution.
- Description: Launches the kernel manually without CLI or GUI.
- Use case: Direct execution for testing or embedded systems.
-
Role: High-level kernel runner.
-
Methods:
Run(string payloadPath, string protocol, string adapter)
: Fetches the protocol handler, starts the bridge, sends JSON payload.
- Role: Interface for protocol creation.
- Implements: CreateBridge();
- Implemented by: ProtocolFactory.cs
- Role: Provides protocol handlers dynamically.
- Pattern: Factory Pattern with
switch
ormap
lookup. - Example protocols: NamedPipe, gRPC, UnixSocket.
-
Role: Interface for any communication bridge.
-
Methods:
Start()
– Initiates the protocol listener.Send(string)
– Sends a string to the connected target.
-
Role: Named Pipe implementation of
IBridgeConnection
andIProtocol
. -
Responsibilities:
- Handles IPC via named pipes.
- Deserializes payloads and manages staging.
- Role: Optional helper to transform JSON to specific structures.
- Not always necessary unless working with complex nested payloads.
- Role: Final entry point for mod adapters.
- Implements:
IInstructionAdapter
- Communicates with: Java or other runtime.
- Role: Named pipe handler.
- Returned by: ProtocolFactory.
- Creates: instances of
NamedPipeBridgeConnection
.
-
Role: Payload structure.
-
Properties:
Tipo
,Entidad
, and other mod-related fields.
-
Serialized from JSON inside the bridge.
-
Role: Core of the staging system.
-
Functions:
MSadd()
,MScommit()
,MSrevert()
-
Handles: rollbacks, commits and validation flows.
- Role: Interface to talk with external platforms.
- Implemented by: FinishAdapterLayer (and others).
- Role: Validates the payload before staging.
- Called by: Kernel before commit or revert.
- Role: Applies staging logic.
- Could call: scripting runtimes, native APIs, etc.
- Role: Final check before committing.
- Optional, but can prevent runtime crashes.
-
Role: Static logger used across core and CLI.
-
Backend: Serilog.
-
Methods:
Panic(string, Exception?)
– Logs to file and crashes.Info(string)
– Info logs.Warn(string)
– Warnings.Debug(string)
– Verbose logs.
- Expose
.Init(logPath)
method to dynamically set log directories depending on whether it's running from CLI or kernel.