RelayInterface => nostr.RelayStore

This commit is contained in:
fiatjaf
2024-02-09 11:26:54 -03:00
parent d7917cefd4
commit a86745ec5f
3 changed files with 4 additions and 10 deletions

View File

@@ -7,17 +7,11 @@ import (
"github.com/nbd-wtf/go-nostr"
)
// RelayInterface is a wrapper thing that unifies Store and nostr.Relay under a common API.
type RelayInterface interface {
Publish(ctx context.Context, event nostr.Event) error
QuerySync(ctx context.Context, filter nostr.Filter, opts ...nostr.SubscriptionOption) ([]*nostr.Event, error)
}
type RelayWrapper struct {
Store
}
var _ RelayInterface = (*RelayWrapper)(nil)
var _ nostr.RelayStore = (*RelayWrapper)(nil)
func (w RelayWrapper) Publish(ctx context.Context, evt nostr.Event) error {
if 20000 <= evt.Kind && evt.Kind < 30000 {