summaryrefslogtreecommitdiff
path: root/plugins/memory/driver.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/memory/driver.go')
-rw-r--r--plugins/memory/driver.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/plugins/memory/driver.go b/plugins/memory/driver.go
new file mode 100644
index 00000000..5a96e773
--- /dev/null
+++ b/plugins/memory/driver.go
@@ -0,0 +1,28 @@
+package memory
+
+import (
+ "github.com/spiral/roadrunner/v2/plugins/memory/bst"
+)
+
+type Driver struct {
+ tree bst.Storage
+}
+
+func NewInMemoryDriver() bst.Storage {
+ b := &Driver{
+ tree: bst.NewBST(),
+ }
+ return b
+}
+
+func (d *Driver) Insert(uuid string, topic string) {
+ d.tree.Insert(uuid, topic)
+}
+
+func (d *Driver) Remove(uuid, topic string) {
+ d.tree.Remove(uuid, topic)
+}
+
+func (d *Driver) Get(topic string) map[string]struct{} {
+ return d.tree.Get(topic)
+}