repurpose drivers from mock to no-op and memory

This commit is contained in:
Jimmy Zelinskie
2014-07-15 00:22:04 -04:00
parent b321d1f0fa
commit d2ba9fb9f7
10 changed files with 82 additions and 110 deletions

View File

@@ -0,0 +1,27 @@
// Copyright 2014 The Chihaya Authors. All rights reserved.
// Use of this source code is governed by the BSD 2-Clause license,
// which can be found in the LICENSE file.
// Package memory implements a Chihaya tracker storage driver within memory.
// Stored values will not persist if the tracker is restarted.
package memory
import (
"github.com/chihaya/chihaya/config"
"github.com/chihaya/chihaya/drivers/tracker"
"github.com/chihaya/chihaya/models"
)
type driver struct{}
func (d *driver) New(conf *config.DriverConfig) tracker.Pool {
return &Pool{
users: make(map[string]*models.User),
torrents: make(map[string]*models.Torrent),
whitelist: make(map[string]bool),
}
}
func init() {
tracker.Register("memory", &driver{})
}