summary refs log tree commit diff stats
path: root/cache
diff options
context:
space:
mode:
Diffstat (limited to 'cache')
-rw-r--r--cache/index.go20
-rw-r--r--cache/types.go24
2 files changed, 44 insertions, 0 deletions
diff --git a/cache/index.go b/cache/index.go
new file mode 100644
index 0000000..e0a3dd0
--- /dev/null
+++ b/cache/index.go
@@ -0,0 +1,20 @@
+package cache
+
+// NewUserIndex returns a new instance of a user index
+func NewUserIndex() *UserIndex {
+	return &UserIndex{}
+}
+
+// AddUser inserts a new user into the index. The *Data struct only contains the nickname.)
+func (index UserIndex) AddUser(nick string, url string) {
+	imutex.Lock()
+	index[url] = &Data{nick: nick}
+	imutex.Unlock()
+}
+
+// DelUser removes a user from the index completely.
+func (index UserIndex) DelUser(url string) {
+	imutex.Lock()
+	delete(index, url)
+	imutex.Unlock()
+}
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{}
-tty/blame/common.h?id=f5338158321b6eb838adc08f139654a653bae6f4'>^
0ef52901 ^
b3d49f2a ^
0ef52901 ^



8c68fa0b ^

b1da6d1b ^

40299882 ^
b1da6d1b ^

9e686c0e ^



6644fa95 ^

0cb54868 ^




b6f36673 ^
f2638e00 ^



b6f36673 ^
a48b48b7 ^
f2638e00 ^
a48b48b7 ^

f2638e00 ^
a48b48b7 ^
e6749d66 ^
e9225687 ^














e6749d66 ^
0ef52901 ^
8c68fa0b ^
b3d49f2a ^
b1da6d1b ^
3b0f7e10 ^
b1da6d1b ^
6f498d1f ^

dd11334b ^
4c6cfcdc ^
e7e1688d ^
3b0f7e10 ^

06ecfef1 ^
c7100203 ^
3b0f7e10 ^

8c68fa0b ^
3b0f7e10 ^


e9225687 ^

3b0f7e10 ^

e295a474 ^
d5e9ca64 ^
42c3a1c1 ^
b5eb0958 ^
42c3a1c1 ^
be7c4f5a ^
3b0f7e10 ^
e434b1bb ^
be7c4f5a ^
f243e333 ^

d9344b00 ^
8c68fa0b ^
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134