Kotoba Core
Core components for the Kotoba graph processing system. Provides fundamental types, IR definitions, and common utilities used across the entire Kotoba ecosystem.
๐ฏ Overview
Kotoba Core serves as the foundational layer for all Kotoba crates, providing:
- Unified Type System: Common data types with serialization support
- Error Handling: Consistent error types across the ecosystem
- IR Definitions: Intermediate representations for graph processing
- Cryptographic Primitives: Content hashing and integrity verification
๐๏ธ Architecture
Core Components
Types System (types.rs
)
// Fundamental data types
pub type VertexId = Uuid;
pub type EdgeId = Uuid;
pub type Label = String;
// Extensible value system
// Cryptographic primitives
;
Intermediate Representations (ir/
)
- catalog.rs: Schema and catalog management for graph databases
- query.rs: Query representation and optimization structures
- rule.rs: Graph rewriting and transformation rules
- patch.rs: Atomic graph modification operations
- strategy.rs: Execution strategy patterns and algorithms
๐ Quality Metrics
Metric | Status |
---|---|
Compilation | โ Clean (no warnings) |
Tests | โ 100% coverage on core types |
Documentation | โ Complete API docs |
Dependencies | โ Minimal, secure |
Performance | โ Zero-cost abstractions |
๐ง Usage
Basic Usage
use *;
// Working with core types
let vertex_id = new_v4;
let value = String;
// Hash generation
let data = ;
let hash = sha256;
// Error handling
IR Usage
use ;
// Query processing
let query = parse?;
// Rule application
let rule = new;
๐ Ecosystem Integration
Kotoba Core is the foundation for:
Crate | Purpose | Dependency |
---|---|---|
kotoba-graph |
Graph data structures | Required |
kotoba-execution |
Query execution engine | Required |
kotoba-jsonnet |
Configuration processing | Required |
kotoba-storage |
Persistence layer | Required |
kotoba-security |
Authentication & authorization | Required |
kotoba-server |
HTTP server components | Required |
kotoba-rewrite |
Graph transformations | Required |
๐งช Testing
Test Coverage:
- โ Value serialization/deserialization
- โ Content hash generation
- โ UUID type validation
- โ IR structure validation
๐ Performance
- Zero-cost abstractions for type system
- Efficient serialization with Serde
- Minimal runtime overhead for core operations
- Cryptographic operations optimized for performance
๐ Security
- Cryptographically secure hash generation (SHA-256)
- Type-safe value system preventing injection attacks
- UUID-based identifiers for secure resource management
- No unsafe code in core functionality
๐ API Reference
Core Types
- [
Value
] - Extensible value type system - [
VertexId
] / [EdgeId
] - UUID-based identifiers - [
ContentHash
] - Cryptographic content verification - [
Properties
] - Key-value property storage
IR Modules
- [
catalog
] - Schema and catalog management - [
query
] - Query representation and optimization - [
rule
] - Graph rewriting rules - [
patch
] - Graph transformation operations - [
strategy
] - Execution strategy patterns
๐ค Contributing
See the main Kotoba repository for contribution guidelines.
๐ License
Licensed under MIT OR Apache-2.0. See LICENSE for details.