05c2ac3ce4
Add the ActivityStream interface to abstract Get, Add and Count. Rename the GlobalCount methods to Count for simplicity. Simplify the variable names in the Count methods. Rename the GlobalCount method to Count and rename the original Count method to CountUser in LoginLogStore. Add a float64 case for bunit, sort of. Theme.RunTmpl now returns ErrBadDefaultTemplate instead of panicking when an interpreted template doesn't exist. Widget.Allowed now checks the zoneid. Fire the alert off in the background in AddActivityAndNotifyTarget instead of blocking the request. Use ErrBadDefaultTemplate instead of calling DefaultTemplates.Lookup directly for custom pages. Split the page struct for the debug page into multiple structs to make things more organised. Add the Count method to ProfileReplyStore. Add the Count method to ReplyStore. Add the DirSize utility function. Add a few ActivityStream tests. Secret gallery stuff.
35 lines
1.1 KiB
Go
35 lines
1.1 KiB
Go
package common
|
|
|
|
import "errors"
|
|
|
|
// nolint
|
|
// ErrCacheDesync is thrown whenever a piece of data, for instance, a user is out of sync with the database. Currently unused.
|
|
var ErrCacheDesync = errors.New("The cache is out of sync with the database.") // TODO: A cross-server synchronisation mechanism
|
|
|
|
// ErrStoreCapacityOverflow is thrown whenever a datastore reaches it's maximum hard capacity. I'm not sure if this error is actually used. It might be, we should check
|
|
var ErrStoreCapacityOverflow = errors.New("This datastore has reached it's maximum capacity.") // nolint
|
|
|
|
// nolint
|
|
type DataStore interface {
|
|
DirtyGet(id int) interface{}
|
|
Get(id int) (interface{}, error)
|
|
BypassGet(id int) (interface{}, error)
|
|
//Count() int
|
|
}
|
|
|
|
// nolint
|
|
type DataCache interface {
|
|
CacheGet(id int) (interface{}, error)
|
|
CacheGetUnsafe(id int) (interface{}, error)
|
|
CacheSet(item interface{}) error
|
|
CacheAdd(item interface{}) error
|
|
CacheAddUnsafe(item interface{}) error
|
|
CacheRemove(id int) error
|
|
CacheRemoveUnsafe(id int) error
|
|
Reload(id int) error
|
|
Flush()
|
|
Length() int
|
|
SetCapacity(capacity int)
|
|
GetCapacity() int
|
|
}
|