memorybysubnet

package
v2.0.0-rc.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2017 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package memorybysubnet implements the storage interface for a Chihaya BitTorrent tracker keeping peer data in memory organized by a pre-configured subnet mask.

Index

Constants

View Source
const Name = "memorybysubnet"

Name is the name by which this peer store is registered with Chihaya.

Variables

This section is empty.

Functions

func New

func New(provided Config) (storage.PeerStore, error)

New creates a new PeerStore backed by memory that organizes peers by a pre-configured subnet mask.

Types

type Config

type Config struct {
	GarbageCollectionInterval      time.Duration `yaml:"gc_interval"`
	PrometheusReportingInterval    time.Duration `yaml:"prometheus_reporting_interval"`
	PeerLifetime                   time.Duration `yaml:"peer_lifetime"`
	ShardCount                     int           `yaml:"shard_count"`
	PreferredIPv4SubnetMaskBitsSet int           `yaml:"preferred_ipv4_subnet_mask_bits_set"`
	PreferredIPv6SubnetMaskBitsSet int           `yaml:"preferred_ipv6_subnet_mask_bits_set"`
}

Config holds the configuration of a memory PeerStore.

func (Config) LogFields

func (cfg Config) LogFields() log.Fields

LogFields renders the current config as a set of Logrus fields.

func (Config) Validate

func (cfg Config) Validate() Config

Validate sanity checks values set in a config and returns a new config with default values replacing anything that is invalid.

This function warns to the logger when a value is changed.

Jump to

Keyboard shortcuts

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