Scry.info technical sharing — — Introduction of ScryDB
The main purpose of ScryDB is to store “big” data in places other than eth chains (After all, block size on eth chain is extremely big now).
The corresponding relationships are shown in the following:
It is shown that ScryDB delivers services for the upper layer, relative data manipulation are packed for concrete realization.
There is a sub-realization: IPFS and Scry DB Chain:
IPFS: a trustworthy decentralized network of data storage. Currently the access to data is carried out on IPFS.
Scry DB Chain: the scryInfo system has a huge storage of real data, and where there is data there is query. However, IPFS doesn’t offer an (a group) query function. It currently can only obtain targeted contents via hash, which is not enough to meet the demand of growing business.Therefore, in response to this demand we designed a new chain to suffice data access requiring query (similar to relational database). This function plans to come into effect in the forth stage (by the end of 2018). Please refer to Whitepaper for more detailed introduction.
Scry DB Chain will not come into effect until the forth stage. Does this mean that our ScryInfo can not deliver queries for the time being? The answer is an absolute No, of course we can support query. At this stage we create a simple and easy structure based on IPFS to realize the basic demand of query, shown as following:
ScryDBFactory: a kind of factory, where the calls in outer layer mainly adopt this kind of Create methods and what returns are the objects of the type of ScryDBBase, which returns certain subclass objects of ScryDBBase.
ScryDBBase: a basic abstract layer for DB operation. It defines several important approaches:
connect(): to connect to data source (both IPFS and Scry DB Chain are designed to operate after connection)
get(): to obtain single targeted data. IPFS can obtain the contents of specific data via a hash whereas ScryDBChain is also designed to enable access to single value.
set():restore targeted data to IPFS or Scry DB Chain.
exec():designed to execute a SQL statement to meet the goal of data query.
The first parameter is the SQL statement and the second parameter is the result call-back.
ScryDBIPFS: specifically targeting the realization of IPFS. It mainly realizes get() and set() approaches, realizing the access to data on IPFS.
ScryDBChain: planned as the realization of Scry DB Chain. This is planned to come into beingin the forth stage.
ScryDBIPFSTable: a subclass of ScryDBIPFS. Its main responsibility is to achieve the exec() approach. As is shown in its name, it stores data based on the form of charts in similar database. Thus CRUD of data can be carried out by simulating SQL. In addition, it provides create table and drop table.
Therefore we complete a simple and easy basic module of data manipulation based on IPFS, which can provide data queries and basic services for upper layers, especially the SQS system.
establish a chart:
output of results: