2017-11-11 04:06:16 +00:00
package common
2017-09-03 04:50:31 +00:00
2017-02-11 14:51:16 +00:00
import "errors"
2017-09-03 04:50:31 +00:00
// Go away, linter. We need to differentiate constants from variables somehow ;)
// nolint
2017-02-11 14:51:16 +00:00
const CACHE_STATIC int = 0
const CACHE_DYNAMIC int = 1
const CACHE_SQL int = 2
Added Quick Topic.
Added Attachments.
Added Attachment Media Embeds.
Renamed a load of *Store and *Cache methods to reduce the amount of unneccesary typing.
Added petabytes as a unit and cleaned up a few of the friendly units.
Refactored the username change logic to make it easier to maintain.
Refactored the avatar change logic to make it easier to maintain.
Shadow now uses CSS Variables for most of it's colours. We have plans to transpile this to support older browsers later on!
Snuck some CSS Variables into Tempra Conflux.
Added the GroupCache interface to MemoryGroupStore.
Added the Length method to MemoryGroupStore.
Added support for a site short name.
Added the UploadFiles permission.
Renamed more functions.
Fixed the background for the left gutter on the postbit for Tempra Simple and Shadow.
Added support for if statements operating on int8, int16, int32, int32, int64, uint, uint8, uint16, uint32, uint64, float32, and float64 for the template compiler.
Added support for if statements operating on slices and maps for the template compiler.
Fixed a security exploit in reply editing.
Fixed a bug in the URL detector in the parser where it couldn't find URLs with non-standard ports.
Fixed buttons having blue outlines on focus on Shadow.
Refactored the topic creation logic to make it easier to maintain.
Made a few responsive fixes, but there's still more to do in the following commits!
2017-10-05 10:20:28 +00:00
// nolint
2017-09-03 04:50:31 +00:00
// ErrCacheDesync is thrown whenever a piece of data, for instance, a user is out of sync with the database. Currently unused.
2017-09-10 16:57:22 +00:00
var ErrCacheDesync = errors . New ( "The cache is out of sync with the database." ) // TODO: A cross-server synchronisation mechanism
2017-09-03 04:50:31 +00:00
2017-10-21 00:27:47 +00:00
// 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
2017-02-11 14:51:16 +00:00
2017-09-03 04:50:31 +00:00
// nolint
2017-02-11 14:51:16 +00:00
type DataStore interface {
2017-11-11 04:06:16 +00:00
DirtyGet ( id int ) interface { }
2017-02-11 14:51:16 +00:00
Get ( id int ) ( interface { } , error )
2017-06-06 14:41:06 +00:00
BypassGet ( id int ) ( interface { } , error )
2017-11-11 04:06:16 +00:00
//GlobalCount()
2017-09-15 22:20:01 +00:00
}
2017-09-18 17:03:52 +00:00
// nolint
2017-09-15 22:20:01 +00:00
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
2017-11-11 04:06:16 +00:00
Reload ( id int ) error
Flush ( )
Length ( ) int
SetCapacity ( capacity int )
2017-02-11 14:51:16 +00:00
GetCapacity ( ) int
}