e1bae0c7a0
- Add docs/ folder with English (en/) and Bulgarian (bg/) documentation - Create index.md with language switching and links - English docs: installation, quickstart, architecture, baraql, storage, schema, lsm, btree, vector, graph, fts, columnar, transactions, distributed, protocol, udf, api-binary, api-http, api-websocket - Bulgarian docs: installation, quickstart, architecture, baraql, schema, lsm, btree, vector, graph, fts, transactions, distributed - Update README license to BSD 3-Clause - Add LICENSE file with BSD 3-Clause text
1.5 KiB
1.5 KiB
Binary Protocol API
Low-level wire protocol for high-performance client connections.
Message Format
All messages use big-endian byte order:
┌────────┬────────┬────────┬────────┬─────────────┐
│ Length │ Type │ Seq │ Status │ Payload │
│ 4 bytes│ 1 byte │ 2 bytes│ 1 byte │ N bytes │
└────────┴────────┴────────┴────────┴─────────────┘
Message Types
Query (0x01)
let msg = makeQueryMessage(seq, "SELECT * FROM users")
Insert (0x02)
let msg = makeInsertMessage(seq, "users", data)
Update (0x03)
let msg = makeUpdateMessage(seq, "users", updates, where)
Delete (0x04)
let msg = makeDeleteMessage(seq, "users", where)
Ready (0x05)
let msg = makeReadyMessage(seq)
Error (0x06)
let msg = makeErrorMessage(seq, code, message)
Response Codes
| Code | Name | Description |
|---|---|---|
| 0x00 | OK | Success |
| 0x01 | ERROR | General error |
| 0x02 | AUTH_REQUIRED | Authentication needed |
| 0x03 | INVALID_QUERY | Query syntax error |
| 0x04 | NOT_FOUND | Resource not found |
Serialization
import barabadb/protocol/wire
# Serialize value
let bytes = serializeValue(Value(kind: vkString, strVal: "test"))
# Deserialize value
let value = deserializeValue(bytes)