mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-08-20 18:23:50 +02:00
26 lines
689 B
Go
26 lines
689 B
Go
package server
|
|
|
|
import (
|
|
"errors"
|
|
_ "github.com/mattn/go-sqlite3" // SQLite driver
|
|
"time"
|
|
)
|
|
|
|
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.
|
|
type cache interface {
|
|
AddMessage(m *message) error
|
|
Messages(topic string, since sinceTime, scheduled bool) ([]*message, error)
|
|
MessagesDue() ([]*message, error)
|
|
MessageCount(topic string) (int, error)
|
|
Topics() (map[string]*topic, error)
|
|
Prune(olderThan time.Time) error
|
|
MarkPublished(m *message) error
|
|
AttachmentsSize(owner string) (int64, error)
|
|
AttachmentsExpired() ([]string, error)
|
|
}
|