backend: add a Ping method to backend
This commit is contained in:
parent
e02f1dd0ea
commit
a0bcc07893
2 changed files with 11 additions and 0 deletions
|
@ -53,6 +53,10 @@ type Conn interface {
|
||||||
// down the driver
|
// down the driver
|
||||||
Close() error
|
Close() error
|
||||||
|
|
||||||
|
// Ping just checks to see if the database is still alive. This is typically
|
||||||
|
// used for health checks.
|
||||||
|
Ping() error
|
||||||
|
|
||||||
// RecordAnnounce is called once per announce, and is passed the delta in
|
// RecordAnnounce is called once per announce, and is passed the delta in
|
||||||
// statistics for the client peer since its last announce.
|
// statistics for the client peer since its last announce.
|
||||||
RecordAnnounce(delta *models.AnnounceDelta) error
|
RecordAnnounce(delta *models.AnnounceDelta) error
|
||||||
|
|
|
@ -14,6 +14,8 @@ import (
|
||||||
|
|
||||||
type driver struct{}
|
type driver struct{}
|
||||||
|
|
||||||
|
// NoOp is a backend driver for Chihaya that does nothing. This is used by
|
||||||
|
// public trackers.
|
||||||
type NoOp struct{}
|
type NoOp struct{}
|
||||||
|
|
||||||
// New returns a new Chihaya backend driver that does nothing.
|
// New returns a new Chihaya backend driver that does nothing.
|
||||||
|
@ -26,6 +28,11 @@ func (n *NoOp) Close() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ping returns nil.
|
||||||
|
func (n *NoOp) Ping() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// RecordAnnounce returns nil.
|
// RecordAnnounce returns nil.
|
||||||
func (n *NoOp) RecordAnnounce(delta *models.AnnounceDelta) error {
|
func (n *NoOp) RecordAnnounce(delta *models.AnnounceDelta) error {
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Add table
Reference in a new issue