C++ edjLibrary SDK
|
This SDK is used to develop EDJX serverless functions. Currently, functions are triggered using HTTP only.
Additionally, developers can use the streaming feature while building serverless functions. Streaming optimizes data transfer (upload file/download file) to the EDJX object storage. Using the streaming feature, developers can work with large data sets without allocating huge memory to the functions. Since functions process data as smaller chunks, the use of streaming in functions drastically reduces the response time.
These functions are triggered from standard HTTP methods. The input for the function is an HTTP request object (represented by edjx::request::HttpRequest
in the EDJX SDK) and the return value must be an HTTP response object (represented by edjx::response::HttpResponse
in the EDJX SDK).
EDJX sample code for C++ Serverless Application contains two C++ files:
lib.cpp
serverless_function.cpp
This file contains helper code to fetch HTTP requests and pass the request as input to the serverless function. Additionally, this file has code related to HTTP response processing. Modify this file only when the HTTP response type needs to be changed. See edjx::request::HttpRequest
and edjx::response::HttpResponse
for more details.
This file contains the code to create a serverless function.
Two other important types in the API are edjx::fetch::HttpFetch
and edjx::fetch::FetchResponse
. HttpFetch
is used to execute HTTP requests. FetchResponse
is returned as a response for the Fetch HTTP request.
Currently, all HTTP APIs have a size limit of 512 MB for the HTTP body.
The most important APIs in the EDJX Library SDK are the APIs that are used to interact with the Object Storage (represented by the edjx::storage
namespace in the EDJX SDK) and the KV Store (represented by the edjx::kv
namespace in the EDJX SDK).
The Object Store is a decentralized datastore backed by the EDJX P2P network. This SDK uses GET and PUT methods for file contents and associated attributes.
The KV Store is a decentralized Key-Value datastore backed by the EDJX P2P network. There are specific limits on the size of Key and Value. Key size is limited to 512 bytes and Value is limited to 512 KB.
This API provides functions to log std::string
messages.