22 lines
532 B
Go
Raw Normal View History

2023-03-27 09:51:55 -04:00
package dbi
import (
"github.com/libp2p/go-libp2p/core/peer"
)
type RegistrationRecord struct {
2023-06-07 16:46:50 -04:00
Id peer.ID
SignedPeerRecord []byte
Ns string
Ttl int
2023-03-27 09:51:55 -04:00
}
type DB interface {
Close() error
2023-06-07 16:46:50 -04:00
Register(p peer.ID, ns string, signedPeerRecord []byte, ttl int) (uint64, error)
2023-03-27 09:51:55 -04:00
Unregister(p peer.ID, ns string) error
CountRegistrations(p peer.ID) (int, error)
Discover(ns string, cookie []byte, limit int) ([]RegistrationRecord, []byte, error)
ValidCookie(ns string, cookie []byte) bool
}