EdgeStore API Reference Guide
EdgeStore API Reference Guide
The RPC APIs in Theta EdgeStore are primarily used for interacting with the EdgeNode, which involves operations such as querying node status, uploading, and retrieving data. Specifically, methods like GetVersion and GetStatus provide details about the EdgeStore version and its operational status, respectively. Uploads and retrievals of text data and files are other key functionalities facilitated through methods like PutData and GetData . On the other hand, REST APIs are designed mainly for content serving. They serve files by retrieving them by their keys and relative paths, helping in direct user access over HTTP protocols . These two sets of APIs together offer a comprehensive interface for both backend data management and user-facing content delivery.
The EdgeStore API maintains file integrity through its RPC API by associating a unique key to each uploaded file or directory. When files are uploaded using the PutFile method, a key is generated which acts as a reference to access the file later through methods like GetFile. This key-based retrieval system ensures that the data accessed is exactly what was uploaded, as any data modifications would result in a mismatch of keys . Additionally, directory uploads ensure that all files and subdirectories are processed recursively and can be accurately reconstructed, validating whole-tree integrity .
The GetStatus method queries the status of a Theta EdgeStore node, returning useful information such as the node's ID and current operational time, which helps in monitoring the node's activity and health . Meanwhile, the GetPeers method provides a list of peer nodes that the queried node is connected to. This facilitates network topology mapping, troubleshooting, and optimization by allowing administrators to understand node connectivity and peer interactions within the EdgeStore. Together, these methods equip users with the information needed for effective network maintenance and scaling .
The concurrent operation of HTTP and RPC servers in Theta EdgeStore offers significant advantages for large-scale decentralized content delivery networks. This dual-server setup ensures that both internal network operations (via RPC) and external content access (via HTTP) can be handled simultaneously without performance bottlenecks. Such a configuration enhances scalability and reliability, allowing efficient handling of data requests and distribution across a potentially vast user base. This separation of responsibilities facilitates more stable, manageable network traffic profiles, aligning with the high-demand requirements of large-scale content delivery .
The Theta EdgeStore utilizes the key parameter to reconstruct complex file structures during directory retrieval by associating a unique key with the whole directory upon upload. When retrieved, the GetFile method uses this key to fetch and reassemble the entire directory structure, including all files and nested subdirectories, accurately restoring the original hierarchy. This functionality is crucial as it ensures data consistency and integrity, preserving the context and relationships between files which is essential in scenarios like software repositories or multi-file datasets, where the structure impacts usability and data analysis .
The Theta EdgeStore supports the uploading of directories (including multiple levels of subdirectories), which significantly enhances its functionality. This capability enables the storage of complex data structures in a single operation, maintaining their internal hierarchy and relationships. By doing so, EdgeStore can reconstruct the exact structure during retrieval, allowing for processes that require complete data environments, such as batch processing or data analysis. This is a marked improvement over systems limited to single file uploads, which necessitate manual effort to preserve the context and structure of multiple related files, reducing efficiency and increasing the potential for error .
The PutData method in the Theta EdgeStore API allows users to upload data in the form of a text string into the network. Upon successful upload, the method returns a key that acts as a unique identifier for the uploaded data. This key is essential for the subsequent retrieval of the data through the GetData method, ensuring that users can access their data reliably and verifiably. It essentially creates a direct, secure linkage between the data stored and its retrieval mechanism, thereby enhancing data management and accessibility within the EdgeStore ecosystem .
The Theta EdgeStore API's file serving functionality through REST APIs enhances user accessibility by providing a straightforward HTTP interface for accessing files. Users can specify keys and relative paths to retrieve files via HTTP GET requests, which are common and well-supported across various platforms and languages. This approach simplifies integration into existing web applications and services. Additionally, it includes options like the 'pathonly' parameter, which allows users to control the extent of information retrieved, optimizing bandwidth usage and processing time. Such features make content management more efficient and accessible for diverse user requirements and environments .
Using EdgeStore's JSON-RPC API offers strategic advantages such as seamless integration for developers working with blockchain and decentralized applications (dApps). The JSON-RPC interface provides consistency and familiarity for developers accustomed to JSON-based operations, facilitating easier adoption and integration. It allows precise and flexible data operations such as uploading, retrieving, and querying nodes, which are crucial for dApp functionalities. This direct method of interaction aligns well with the decentralized ethos by enabling applications to engage with blockchain data without centralized intermediary systems, enhancing application efficiency and user control over data operations .
The Theta EdgeStore allows for the customization of its HTTP and RPC servers primarily by adjusting the ports they operate on, which can be modified in the config.yaml file. The default port for the RPC server is 19888 and for the HTTP server, it is 8080. This flexibility in configuration is crucial as it allows network operators to adjust their setups in order to avoid port conflicts with other running services and to optimize network traffic for different environments, such as development or production environments .