service

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2019 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package service defines a service that manages the number of connections kept open.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// LowWater is the minimum number of connections to keep open.
	LowWater int `toml:"low_water" comment:"Minimum number of connections to keep open (0 = disabled)."`

	// HighWater is the maximum number of connections to keep open.
	HighWater int `toml:"high_water" comment:"Maximum number of connections to keep open (0 = disabled)."`

	// GracePeriod is how long to keep a connection before it can be closed.
	GracePeriod string `toml:"grace_period" comment:"How long to keep a connection before it can be closed."`
}

Config contains configuration options for the Connection Manager service.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the Connection Manager service.

func (*Service) Config

func (s *Service) Config() interface{}

Config returns the current service configuration or creates one with good default values.

func (*Service) Desc

func (s *Service) Desc() string

Desc returns a description of what the service does.

func (*Service) Expose

func (s *Service) Expose() interface{}

Expose exposes the connection manager to other services.

It exposes the type:

github.com/libp2p/*go-libp2p-connmgr.BasicConnMgr

func (*Service) ID

func (s *Service) ID() string

ID returns the unique identifier of the service.

func (*Service) Name

func (s *Service) Name() string

Name returns the human friendly name of the service.

func (*Service) Run

func (s *Service) Run(ctx context.Context, running, stopping func()) error

Run starts the service.

func (*Service) SetConfig

func (s *Service) SetConfig(config interface{}) error

SetConfig configures the service.

Jump to

Keyboard shortcuts

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