Update API definition

This commit is contained in:
Blue 2025-11-06 13:42:32 -08:00
parent db9d340774
commit b4018e37ed

View File

@ -182,6 +182,15 @@ enum WSLA_CONTAINER_STATE
// TODO: More states might be added to reflect all nerdctl's states. // TODO: More states might be added to reflect all nerdctl's states.
}; };
struct WSLA_CONTAINER
{
LPCWSTR Name;
LPCWSTR Image;
enum WSLA_CONTAINER_STATE State;
// TODO: Add creation timestamp and other fields that the command line tool might want to display.
};
enum WSLA_PROCESS_STATE enum WSLA_PROCESS_STATE
{ {
WslaProcessStateUnknown = 0, WslaProcessStateUnknown = 0,
@ -215,10 +224,14 @@ interface IWSLAContainer : IUnknown
{ {
HRESULT Start(); HRESULT Start();
HRESULT Stop([in] int Signal, [in] ULONG TimeoutMs); HRESULT Stop([in] int Signal, [in] ULONG TimeoutMs);
HRESULT Delete(); HRESULT Delete(); // TODO: Look into lifetime logic.
HRESULT GetState([out] enum WSLA_CONTAINER_STATE* State); HRESULT GetState([out] enum WSLA_CONTAINER_STATE* State);
HRESULT GetInitProcess([out] IWSLAProcess** Process); HRESULT GetInitProcess([out] IWSLAProcess** Process);
HRESULT Exec([in] struct WSLA_PROCESS_OPTIONS* Options, [out] IWSLAProcess** Process); HRESULT Exec([in] struct WSLA_PROCESS_OPTIONS* Options, [out] IWSLAProcess** Process);
// Anonymous host port allocation (P1).
//HRESULT AllocateHostPort([in] LPCSTR Name, [in] USHORT ContainerPort, [out] USHORT* AllocatedHostPort);
//HRESULT ReleaseHostPort([in] USHORT HostPort);
} }
[ [
@ -230,16 +243,14 @@ interface IWSLASession : IUnknown
{ {
// Image management. // Image management.
HRESULT PullImage([in] LPCWSTR Image, [in, unique] struct WSLA_REGISTRY_AUTHENTICATION_INFORMATION* RegistryInformation, [in, unique] IProgressCallback* ProgressCallback); HRESULT PullImage([in] LPCWSTR Image, [in, unique] struct WSLA_REGISTRY_AUTHENTICATION_INFORMATION* RegistryInformation, [in, unique] IProgressCallback* ProgressCallback);
HRESULT ImportImage([in] ULONG Handle, [in] LPCWSTR Image, [in, unique] IProgressCallback* ProgressCallback);
HRESULT ListImages([out, size_is(, *Count)] struct WSLA_IMAGE_INFORMATION** Images, [out] ULONG* Count); HRESULT ListImages([out, size_is(, *Count)] struct WSLA_IMAGE_INFORMATION** Images, [out] ULONG* Count);
HRESULT DeleteImage([in] LPCWSTR Image); HRESULT DeleteImage([in] LPCWSTR Image);
// Container management. // Container management.
HRESULT CreateContainer([in] struct WSLA_CONTAINER_OPTIONS* Options); HRESULT CreateContainer([in] struct WSLA_CONTAINER_OPTIONS* Options, [out] IWSLAContainer** Container);
// TODO: Methods to list & open containers. HRESULT OpenContainer([in] LPCWSTR Name, [out] IWSLAContainer** Container);
HRESULT ListContainers([out, size_is(, *Count)] struct WSLA_CONTAINER** Images, [out] ULONG* Count);
// Anonymous host port allocation (P1).
HRESULT AllocateHostPort([in] LPCSTR Name, [in] USHORT ContainerPort, [out] USHORT* AllocatedHostPort);
HRESULT ReleaseHostPort([in] USHORT HostPort);
// Create a process at the VM level. This is meant for debugging. // Create a process at the VM level. This is meant for debugging.
HRESULT CreateRootNamespaceProcess([in] struct WSLA_PROCESS_OPTIONS* Options, [out] IWSLAProcess** Process); HRESULT CreateRootNamespaceProcess([in] struct WSLA_PROCESS_OPTIONS* Options, [out] IWSLAProcess** Process);