2018-04-26 14:06:58 +03:00
|
|
|
package dbi
|
|
|
|
|
|
|
|
|
|
import (
|
2019-05-28 14:41:28 -04:00
|
|
|
"github.com/libp2p/go-libp2p-core/peer"
|
2018-04-26 14:06:58 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type RegistrationRecord struct {
|
|
|
|
|
Id peer.ID
|
|
|
|
|
Addrs [][]byte
|
|
|
|
|
Ns string
|
|
|
|
|
Ttl int
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DB interface {
|
|
|
|
|
Close() error
|
2019-01-18 15:46:02 +02:00
|
|
|
Register(p peer.ID, ns string, addrs [][]byte, ttl int) (uint64, error)
|
2018-04-26 14:06:58 +03: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
|
|
|
|
|
}
|