askrobots / dbbasic-object-primitive
Public
Python functions as REST objects, with clustering, load balancing and state replication; no containers or orchestration.
__init__.py · 1.8 KB · 57 lines
| 1 | """ |
| 2 | Object Primitive: A new computing paradigm. |
| 3 | |
| 4 | Where code, data, and execution are unified into network-accessible objects. |
| 5 | |
| 6 | The Object Primitive System provides: |
| 7 | - Protocol-agnostic access (REST, gRPC, WebSocket, MQTT, 9P, etc.) |
| 8 | - Implementation-agnostic execution (Python, C, Rust, GPU, ASIC) |
| 9 | - OS-agnostic deployment (Linux, macOS, Windows, BSD, Plan 9, etc.) |
| 10 | - Self-logging objects (objects log to themselves) |
| 11 | - Automatic versioning (complete history) |
| 12 | - Self-healing and resilient (designed for chaos from the start) |
| 13 | |
| 14 | Core Philosophy: |
| 15 | - The endpoint is the eternal truth (business logic) |
| 16 | - Everything else is swappable (protocols, implementations, storage, OS) |
| 17 | - This is NOT an ORM (we isolate stability, not hide complexity) |
| 18 | - We don't care what changes (vendors, hardware, protocols, databases) |
| 19 | |
| 20 | Example: |
| 21 | >>> from object_primitive import ObjectPrimitive |
| 22 | >>> |
| 23 | >>> # Define an endpoint |
| 24 | >>> def GET(request): |
| 25 | ... return {"result": process(request)} |
| 26 | >>> |
| 27 | >>> # Create object primitive |
| 28 | >>> obj = ObjectPrimitive("/myservice", GET) |
| 29 | >>> |
| 30 | >>> # Accessible via any protocol |
| 31 | >>> # - HTTP: curl http://server/myservice |
| 32 | >>> # - 9P: mount server:/endpoints /mnt |
| 33 | >>> # - WebSocket: ws://server/myservice |
| 34 | >>> # - MQTT: pub/sub to myservice |
| 35 | |
| 36 | Architecture: |
| 37 | The stable invariant (endpoint logic) sits at the center. |
| 38 | Three dimensions of abstraction surround it: |
| 39 | - Protocol (how accessed) |
| 40 | - Implementation (how executed) |
| 41 | - OS (where runs) |
| 42 | |
| 43 | Write once. Access anywhere. Execute with anything. Run everywhere. |
| 44 | """ |
| 45 | |
| 46 | __version__ = "0.1.0" |
| 47 | __author__ = "Dan Q" |
| 48 | __email__ = "danq@dbbasic.com" |
| 49 | |
| 50 | # Core exports (will be populated as we implement) |
| 51 | __all__ = [ |
| 52 | "__version__", |
| 53 | # Core primitives (to be added in Phase 1) |
| 54 | # "ObjectPrimitive", |
| 55 | # "EndpointLoader", |
| 56 | # "VersionManager", |
| 57 | ] |