web package renamed backend
This commit is contained in:
parent
2cd7f0d22f
commit
d30c35f1d7
8 changed files with 14 additions and 14 deletions
4
main.go
4
main.go
|
@ -15,9 +15,9 @@ import (
|
|||
"github.com/pushrax/chihaya/config"
|
||||
"github.com/pushrax/chihaya/server"
|
||||
|
||||
_ "github.com/pushrax/chihaya/storage/backend/batter"
|
||||
_ "github.com/pushrax/chihaya/storage/backend/gazelle"
|
||||
_ "github.com/pushrax/chihaya/storage/tracker/redis"
|
||||
_ "github.com/pushrax/chihaya/storage/web/batter"
|
||||
_ "github.com/pushrax/chihaya/storage/web/gazelle"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -13,8 +13,8 @@ import (
|
|||
|
||||
"github.com/pushrax/chihaya/config"
|
||||
|
||||
_ "github.com/pushrax/chihaya/storage/backend/batter"
|
||||
_ "github.com/pushrax/chihaya/storage/tracker/redis"
|
||||
_ "github.com/pushrax/chihaya/storage/web/batter"
|
||||
)
|
||||
|
||||
func newTestServer() (*Server, error) {
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
// Use of this source code is governed by the BSD 2-Clause license,
|
||||
// which can be found in the LICENSE file.
|
||||
|
||||
// Package web provides a generic interface for manipulating a
|
||||
// BitTorrent tracker's web application data.
|
||||
package web
|
||||
// Package backend provides a generic interface for manipulating a
|
||||
// BitTorrent tracker's backend data (usually for a web application).
|
||||
package backend
|
||||
|
||||
import (
|
||||
"fmt"
|
|
@ -11,14 +11,14 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/pushrax/chihaya/config"
|
||||
"github.com/pushrax/chihaya/storage/web"
|
||||
"github.com/pushrax/chihaya/storage/backend"
|
||||
|
||||
_ "github.com/bmizerany/pq"
|
||||
)
|
||||
|
||||
type driver struct{}
|
||||
|
||||
func (d *driver) New(conf *config.DataStore) web.Conn {
|
||||
func (d *driver) New(conf *config.DataStore) backend.Conn {
|
||||
dsn := fmt.Sprintf(
|
||||
"host=%s user=%s password=%s dbname=%s",
|
||||
conf.Host,
|
||||
|
@ -47,10 +47,10 @@ func (c *Conn) Start() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (c *Conn) RecordAnnounce(delta *web.AnnounceDelta) error {
|
||||
func (c *Conn) RecordAnnounce(delta *backend.AnnounceDelta) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
web.Register("batter", &driver{})
|
||||
backend.Register("batter", &driver{})
|
||||
}
|
|
@ -12,14 +12,14 @@ import (
|
|||
"sync"
|
||||
|
||||
"github.com/pushrax/chihaya/config"
|
||||
"github.com/pushrax/chihaya/storage/web"
|
||||
"github.com/pushrax/chihaya/storage/backend"
|
||||
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
)
|
||||
|
||||
type driver struct{}
|
||||
|
||||
func (d *driver) New(conf *config.DataStore) web.Conn {
|
||||
func (d *driver) New(conf *config.DataStore) backend.Conn {
|
||||
dsn := fmt.Sprintf(
|
||||
"%s:%s@%s:%s/%s?charset=utf8mb4,utf8",
|
||||
conf.Username,
|
||||
|
@ -77,7 +77,7 @@ func (c *Conn) Close() error {
|
|||
return c.DB.Close()
|
||||
}
|
||||
|
||||
func (c *Conn) RecordAnnounce(delta *web.AnnounceDelta) error {
|
||||
func (c *Conn) RecordAnnounce(delta *backend.AnnounceDelta) error {
|
||||
snatchCount := 0
|
||||
if delta.Snatched {
|
||||
snatchCount = 1
|
||||
|
@ -95,5 +95,5 @@ func (c *Conn) RecordAnnounce(delta *web.AnnounceDelta) error {
|
|||
}
|
||||
|
||||
func init() {
|
||||
web.Register("gazelle", &driver{})
|
||||
backend.Register("gazelle", &driver{})
|
||||
}
|
Loading…
Reference in a new issue