1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2024-12-23 10:12:38 +01:00
ntfy/server/cache.go

26 lines
689 B
Go
Raw Normal View History

2021-11-02 19:08:21 +01:00
package server
import (
2021-12-07 17:45:15 +01:00
"errors"
2021-11-02 19:08:21 +01:00
_ "github.com/mattn/go-sqlite3" // SQLite driver
2021-11-03 02:09:49 +01:00
"time"
2021-11-02 19:08:21 +01:00
)
2021-12-07 17:45:15 +01: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 02:09:49 +01:00
type cache interface {
AddMessage(m *message) error
Messages(topic string, since sinceTime, scheduled bool) ([]*message, error)
MessagesDue() ([]*message, error)
2021-11-03 02:09:49 +01:00
MessageCount(topic string) (int, error)
Topics() (map[string]*topic, error)
2021-12-09 04:57:31 +01:00
Prune(olderThan time.Time) error
MarkPublished(m *message) error
AttachmentsSize(owner string) (int64, error)
2022-01-07 15:15:33 +01:00
AttachmentsExpired() ([]string, error)
2021-11-02 19:08:21 +01:00
}