backend: add a Ping method to backend

This commit is contained in:
Jimmy Zelinskie 2015-02-08 17:14:48 -05:00
parent e02f1dd0ea
commit a0bcc07893
2 changed files with 11 additions and 0 deletions

View file

@ -53,6 +53,10 @@ type Conn interface {
// down the driver
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
// statistics for the client peer since its last announce.
RecordAnnounce(delta *models.AnnounceDelta) error

View file

@ -14,6 +14,8 @@ import (
type driver struct{}
// NoOp is a backend driver for Chihaya that does nothing. This is used by
// public trackers.
type NoOp struct{}
// New returns a new Chihaya backend driver that does nothing.
@ -26,6 +28,11 @@ func (n *NoOp) Close() error {
return nil
}
// Ping returns nil.
func (n *NoOp) Ping() error {
return nil
}
// RecordAnnounce returns nil.
func (n *NoOp) RecordAnnounce(delta *models.AnnounceDelta) error {
return nil