Query Process

Understanding the behind-the-scenes flow of API-based database queries

Query Process

When you make a call to the Arcsec API wiht a valid JSON payload and a SQL query, several steps occur behind the scenes to ensure secure and efficient database operations. Here's an overview of the query flow:

Input Validation

The API checks if all required fields are present in the request.

Database Retrieval

It fetches the user's databases and finds the one matching the provided dbId.

API Key Verification

The provided API key is checked against the stored API keys for the database.

Database Download and Decryption

The database file is downloaded from IPFS using the stored URI and decrypted using the user's encryption key.

Query Execution

The database file is temporarily stored in memory. The SQL query is executed on this temporary file.

  • For read queries, results are fetched.
  • For modification queries, changes are applied.

IPFS Update (for modification queries)

The updated database file is encrypted and uploaded to IPFS. The old IPFS file is unpinned. The new IPFS URI is stored in the database to stay consistent.

Cleanup

The temporary database file is deleted from memory.

###Response The API returns the query results or confirmation of changes.

This process ensures that your data remains encrypted and secure throughout the operation, leveraging the benefits of decentralized storage while providing the functionality of a traditional database.

Seeral improvements are planned to optimize the query process even further. These include:

  • ORM Support: Implementing Object-Relational Mapping (ORM) support to streamline database operations and reduce the need for raw SQL queries.
  • TEE Support: Utilizing Intel SGX enclaves to run the query process within a secure enclave, preventing any unauthorized access to the data.
  • Fleek Integration: Integrating with Fleek Network services to streamline the database operations and ensure low latency and high throughput.
  • Caching Mechanism: Implementing a caching mechanism to store frequently accessed databases in memory for faster access.
  • Batch Processing: Allowing for batch processing of multiple queries to optimize performance.
  • User Feedback: Gathering user feedback to continuously improve the query process and address any issues or bottlenecks.