Methods

These are the operations that can be performed on the Microservices Manager contract.

Read Operations

function size() external view returns (uint256);

Retrieves the number (length) of microservices managed by the Microservices Manager.

function all() external view returns (Microservice[] memory);

Retrieves each microservice's data (Microservice struct).

function partialList(uint256 start, uint256 offset) external view returns (Microservice[] memory);

Pass a range position (start and offset) in the function for it to return an array that contains the Microservice struct for each microservice of the range.

function list(string[] calldata keys) external view returns (Microservice[] memory);

Pass an array of one or more microservice's keys (i.e names) in the function for it to retrieve each microservice's data (Microservice struct).

function listByIndices(uint256[] calldata indices) external view returns (Microservice[] memory);

Pass an array of one or more microservice's indices in the function for it to retrieve each microservice's data (Microservice struct).

function exists(string calldata key) external view returns(bool result, uint256 index);

Pass a microservice key (i.e name) in the function for it to retrieve if the key exists (true)--i.e. the key corresponds to a microservice--or not (false).

function get(string calldata key) external view returns(Microservice memory);

Pass a microservice key (i.e name) in the function to retrieve its data (Microservice struct).

function getByIndex(uint256 index) external view returns(Microservice memory);

Pass a microservice index in the function to retrieve its data (Microservice struct).

Write Operations

function set(Microservice calldata newValue) external returns(Microservice memory replacedValue);

Pass a Microservice struct in this function for it add a new microservice to the Microservices Manager.

If the key passed in the struct corresponds to a variable that already exists in the Microservice Manager, it is replaced with the new one. In this case, the function returns the replaced value.

function batchSet(Microservice[] calldata newValues) external returns(Microservice[] memory replacedValues);

Pass an array of Microservice structs in this function for it add multiple new microservices to the Microservices Manager.

If the keys passed in the struct correspond to microservices that already exists in the Microservice Manager, they are replaced with the new one. In this case, the function returns the replaced values.

function remove(string calldata key) external returns(Microservice memory removedValue);

Pass a microservice key in this function for it to remove a microservice from the Microservices Manager. The function returns the removed microservice's value.

function batchRemove(string[] calldata keys) external returns(Microservice[] memory removedValues);

Pass an array of microservice keys in this function for it to remove those microservices from the Microservices Manager. The function output returns the removed microservices' values.

function removeByIndices(uint256[] calldata indices) external returns(Microservice[] memory removedValues);

Pass an array of microservice indices to remove those microservices from the Microservices Manager. The function output returns the removed microservices' values.

Note

To avoid side effects or undesired transaction reverts, the array of indices must be passed by force in descending order. For example: If you want to delete the variables at indexes 9, 18 and 13, pass the array ordered as [18, 13, 9]. This will ensure the function behavior is respected correctly.

Microservice Code Execution

function read(string calldata key, bytes calldata data) external view returns(bytes memory returnData);

This function allows a microservice to be executed in read mode.

Pass the microservice key (microservice name) and a payload in the function, which will call the microservice and retrieve its location by key. Even the payload will be passed to microservice location address.

function submit(string calldata key, bytes calldata data) external payable returns(bytes memory returnData);

This function allows a microservice to be executed in submit mode.

Pass the microservice key (microservice name) and a payload in the function, which will call the microservice and retrieve its location by key. Even the payload will be passed to microservice location address.

Last updated