backend

package
v0.0.0-...-b47dde4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2014 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package backend provides a generic interface for manipulating a BitTorrent tracker's consistent backend data store (usually for a web application).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, driver Driver)

Register makes a database driver available by the provided name. If Register is called twice with the same name or if driver is nil, it panics.

Types

type Conn

type Conn interface {
	// Close terminates connections to the database(s) and gracefully shuts
	// down the driver
	Close() error

	// RecordAnnounce is called once per announce, and is passed the delta in
	// statistics for the client peer since its last announce.
	RecordAnnounce(delta *models.AnnounceDelta) error

	// LoadTorrents fetches and returns the specified torrents.
	LoadTorrents(ids []uint64) ([]*models.Torrent, error)

	// LoadAllTorrents fetches and returns all torrents.
	LoadAllTorrents() ([]*models.Torrent, error)

	// LoadUsers fetches and returns the specified users.
	LoadUsers(ids []uint64) ([]*models.User, error)

	// LoadAllUsers fetches and returns all users.
	LoadAllUsers(ids []uint64) ([]*models.User, error)
}

Conn represents a connection to the data store.

func Open

func Open(cfg *config.DriverConfig) (Conn, error)

Open creates a connection specified by a configuration.

type Driver

type Driver interface {
	New(*config.DriverConfig) (Conn, error)
}

Driver represents an interface to a long-running connection with a consistent data store.

Directories

Path Synopsis
Package noop implements a Chihaya backend storage driver as a no-op.
Package noop implements a Chihaya backend storage driver as a no-op.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL