mirror of
https://github.com/sot-tech/mochi.git
synced 2026-04-27 08:00:00 -07:00
29 lines
812 B
Go
29 lines
812 B
Go
// Copyright 2013 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 mock implements the storage interface for a BitTorrent tracker
|
|
// within memory. It can be used in production, but isn't recommended.
|
|
// Stored values will not persist if the tracker is restarted.
|
|
package mock
|
|
|
|
import (
|
|
"github.com/chihaya/chihaya/config"
|
|
"github.com/chihaya/chihaya/storage"
|
|
"github.com/chihaya/chihaya/storage/tracker"
|
|
)
|
|
|
|
type driver struct{}
|
|
|
|
func (d *driver) New(conf *config.DataStore) tracker.Pool {
|
|
return &Pool{
|
|
users: make(map[string]*storage.User),
|
|
torrents: make(map[string]*storage.Torrent),
|
|
whitelist: make(map[string]bool),
|
|
}
|
|
}
|
|
|
|
func init() {
|
|
tracker.Register("mock", &driver{})
|
|
}
|