2021-11-02 18:08:21 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
2021-12-07 16:45:15 +00:00
|
|
|
"errors"
|
2021-11-02 18:08:21 +00:00
|
|
|
_ "github.com/mattn/go-sqlite3" // SQLite driver
|
2021-11-03 01:09:49 +00:00
|
|
|
"time"
|
2021-11-02 18:08:21 +00:00
|
|
|
)
|
|
|
|
|
2021-12-07 16:45:15 +00:00
|
|
|
var (
|
|
|
|
errUnexpectedMessageType = errors.New("unexpected message type")
|
|
|
|
)
|
|
|
|
|
|
|
|
// cache implements a cache for messages of type "message" events,
|
|
|
|
// i.e. message structs with the Event messageEvent.
|
2021-11-03 01:09:49 +00:00
|
|
|
type cache interface {
|
|
|
|
AddMessage(m *message) error
|
2021-11-08 14:46:31 +00:00
|
|
|
Messages(topic string, since sinceTime) ([]*message, error)
|
2021-11-03 01:09:49 +00:00
|
|
|
MessageCount(topic string) (int, error)
|
|
|
|
Topics() (map[string]*topic, error)
|
2021-12-09 03:57:31 +00:00
|
|
|
Prune(olderThan time.Time) error
|
2021-11-02 18:08:21 +00:00
|
|
|
}
|