-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod.rs
More file actions
113 lines (108 loc) · 5.36 KB
/
Copy pathmod.rs
File metadata and controls
113 lines (108 loc) · 5.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
//! Unified Cross-Protocol Storage Layer
//!
//! This module provides a unified storage layer that enables true cross-protocol
//! data sharing in Orbit-RS. Data written via one protocol (Redis, PostgreSQL,
//! MySQL, CQL, Cypher, AQL, REST, gRPC) is immediately accessible through all
//! other protocols.
//!
//! # Architecture
//!
//! ```text
//! ┌─────────────────────────────────────────────────────────────────┐
//! │ Protocol Layer │
//! ├─────────┬────--────┬─────────┬─────────┬─────────┬──────────────┤
//! │ Redis │PostgreSQL│ MySQL │ CQL │ Cypher │ AQL/REST │
//! │ Adapter │ Adapter │ Adapter │ Adapter │ Adapter │ Adapter │
//! ├─────────┴──────-───┴─────────┴─────────┴─────────┴──────────────┤
//! │ Schema Registry │
//! ├─────────────────────────────────────────────────────────────────┤
//! │ Unified Query Engine │
//! ├─────────────────────────────────────────────────────────────────┤
//! │ Unified Storage │
//! │ (Single RocksDB + Tiered Storage Backend) │
//! └─────────────────────────────────────────────────────────────────┘
//! ```
//!
//! # Key Components
//!
//! - [`crate::unified::types::UniversalValue`]: A canonical data type that all protocols map to/from
//! - [`crate::unified::operations::UniversalOperation`]: Protocol-agnostic operations (CRUD, queries, etc.)
//! - [`crate::unified::storage::UnifiedStorage`]: Single storage backend shared by all protocols
//! - [`crate::unified::schema::SchemaRegistry`]: Manages namespace schemas and cross-protocol projections
//! - Protocol Adapters: Translate between protocol-specific and universal formats
//!
//! # Example
//!
//! ```rust,ignore
//! use orbit_engine::unified::{UnifiedStorage, UniversalValue};
//!
//! // Create unified storage (shared by all protocols)
//! let storage = UnifiedStorage::new("./data").await?;
//!
//! // Write via Redis adapter
//! let record = UniversalRecord::new(
//! "users",
//! "alice",
//! UniversalValue::Map(/* ... */),
//! "redis",
//! );
//! storage.put(record).await?;
//!
//! // Read via PostgreSQL adapter - same data!
//! let record = storage.get("users", "alice").await?;
//! ```
//!
//! # Cross-Protocol Data Flow
//!
//! When data is written via Redis:
//! 1. `HSET user:alice name "Alice" email "alice@example.com"`
//! 2. RedisAdapter translates to `UniversalOperation::Put { namespace: "user", key: "alice", ... }`
//! 3. UnifiedStorage stores the record
//!
//! When queried via PostgreSQL:
//! 1. `SELECT * FROM user WHERE id = 'alice'`
//! 2. PostgresAdapter translates to `UniversalOperation::Get { namespace: "user", key: "alice" }`
//! 3. UnifiedStorage returns the same record
//! 4. PostgresAdapter formats as SQL result set
pub mod actor_tier_placement;
pub mod adapters;
pub mod index;
pub mod operations;
pub mod s3_backend;
pub mod schema;
pub mod storage;
pub mod tiered;
pub mod types;
// Re-export commonly used types
pub use actor_tier_placement::{
ActorTierPlacement, ActorTierPlacementBuilder, ActorTierPlacementConfig, ActorTierStats,
ActorType, TierRecommendation,
};
pub use adapters::{
AdapterFactory, BaseAdapter, CqlAdapter, GraphAdapter, ProtocolAdapter, RedisAdapter,
RestAdapter, SqlAdapter,
};
pub use operations::{
AggregateOp, FieldDefinition, FieldType, FilterExpression, GraphPattern, IndexDefinition,
IndexType, IsolationLevel, NamespaceSchema, NodePattern, RelationshipDirection,
RelationshipPattern, SortOrder, UniversalOperation,
};
pub use schema::{Protocol, ProtocolProjection, SchemaRegistry, SchemaVersion};
pub use storage::{
MemoryBackend, UnifiedStorage, UnifiedStorageBackend, UnifiedStorageConfig,
UnifiedStorageError, UnifiedStorageMetrics, UnifiedStorageResult,
};
pub use tiered::{
ColdBackendType, ColdDataFormat, ColdTierConfig, EvictionPolicy, HotTierConfig, StorageTier,
TierMigrationConfig, TieredStorageBackend, TieredStorageConfig, TieredStorageMetrics,
WarmTierConfig, WritePolicy,
};
pub use types::{RecordId, RecordMetadata, UniversalRecord, UniversalResult, UniversalValue};
// Re-export index types
pub use index::{IndexEntry, IndexStats, SecondaryIndexManager};
// Re-export S3 backend
pub use s3_backend::{S3Backend, S3BackendConfig};
// Future modules (to be implemented)
// pub mod backend; // RocksDB persistent backend
// pub mod transaction; // Distributed transaction coordination
// pub mod cache; // Query result caching