tracker/README.md

94 lines
3.7 KiB
Markdown
Raw Normal View History

2013-08-13 07:41:45 +02:00
# Chihaya [![Build Status](https://travis-ci.org/pushrax/chihaya.png?branch=master)](https://travis-ci.org/pushrax/chihaya)
2013-06-22 01:31:32 +02:00
2013-08-13 07:41:45 +02:00
Chihaya is a high-performance [BitTorrent tracker](http://en.wikipedia.org/wiki/BitTorrent_tracker)
2013-08-21 23:24:36 +02:00
written in the Go programming language. It is still heavily under development and should not be used
in production. Some of the planned features include.
2013-06-22 01:31:32 +02:00
2013-08-13 07:41:45 +02:00
- Low resource consumption
- *Fast* request processing
2013-08-21 23:24:36 +02:00
- Maximum compatibility with what exists of the BitTorrent spec
- Correct IPv6 support
2013-08-23 21:39:42 +02:00
- A generic storage interfaces that is easily adapted to use any data store and web application
- Scaling properties that directly correlate with those of the chosen data stores
2013-08-21 23:24:36 +02:00
## Architecture
You are most likely looking to integrate Chihaya with a web application for organizing torrents
and managing a community. Chihaya was designed with this in mind, but also tries to remain
2013-08-23 21:39:42 +02:00
independent. Chihaya connects to two data stores. The first, known as "cache", is used between
Chihaya processes in order to keep up with fast changing data. The second, known as "storage",
is your web application's data store. Changes immediately take place in the cache, which is why
fast data stores are recommended. These changes are also collected and periodically applied to the
storage in order to avoid locking up your web application's data store.
2013-06-22 01:31:32 +02:00
2013-08-13 07:41:45 +02:00
## Installing
2013-06-22 01:31:32 +02:00
2013-08-21 23:24:36 +02:00
Make sure you have your $GOROOT and $GOPATH set up correctly and have your $GOBIN on your $PATH.
2013-06-22 01:31:32 +02:00
2013-08-13 07:43:49 +02:00
```sh
$ go install github.com/pushrax/chihaya
```
2013-06-22 01:31:32 +02:00
2013-08-13 07:41:45 +02:00
## Configuring
2013-06-22 01:31:32 +02:00
2013-08-13 07:41:45 +02:00
Configuration is done in a JSON formatted file specified with the `-config`
flag. An example configuration can be seen in the `exampleConfig` variable of
[`config/config_test.go`](https://github.com/pushrax/chihaya/blob/master/config/config_test.go).
2013-08-23 21:39:42 +02:00
## Default drivers
2013-08-23 21:39:42 +02:00
### Cache
Chihaya currently supports drivers for the following caches out of the box:
* [redis](http://redis.io)
2013-06-22 01:31:32 +02:00
2013-08-23 21:39:42 +02:00
### Storage
Chihaya currently supports drivers for the following storages out of the box:
* [batter-postgres](https://github.com/wafflesfm/batter)
## Custom drivers
Please read the documentation and understand these interfaces as there are
assumptions made about thread-safety. After you've implemented a new driver,
all you have to do is remember to add `import _ path/to/your/package` to the
top of `main.go` and the side effects from `init()` will globally register
your driver so that config package will recognize your driver by name.
If you're writing a driver for a popular data store, consider contributing it.
### Cache
2013-08-13 07:41:45 +02:00
2013-08-23 21:39:42 +02:00
The [`cache`] package is heavily inspired by the standard library's
[`database/sql`] package. To write a new cache backend, create a new Go
2013-08-21 23:24:36 +02:00
package that has an implementation of the [`Pool`], [`Tx`], and [`Driver`]
2013-08-13 07:41:45 +02:00
interfaces. Within that package, you must also define an [`init()`] that calls
2013-08-23 21:39:42 +02:00
[`cache.Register`].
2013-08-13 07:41:45 +02:00
2013-08-23 21:39:42 +02:00
[`cache`]: http://godoc.org/github.com/pushrax/chihaya/cache
2013-08-13 07:41:45 +02:00
[`database/sql`]: http://godoc.org/database/sql
2013-08-23 21:39:42 +02:00
[`Pool`]: http://godoc.org/github.com/pushrax/chihaya/cache#Pool
[`Tx`]: http://godoc.org/github.com/pushrax/chihaya/cache#Tx
[`Driver`]: http://godoc.org/github.com/pushrax/chihaya/cache#Driver
2013-08-13 07:41:45 +02:00
[`init()`]: http://golang.org/ref/spec#Program_execution
2013-08-23 21:39:42 +02:00
[`cache.Register`]: http://godoc.org/github.com/pushrax/chihaya/cache#Register
2013-08-13 07:41:45 +02:00
2013-08-23 21:39:42 +02:00
### Storage
2013-08-13 07:41:45 +02:00
2013-08-23 21:39:42 +02:00
TODO
2013-08-13 07:41:45 +02:00
## Contributing
2013-08-21 23:24:36 +02:00
If you're interested in contributing, please contact us in **[#chihaya] on
2013-08-23 21:39:42 +02:00
[freenode IRC]** or post to the GitHub issue tracker. Please don't offer
2013-08-13 07:41:45 +02:00
massive pull requests with no prior communication attempts as it will most
2013-08-21 23:24:36 +02:00
likely lead to confusion and time wasted for everyone. However, small
2013-08-13 07:41:45 +02:00
unannounced fixes are always welcome.
2013-08-21 23:24:36 +02:00
[#chihaya]: http://webchat.freenode.net?channels=chihaya
2013-08-23 22:21:23 +02:00
[freenode IRC]: http://freenode.net
And remember: good gophers always use gofmt!