Expand description
Unix Domain Socket IPC Server for SochDB
Provides a local IPC server that wraps the Database kernel for multi-process access to a SochDB database.
§Architecture
┌────────────────────────────────────────────────────────────────┐
│ IPC Server Process │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ Database Kernel (Arc<Database>) │ │
│ └────────────────────────────────────────────────────────┘ │
│ ▲ ▲ ▲ │
│ │ │ │ │
│ ┌────────┴────────┐ ┌────────┴────────┐ ┌────────┴────────┐ │
│ │ ClientHandler 1 │ │ ClientHandler 2 │ │ ClientHandler N │ │
│ └────────┬────────┘ └────────┬────────┘ └────────┬────────┘ │
│ │ │ │ │
│ ┌────────┴────────────────────┴────────────────────┴────────┐│
│ │ Unix Domain Socket Listener ││
│ │ /tmp/sochdb-<id>.sock ││
│ └───────────────────────────────────────────────────────────┘│
└────────────────────────────────────────────────────────────────┘
▲ ▲ ▲
│ Unix Socket │ Unix Socket │ Unix Socket
┌──────┴──────┐ ┌──────┴──────┐ ┌──────┴──────┐
│ Client 1 │ │ Client 2 │ │ Client N │
│ (Process) │ │ (Process) │ │ (Process) │
└─────────────┘ └─────────────┘ └─────────────┘§Wire Protocol
All messages use a simple length-prefixed binary format:
┌──────────────────────────────────────────────────────────────┐
│ OpCode (1 byte) │ Length (4 bytes LE) │ Payload (N) │
└──────────────────────────────────────────────────────────────┘§OpCodes
| Code | Name | Direction | Description |
|---|---|---|---|
| 0x01 | PUT | C→S | Put key-value pair |
| 0x02 | GET | C→S | Get value by key |
| 0x03 | DELETE | C→S | Delete key |
| 0x04 | BEGIN_TXN | C→S | Start transaction |
| 0x05 | COMMIT_TXN | C→S | Commit transaction |
| 0x06 | ABORT_TXN | C→S | Abort transaction |
| 0x07 | QUERY | C→S | Execute query |
| 0x08 | CREATE_TABLE | C→S | Create table |
| 0x09 | PUT_PATH | C→S | Put hierarchical path |
| 0x0A | GET_PATH | C→S | Get by hierarchical path |
| 0x0B | SCAN | C→S | Scan key range |
| 0x0C | CHECKPOINT | C→S | Force checkpoint |
| 0x0D | STATS | C→S | Get database stats |
| —— | ————— | ———– | –––––––––––––––– |
| 0x80 | OK | S→C | Success response |
| 0x81 | ERROR | S→C | Error response |
| 0x82 | VALUE | S→C | Value response |
| 0x83 | TXN_ID | S→C | Transaction ID response |
| 0x84 | ROW | S→C | Query result row (streaming) |
| 0x85 | END_STREAM | S→C | End of streaming results |
| 0x86 | STATS_RESP | S→C | Stats response |
Structs§
- IpcClient
- Client for connecting to an IPC server
- IpcServer
- Unix Domain Socket IPC Server
- IpcServer
Config - Configuration for the IPC server
- Message
- Message frame for the wire protocol
- Server
Stats - Server
Stats Snapshot