service

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2020 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	PRIORITY_LOW = iota
	PRIORITY_MEDIUM
	PRIORITY_HIGH
)

defines different levels of priority for services

Variables

View Source
var (
	ERR_PERMISSION_DENIED = errors.New("permission denied")
	ERR_DEFAULT           = errors.New("default error")
)

Functions

This section is empty.

Types

type ApplicationCallback

type ApplicationCallback func(string) ServiceData

type ApplicationContainer

type ApplicationContainer struct {
	GetService ApplicationCallback
	Priority   int // higher the better
	// contains filtered or unexported fields
}

func (*ApplicationContainer) GetDHT

func (sas *ApplicationContainer) GetDHT() *dht.IpfsDHT

func (*ApplicationContainer) GetHost

func (sas *ApplicationContainer) GetHost() host.Host

func (*ApplicationContainer) GetName

func (sas *ApplicationContainer) GetName() string

func (*ApplicationContainer) GetProtocol

func (sas *ApplicationContainer) GetProtocol() proto.ID

func (*ApplicationContainer) GetPubSub

func (sas *ApplicationContainer) GetPubSub() *floodsub.PubSub

func (*ApplicationContainer) GetVersion

func (sas *ApplicationContainer) GetVersion() uint

func (*ApplicationContainer) SetAppMeta

func (sas *ApplicationContainer) SetAppMeta(app ApplicationCallback, h *host.Host, d *dht.IpfsDHT, p *floodsub.PubSub)

func (*ApplicationContainer) SetNameVersion

func (sas *ApplicationContainer) SetNameVersion(name string, ver uint)

func (*ApplicationContainer) SetPriority

func (sas *ApplicationContainer) SetPriority(p int)

type ApplicationLinker

type ApplicationLinker interface {
	SetAppMeta(ApplicationCallback, *host.Host, *dht.IpfsDHT, *floodsub.PubSub)
}

ApplicationLinker is implemented in struct

type Service

type Service interface {
	ApplicationLinker
	ServiceData
	GetName() string
	GetVersion() uint
	GetProtocol() protocol.ID
	Start(context.Context) error
	Stop() error
	Run(inet.Stream)
}

Service defines a generic service.

type ServiceData

type ServiceData interface {
	Get(string) (chan interface{}, error)
	Set(string, interface{}) error
}

ServiceData represents functions when GetService is called in any service.

Jump to

Keyboard shortcuts

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