tracker/backend
2015-02-08 17:14:48 -05:00
..
noop backend: add a Ping method to backend 2015-02-08 17:14:48 -05:00
backend.go backend: add a Ping method to backend 2015-02-08 17:14:48 -05: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()
}