web package renamed backend

This commit is contained in:
Jimmy Zelinskie 2013-10-21 03:29:35 -04:00
parent 2cd7f0d22f
commit d30c35f1d7
8 changed files with 14 additions and 14 deletions

View file

@ -15,9 +15,9 @@ import (
"github.com/pushrax/chihaya/config" "github.com/pushrax/chihaya/config"
"github.com/pushrax/chihaya/server" "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/tracker/redis"
_ "github.com/pushrax/chihaya/storage/web/batter"
_ "github.com/pushrax/chihaya/storage/web/gazelle"
) )
var ( var (

View file

@ -13,8 +13,8 @@ import (
"github.com/pushrax/chihaya/config" "github.com/pushrax/chihaya/config"
_ "github.com/pushrax/chihaya/storage/backend/batter"
_ "github.com/pushrax/chihaya/storage/tracker/redis" _ "github.com/pushrax/chihaya/storage/tracker/redis"
_ "github.com/pushrax/chihaya/storage/web/batter"
) )
func newTestServer() (*Server, error) { func newTestServer() (*Server, error) {

View file

@ -2,9 +2,9 @@
// Use of this source code is governed by the BSD 2-Clause license, // Use of this source code is governed by the BSD 2-Clause license,
// which can be found in the LICENSE file. // which can be found in the LICENSE file.
// Package web provides a generic interface for manipulating a // Package backend provides a generic interface for manipulating a
// BitTorrent tracker's web application data. // BitTorrent tracker's backend data (usually for a web application).
package web package backend
import ( import (
"fmt" "fmt"

View file

@ -11,14 +11,14 @@ import (
"fmt" "fmt"
"github.com/pushrax/chihaya/config" "github.com/pushrax/chihaya/config"
"github.com/pushrax/chihaya/storage/web" "github.com/pushrax/chihaya/storage/backend"
_ "github.com/bmizerany/pq" _ "github.com/bmizerany/pq"
) )
type driver struct{} type driver struct{}
func (d *driver) New(conf *config.DataStore) web.Conn { func (d *driver) New(conf *config.DataStore) backend.Conn {
dsn := fmt.Sprintf( dsn := fmt.Sprintf(
"host=%s user=%s password=%s dbname=%s", "host=%s user=%s password=%s dbname=%s",
conf.Host, conf.Host,
@ -47,10 +47,10 @@ func (c *Conn) Start() error {
return nil return nil
} }
func (c *Conn) RecordAnnounce(delta *web.AnnounceDelta) error { func (c *Conn) RecordAnnounce(delta *backend.AnnounceDelta) error {
return nil return nil
} }
func init() { func init() {
web.Register("batter", &driver{}) backend.Register("batter", &driver{})
} }

View file

@ -12,14 +12,14 @@ import (
"sync" "sync"
"github.com/pushrax/chihaya/config" "github.com/pushrax/chihaya/config"
"github.com/pushrax/chihaya/storage/web" "github.com/pushrax/chihaya/storage/backend"
_ "github.com/go-sql-driver/mysql" _ "github.com/go-sql-driver/mysql"
) )
type driver struct{} type driver struct{}
func (d *driver) New(conf *config.DataStore) web.Conn { func (d *driver) New(conf *config.DataStore) backend.Conn {
dsn := fmt.Sprintf( dsn := fmt.Sprintf(
"%s:%s@%s:%s/%s?charset=utf8mb4,utf8", "%s:%s@%s:%s/%s?charset=utf8mb4,utf8",
conf.Username, conf.Username,
@ -77,7 +77,7 @@ func (c *Conn) Close() error {
return c.DB.Close() return c.DB.Close()
} }
func (c *Conn) RecordAnnounce(delta *web.AnnounceDelta) error { func (c *Conn) RecordAnnounce(delta *backend.AnnounceDelta) error {
snatchCount := 0 snatchCount := 0
if delta.Snatched { if delta.Snatched {
snatchCount = 1 snatchCount = 1
@ -95,5 +95,5 @@ func (c *Conn) RecordAnnounce(delta *web.AnnounceDelta) error {
} }
func init() { func init() {
web.Register("gazelle", &driver{}) backend.Register("gazelle", &driver{})
} }