Skip to main content

luna.kernel.api

KernelConfig Objects

@dataclass
class KernelConfig()

Dataclass representing the configuration settings for the Luna kernel.

Attributes: engine_url (str): URL of the Luna engine. token (str): Authentication token for Luna engine access. contract_id (str): Unique identifier for a Luna contract.

KernelApi Objects

class KernelApi(ABC)

Abstract base class defining the API for Luna's kernel.

This class serves as a template for implementing the interactions with Luna's kernel, specifying the fundamental operations necessary for managing contracts and their states.

add_contract

@abstractmethod
def add_contract(req: types.AddContractRequest) -> types.AddContractResponse

Abstract method for adding a contract to the Luna kernel.

Args: req (types.AddContractRequest): The request object containing contract details.

Returns: types.AddContractResponse: The response object with details of the added contract.

tick

@abstractmethod
def tick(req: types.TickRequest) -> types.TickResponse

Abstract method to process the current state of contracts.

Args: req (types.TickRequest): The request object containing tick-related information.

Returns: types.TickResponse: The response object after processing the tick.

template_info

@abstractmethod
def template_info(
req: types.TemplateInfoRequest) -> types.TemplateInfoResponse

Abstract method to retrieve information about a specific template.

Args: req (types.TemplateInfoRequest): The request object containing template identification.

Returns: types.TemplateInfoResponse: The response object with detailed information about the template.

project_info

@abstractmethod
def project_info(req: types.ProjectInfoRequest) -> types.ProjectInfoResponse

Abstract method to retrieve information about a specific project.

Args: req (types.ProjectInfoRequest): The request object containing project.

Returns: types.ProjectInfoResponse: The response object with detailed information about the project.

contract_info

@abstractmethod
def contract_info(
req: types.ContractInfoRequest) -> types.ContractInfoResponse

Abstract method to retrieve information about a specific contract.

Args: req (types.ContractInfoRequest): The request object containing contract identification.

Returns: types.ContractInfoResponse: The response object with detailed information about the contract.

validate_parameters

@abstractmethod
def validate_parameters(
req: types.ValidateParametersRequest
) -> types.ValidateParametersResponse

Abstract method to validate the parameters of a contract or template.

Args: req (types.ValidateParametersRequest): The request object containing parameters to be validated.

Returns: types.ValidateParametersResponse: The response object indicating the validation result.

put_event

@abstractmethod
def put_event(req: types.PutEventRequest) -> types.PutEventResponse

Abstract method to handle and process events in the Luna kernel.

Args: req (types.PutEventRequest): The request object containing event-related information.

Returns: types.PutEventResponse: The response object after processing the event.