summaryrefslogtreecommitdiff
path: root/plugins/memory/driver.go
blob: 5a96e773d8d7aa48cf8c7fc258a35f8f443447a1 (plain)
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
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)
}