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: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package service defines a service the wraps a P2P host.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotNetwork is returned when a specified service is not a network.
	ErrNotNetwork = errors.New("connected service is not a network or swarm")

	// ErrNotConnManager is returned when a specified service is not a
	// connection manager.
	ErrNotConnManager = errors.New("connected service is not a connection manager")

	// ErrUnavailable is returned from gRPC methods when the service is not
	// available.
	ErrUnavailable = errors.New("the service is not available")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// Network is the name of the network or swarm service.
	Network string `toml:"network" comment:"The name of the network or swarm service."`

	// ConnectionManager is the name of the connection manager service.
	ConnectionManager string `toml:"connection_manager" comment:"The name of the connection manager service."`

	// NegotiationTimeout is the negotiation timeout.
	NegotiationTimeout string `toml:"negotiation_timeout" comment:"The negotiation timeout."`

	// AddressesNetmasks are CIDR netmasks to filter announced addresses.
	AddressesNetmasks []string `toml:"addresses_netmasks" comment:"CIDR netmasks to filter announced addresses."`
}

Config contains configuration options for the Host service.

type Service

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

Service is the Host service.

func (*Service) AddToGRPCServer

func (s *Service) AddToGRPCServer(gs *grpc.Server)

AddToGRPCServer adds the service to a gRPC server.

func (*Service) Config

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

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

It can panic but it can only happen during `stratumn-node init`.

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 service to other services.

It exposes the type:

github.com/stratumn/go-node/core/*p2p.Host

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) Needs

func (s *Service) Needs() map[string]struct{}

Needs returns the set of services this service depends on.

func (*Service) Plug

func (s *Service) Plug(exposed map[string]interface{}) error

Plug sets the connected services.

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