about summary refs log tree commit diff stats
path: root/cache/types.go
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-05-13 04:27:31 -0400
committerBen Morrison <ben@gbmor.dev>2019-05-13 04:27:31 -0400
commit8af4945c9841b23224c6f76460278f67947fd01e (patch)
tree87ed7244030e66d5afa0bf307d1b94f4c09b85eb /cache/types.go
parentf06a2d6126bed22d38b506e1edc8822386a7cc33 (diff)
downloadgetwtxt-8af4945c9841b23224c6f76460278f67947fd01e.tar.gz
separating cache into its own library
Diffstat (limited to 'cache/types.go')
-rw-r--r--cache/types.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/cache/types.go b/cache/types.go
new file mode 100644
index 0000000..8f364d5
--- /dev/null
+++ b/cache/types.go
@@ -0,0 +1,24 @@
+package cache
+
+import (
+	"sync"
+)
+
+// Indexer allows for other uses of the Index functions
+type Indexer interface {
+	AddUser(string, string)
+	DelUser(string)
+}
+
+// UserIndex provides an index of users by URL
+type UserIndex map[string]*Data
+
+// Data from user's twtxt.txt
+type Data struct {
+	nick   string
+	url    string
+	status []string
+}
+
+// Mutex to control access to the User Index
+var imutex = sync.RWMutex{}