2019-10-07 22:14:47 +08:00
|
|
|
// Copyright (c) Mainflux
|
2018-08-26 19:15:48 +08:00
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2018-08-06 23:06:55 +08:00
|
|
|
package readers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
2019-11-05 18:57:16 +08:00
|
|
|
"github.com/mainflux/mainflux/transformers/senml"
|
2018-08-06 23:06:55 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
// ErrNotFound indicates that requested entity doesn't exist.
|
|
|
|
var ErrNotFound = errors.New("entity not found")
|
|
|
|
|
|
|
|
// MessageRepository specifies message reader API.
|
|
|
|
type MessageRepository interface {
|
|
|
|
// ReadAll skips given number of messages for given channel and returns next
|
|
|
|
// limited number of messages.
|
2019-05-07 21:59:18 +08:00
|
|
|
ReadAll(string, uint64, uint64, map[string]string) (MessagesPage, error)
|
2019-04-25 06:18:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// MessagesPage contains page related metadata as well as list of messages that
|
|
|
|
// belong to this page.
|
|
|
|
type MessagesPage struct {
|
|
|
|
Total uint64
|
|
|
|
Offset uint64
|
|
|
|
Limit uint64
|
2019-11-05 18:57:16 +08:00
|
|
|
Messages []senml.Message
|
2018-08-06 23:06:55 +08:00
|
|
|
}
|