-
Notifications
You must be signed in to change notification settings - Fork 12
/
interface.go
27 lines (22 loc) · 923 Bytes
/
interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package serverdb
import (
"context"
"errors"
"time"
"github.com/companyzero/bisonrelay/ratchet"
)
var ErrAlreadyStoredRV = errors.New("already stored payload at the RV point")
type FetchPayloadResult struct {
Payload []byte
InsertTime time.Time
}
type ServerDB interface {
StorePayload(ctx context.Context, rv ratchet.RVPoint, payload []byte, insertTime time.Time) error
FetchPayload(ctx context.Context, rv ratchet.RVPoint) (*FetchPayloadResult, error)
RemovePayload(ctx context.Context, rv ratchet.RVPoint) error
IsSubscriptionPaid(ctx context.Context, rv ratchet.RVPoint) (bool, error)
StoreSubscriptionPaid(ctx context.Context, rv ratchet.RVPoint, insertTime time.Time) error
Expire(ctx context.Context, date time.Time) (uint64, error)
IsPushPaymentRedeemed(ctx context.Context, payID []byte) (bool, error)
StorePushPaymentRedeemed(ctx context.Context, payID []byte, insertTime time.Time) error
}