IceFireDB NoSQL API Reference #
Overview #
IceFireDB provides a Redis-compatible API with additional commands for decentralized operations. This document covers the supported commands, their syntax, and usage examples.
Command Categories #
Server Management Commands #
INFO
#
Returns server information and statistics.
Syntax:
INFO [section]
Example:
INFO
INFO memory
INFO replication
Response: Returns a multi-bulk string with server information.
FLUSHALL
#
Removes all keys from all databases.
Syntax:
FLUSHALL
Response: Returns the number of keys removed.
FLUSHDB
#
Removes all keys from the current database.
Syntax:
FLUSHDB
Response: Returns the number of keys removed.
String Commands #
Supported String Operations #
Command | Description | Status |
---|---|---|
SET | Set key value | ✅ Implemented |
GET | Get key value | ✅ Implemented |
APPEND | Append to string | ✅ Implemented |
INCR | Increment integer | ✅ Implemented |
DECR | Decrement integer | ✅ Implemented |
MGET | Get multiple values | ✅ Implemented |
MSET | Set multiple values | ✅ Implemented |
SETEX | Set with expiration | ✅ Implemented |
Hash Commands #
Supported Hash Operations #
Command | Description | Status |
---|---|---|
HSET | Set hash field | ✅ Implemented |
HGET | Get hash field | ✅ Implemented |
HGETALL | Get all fields | ✅ Implemented |
HDEL | Delete field | ✅ Implemented |
HINCRBY | Increment field | ✅ Implemented |
HKEYS | Get all keys | ✅ Implemented |
HVALS | Get all values | ✅ Implemented |
List Commands #
Supported List Operations #
Command | Description | Status |
---|---|---|
LPUSH | Push to left | ✅ Implemented |
RPUSH | Push to right | ✅ Implemented |
LPOP | Pop from left | ✅ Implemented |
RPOP | Pop from right | ✅ Implemented |
LLEN | Get list length | ✅ Implemented |
LRANGE | Get range | ✅ Implemented |
LINDEX | Get by index | ✅ Implemented |
Set Commands #
Supported Set Operations #
Command | Description | Status |
---|---|---|
SADD | Add to set | ✅ Implemented |
SREM | Remove from set | ✅ Implemented |
SMEMBERS | Get all members | ✅ Implemented |
SISMEMBER | Check membership | ✅ Implemented |
SCARD | Get cardinality | ✅ Implemented |
SINTER | Intersection | ✅ Implemented |
SUNION | Union | ✅ Implemented |
Sorted Set Commands #
Supported Sorted Set Operations #
Command | Description | Status |
---|---|---|
ZADD | Add to sorted set | ✅ Implemented |
ZREM | Remove from sorted set | ✅ Implemented |
ZRANGE | Get range | ✅ Implemented |
ZREVRANGE | Get reverse range | ✅ Implemented |
ZCARD | Get cardinality | ✅ Implemented |
ZSCORE | Get score | ✅ Implemented |
ZRANK | Get rank | ✅ Implemented |
Extended Commands for Decentralized Operations #
Storage Driver Management #
DRIVER.SELECT
#
Select active storage driver.
Syntax:
DRIVER.SELECT driver_name
Supported Drivers:
leveldb
- Local LevelDB storagebadger
- Local BadgerDB storageipfs
- IPFS decentralized storagecrdt
- CRDT-based storageipfs-log
- IPFS log storageoss
- Object storage servicehybriddb
- Tiered storage
Example:
DRIVER.SELECT ipfs
DRIVER.INFO
#
Get current driver information.
Syntax:
DRIVER.INFO
P2P Network Commands #
P2P.CONNECT
#
Connect to P2P network node.
Syntax:
P2P.CONNECT peer_address
Example:
P2P.CONNECT /ip4/192.168.1.100/tcp/4001/p2p/QmPeerID
P2P.PEERS
#
List connected P2P peers.
Syntax:
P2P.PEERS
CRDT Operations #
CRDT.SYNC
#
Force CRDT synchronization.
Syntax:
CRDT.SYNC
CRDT.STATUS
#
Get CRDT synchronization status.
Syntax:
CRDT.STATUS
Error Codes #
IceFireDB uses standard Redis error responses with additional error codes:
ERR wrong number of arguments
- Incorrect command syntaxERR unknown command
- Unsupported commandERR storage driver error
- Storage backend failureERR p2p network error
- P2P connectivity issuesERR crdt sync conflict
- CRDT synchronization conflict
Response Types #
IceFireDB supports all Redis response types:
- Simple Strings:
+OK\r\n
- Errors:
-ERR message\r\n
- Integers:
:1000\r\n
- Bulk Strings:
$5\r\nhello\r\n
- Arrays:
*2\r\n$5\r\nhello\r\n$5\r\nworld\r\n
Protocol Compatibility #
IceFireDB is fully compatible with Redis RESP (REdis Serialization Protocol). Clients can use any Redis client library to connect to IceFireDB.
Connection Example #
import redis
# Connect to IceFireDB
r = redis.Redis(host='localhost', port=11001, decode_responses=True)
# Standard Redis operations
r.set('key', 'value')
value = r.get('key')
print(value) # Output: 'value'
# IceFireDB extended operations
r.execute_command('DRIVER.SELECT', 'ipfs')
Performance Considerations #
- Use pipelining for bulk operations
- Choose appropriate storage driver for your use case
- Monitor P2P network latency for decentralized operations
- Consider data consistency requirements when selecting CRDT vs RAFT mode
See Also #
- Command Implementation - Detailed command implementation details
- Storage Drivers - Storage backend documentation
- Network Protocol - Protocol layer documentation