System Design #
In order to build a decentralized database, the core of the IceFireDB system is to provide data decentralization and immutability for applications. Aiming at the above goals, we have designed the following core system levels.
+-+---------------+----+---------------+----+---------------+-+
| Transport |
| +---------------+ +---------------+ +---------------+ |
| | Cluster | | Cluster | | Cluster | |
| | communication | | communication | | communication | |
| +---------------+ +---------------+ +---------------+ |
+-+---------------+----+-------^-------+----+---------------+-+
|
+------------------------------v------------------------------+
| Query Processor |
| +-----------------------------------------------------+ |
| | Query Parser | |
| +-----------------------------------------------------+ |
| +-----------------------------------------------------+ |
| | Query Optimizer | |
| +-----------------------------------------------------+ |
+---+--------------------------+--------------------------+---+
|
+------------------------------v------------------------------+
| Codec |
| +-----------+ +-----------+ |
| | Encode | | Decode | |
| +-----------+ +-----------+ |
| support: kv、list、hash、set |
+----------+---------------------------------------^----------+
| |
+----------+---------------------------------------+----------+
| |put KV Engine |Get |
| +-----v----+ +-----+----+ |
| | put(a,b) | | Get(a) | |
| +-----+----+ +-----+----+ |
| | a:b +-------+ | a |
| +-----v----+ +------> store <----+ +-----v----+ |
| | CID(b) +----+ +-------+ +---+ cat(hash)| |
| +-----+----+ +-----+----+ |
| | add(b) | cat |
| --------v---------------------------------------v----- |
| Leveldb\Badger\OSS\IPFS\CRDT\IPFS-LOG |
+-------------------------------------------------------------+
At the above system level, IceFireDB refines and implements the following important system components.
System components | describe | technology used |
---|---|---|
Network layer | 1. RAFT guarantees data consistency within a single availability zone. 2. P2P network construction decentralized database communication. 3. NATS is a new network layer being built. | P2P、RAFT、NATS |
Storage layer | Many types of storage are currently supported. Under the codec computing layer, we abstract the KV storage driver layer, which is compatible with different storage engines of web2 and web3. | goleveldb、badger、IPFS、CRDT、IPFS-LOG、OSS |
Protocol layer | Based on the codec layer, we have built a protocol layer. A good communication protocol allows more applications to easily access the IceFireDB data network. Currently, we support the Redis-RESP NoSQL protocol and the MySQL protocol. | RESP、SQL |
Codec layer | The codec layer is the core of our system. For NoSQL scenarios, any data type will be abstracted into a KV storage model. With the flexible coding layer, we can build rich data operation structures and instructions, such as hash, sets, strings, etc. | KV、Strings、Hashes、Lists、Sorted Sets、Sets、SQL、PubSub |