summary refs log tree commit diff stats
path: root/cache/types.go
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-05-14 02:55:40 -0400
committerBen Morrison <ben@gbmor.dev>2019-05-14 02:55:40 -0400
commita8ba50b53f45e06af03f5ef98e759539394a3c0c (patch)
treea5bfb512d6fcd208e2d050d9f06406e48d9c9185 /cache/types.go
parent7728f92e4f4b00d617ece97d9c6a88125821d874 (diff)
downloadgetwtxt-a8ba50b53f45e06af03f5ef98e759539394a3c0c.tar.gz
package cache renamed to package registry
Diffstat (limited to 'cache/types.go')
-rw-r--r--cache/types.go56
1 files changed, 0 insertions, 56 deletions
diff --git a/cache/types.go b/cache/types.go
deleted file mode 100644
index 2962ab4..0000000
--- a/cache/types.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package cache
-
-import (
-	"sync"
-	"time"
-)
-
-// 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
-	date    time.Time
-	apidate []byte
-	status  StatusMap
-}
-
-// StatusMap holds the statuses posted by a given user. A standard
-// time.Time value is used as the key, with the status as a string.
-type StatusMap map[time.Time]string
-
-// StatusMapSlice is a slice of StatusMaps. Useful for sorting the
-// output of queries.
-type StatusMapSlice []StatusMap
-
-// Mutex to control access to the User Index.
-var imutex = sync.RWMutex{}
-
-// TimeSlice is used for sorting by timestamp.
-type TimeSlice []time.Time
-
-// Len returns the length of the slice to be sorted.
-// This helps satisfy sort.Interface with respect to TimeSlice.
-func (t TimeSlice) Len() int {
-	return len(t)
-}
-
-// Less returns true if the timestamp at index i is before the
-// timestamp at index j in TimeSlice.
-// This helps satisfy sort.Interface with respect to TimeSlice.
-func (t TimeSlice) Less(i, j int) bool {
-	return t[i].Before(t[j])
-}
-
-// Swap transposes the timestampss at the two given indices.
-// This helps satisfy sort.Interface with respect to TimeSlice.
-func (t TimeSlice) Swap(i, j int) {
-	t[i], t[j] = t[j], t[i]
-}