mirror of
https://github.com/logos-messaging/go-libp2p-rendezvous.git
synced 2026-01-02 12:53:13 +00:00
We now have: - db/dbi.go -- interface, no dependency on any particular database - db/sqlite/... -- sqlite implementation, depends on dbi - the rendezvous.NewRendezvousService API has been redefined to NewRendezvouServiceWithDB service importer constructs the database of choice - the rendezvous package has no dependences on db implementation, so clients can import without linking SQLite in the binary
22 lines
471 B
Go
22 lines
471 B
Go
package dbi
|
|
|
|
import (
|
|
peer "github.com/libp2p/go-libp2p-peer"
|
|
)
|
|
|
|
type RegistrationRecord struct {
|
|
Id peer.ID
|
|
Addrs [][]byte
|
|
Ns string
|
|
Ttl int
|
|
}
|
|
|
|
type DB interface {
|
|
Close() error
|
|
Register(p peer.ID, ns string, addrs [][]byte, ttl int) error
|
|
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
|
|
}
|