Scalable Objects Persistence
This directory contains example applications demonstrating various features of Scalable Objects Persistence (SOP) in Go.
SOP is designed to be a polyglot database. To ensure data written in Go can be read by Python, C#, Java, or Rust (and vice versa), you should use the jsondb package. This provides symmetry across all language bindings.
interop_jsondb)Demonstrates how to store Go structs so they are automatically serialized to the “Universal” JSON format.
jsondb.NewJsonBtree[K, V]interop_secondary_indexes)Demonstrates “Schema-less” storage with composite secondary indexes.
jsondb.NewJsonBtreeMapKey + IndexSpecificationstruct_key_main.go demonstrating jsondb.NewJsonBtreeStructKey for a more idiomatic Go experience using structs as keys.For pure Go microservices where you don’t need to share data with other languages, you can use the native generic API.
swarm_standalone & swarm_clustered)Demonstrates SOP’s ability to handle concurrent transactions from multiple threads (or processes) without external locks.
database.NewBtree[K, V] (Native)swarm_standalone: Runs on local disk.swarm_clustered: Runs on Redis (simulating a distributed cluster).multi_redis_url)Demonstrates connecting to multiple Redis databases (e.g., DB 0 and DB 1) in the same application using the standard URL format.
RedisCacheConfig.URL (redis://host:port/db)You can run all examples in sequence using the suite script in the root directory:
./run_go_suite.sh
Or run individual examples:
go run examples/interop_jsondb/main.go