Memory Store
In-memory store for development and testing.
The memory store keeps all data in memory using Go maps with sync.RWMutex for thread safety. Data is lost when the process exits.
Usage
import "github.com/xraph/warden/store/memory"
st := memory.New()Characteristics
- Thread-safe — All operations use read/write locks
- Copy-on-write — List operations return copies, not references
- No persistence — Data is lost on restart
- No migrations —
Migrate()is a no-op - Fast — Ideal for unit tests and development
When to Use
- Unit tests and integration tests
- Development environments
- Prototyping and experimentation
- Standalone scripts and CLI tools
Interface Compliance
The memory store implements all 7 subsystem store interfaces:
var _ store.Store = (*memory.Store)(nil) // Compile-time checkThis includes:
role.Store— Role CRUD + hierarchypermission.Store— Permission CRUD + role attachmentassignment.Store— Assignment CRUD + subject lookuprelation.Store— Relation tuple CRUD + graph queriespolicy.Store— Policy CRUD + active policy lookupresourcetype.Store— Resource type CRUDchecklog.Store— Check log append + query