redisPeerStore

package
Version: v0.0.0-...-640c710 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EXPIRETIME int64 = 5 * 60

EXPIRETIME signifies how long a peer will live under the specified info_hash until the reaper removes it.

Functions

func CreateNewTorrentKey

func CreateNewTorrentKey(c *redis.Client, key string)

CreateNewTorrentKey Creates a new key. By default, it adds a member ":ip". I don't think this ought to ever be generalized, as I just want

to function in one specific way in notorious.

func GetAllPeers

func GetAllPeers(c *redis.Client, key string) []string

GetAllPeers fetches all peers from the info_hash at `key`

func GetBoolKeyVal

func GetBoolKeyVal(c *redis.Client, key string) bool

GetBoolKeyVal Checks if a `key` exists

func GetCount

func GetCount(c *redis.Client, infoHash string, member string) (retval int, err error)

GetCount counts all of the peers at `info_hash`

func GetKeyVal

func GetKeyVal(c *redis.Client, key string) []string

GetKeyVal Lookup a peer in the specified infohash at `key`

func OpenClient

func OpenClient() (client *redis.Client)

OpenClient opens a connection to redis.

func RemoveKeysValue

func RemoveKeysValue(c *redis.Client, key string, value string)

RemoveKeysValue Remove a `value` from `key` in the redis kv storage. `key` is typically a keymember of info_hash:(in)complete and the value is typically the ip:port concatenated.

func SetIPMember

func SetIPMember(c *redis.Client, infoHash, ipPort string) (retval int)

SetIPMember sets a key as a member of an infohash and sets a timeout.

func SetKeyIfNotExists

func SetKeyIfNotExists(c *redis.Client, keymember string, value string) (rv bool)

SetKeyIfNotExists Set a key if it doesn't exist.

func SetKeyVal

func SetKeyVal(c *redis.Client, keymember string, value string)

SetKeyVal Sets a key to the specified value. Used mostly with adding a peer into an info_hash

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL