tracker/backend
2015-10-28 19:08:11 +01:00
..
noop backend: remove unused parameter from LoadAllUsers() 2015-10-28 19:08:11 +01:00
backend.go backend: remove unused parameter from LoadAllUsers() 2015-10-28 19:08:11 +01:00
README.md docs: move driver docs into backend/README.md 2015-01-28 22:51:09 -05:00

Implementing a Driver

The backend package is meant to provide announce deltas to a slower and more consistent database, such as the one powering a torrent-indexing website. Implementing a backend driver is heavily inspired by the standard library's database/sql package: simply create a package that implements the backend.Driver and backend.Conn interfaces and calls backend.Register in it's init(). Please note that backend.Conn must be thread-safe. A great place to start is to read the no-op driver which comes out-of-the-box with Chihaya and is meant to be used for public trackers.

Creating a binary with your own driver

Chihaya is designed to be extended. If you require more than the drivers provided out-of-the-box, you are free to create your own and then produce your own custom Chihaya binary. To create this binary, simply create your own main package, import your custom drivers, then call chihaya.Boot from main.

Example

package main

import (
	"github.com/chihaya/chihaya"

  // Import any of your own drivers.
	_ "github.com/yourusername/chihaya-custom-backend"
)

func main() {
  // Start Chihaya normally.
	chihaya.Boot()
}