common

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultAuthPort      = 121
	DefaultHoarderPort   = 142
	DefaultMonkeyPort    = 163
	DefaultPatrickPort   = 184
	DefaultSeerPort      = 205
	DefaultTNSPort       = 226
	DefaultSubstratePort = 282
	DefaultDnsPort       = 304

	DefaultSeerHttpPort      = 403
	DefaultPatrickHttpPort   = 424
	DefaultAuthHttpPort      = 445
	DefaultTNSHttpPort       = 466
	DefaultSubstrateHttpPort = 529

	DreamlandApiListen = DefaultHost + ":1421"
)
View Source
var (
	DefaultHost             string = "127.0.0.1"
	DefaultP2PListenFormat  string = "/ip4/" + DefaultHost + "/tcp/%d"
	DefaultHTTPListenFormat string = "%s://" + DefaultHost + ":%d"
)
View Source
var (
	BaseAfterStartDelay = 100 // Millisecond
	MaxAfterStartDelay  = 500 // Millisecond
	MeshTimeout         = 5 * time.Second
)
View Source
var StartAllDefaultSimple = "client"

Functions

func AfterStartDelay

func AfterStartDelay() time.Duration

func GetCacheFolder

func GetCacheFolder() (string, error)

Types

type ClientCreationMethod

type ClientCreationMethod func(*common.ClientConfig) error

type Config

type Config struct {
	Services map[string]common.ServiceConfig
	Clients  map[string]common.ClientConfig
	Simples  map[string]SimpleConfig
}

type Multiverse

type Multiverse interface {
	Exist(universe string) bool
	Universe(name string) Universe
	Context() context.Context
	ValidServices() []string
	ValidFixtures() []string
	ValidClients() []string
	Status() interface{}
}

type NodeInfo

type NodeInfo struct {
	DbFactory kvdb.Factory
	Node      peer.Node
	Name      string
	Ports     map[string]int
}

type Simple

type Simple interface {
	PeerNode() peer.Node
	CreateSeerClient(config *common.ClientConfig) error
	Seer() seer.Client
	CreateAuthClient(config *common.ClientConfig) error
	Auth() auth.Client
	CreatePatrickClient(config *common.ClientConfig) error
	Patrick() patrick.Client
	CreateTNSClient(config *common.ClientConfig) error
	TNS() tns.Client
	CreateMonkeyClient(config *common.ClientConfig) error
	Monkey() monkey.Client
	CreateHoarderClient(config *common.ClientConfig) error
	Hoarder() hoarder.Client
	Provides(clients ...string) error
}

type SimpleConfig

type SimpleConfig struct {
	common.CommonConfig
	Clients SimpleConfigClients
}

type SimpleConfigClients

type SimpleConfigClients struct {
	Seer      *common.ClientConfig
	Auth      *common.ClientConfig
	Patrick   *common.ClientConfig
	TNS       *common.ClientConfig
	Monkey    *common.ClientConfig
	Hoarder   *common.ClientConfig
	Substrate *common.ClientConfig
}

type Universe

type Universe interface {
	Id() string
	Name() string
	Root() string // copy | just in case modified accidently
	Seer() seer.Service
	Auth() auth.Service
	Patrick() patrick.Service
	TNS() tns.Service
	Monkey() monkey.Service
	Hoarder() hoarder.Service
	Substrate() substrate.Service
	Context() context.Context
	Stop()
	// If no simple defined, starts one named StartAllDefaultSimple.
	StartAll(simples ...string) error
	Simple(name string) (Simple, error)
	StartWithConfig(mainConfig *Config) error
	Kill(serviceName string) error
	KillNodeByNameID(name string, id string) error
	GetPortHttp(peer.Node) (int, error)
	GetURLHttp(node peer.Node) (url string, err error)
	GetURLHttps(node peer.Node) (url string, err error)
	RunFixture(name string, params ...interface{}) error
	CreateSimpleNode(name string, config *SimpleConfig) (peer.Node, error)
	All() []peer.Node
	Register(node peer.Node, name string, ports map[string]int)
	Lookup(id string) (*NodeInfo, bool)
	Mesh(newNodes ...peer.Node)
	Service(name string, config *common.ServiceConfig) error
	Provides(services ...string) error
	// Calls to grab services by pid
	SeerByPid(pid string) (seer.Service, bool)
	AuthByPid(pid string) (auth.Service, bool)
	PatrickByPid(pid string) (patrick.Service, bool)
	TnsByPid(pid string) (tns.Service, bool)
	MonkeyByPid(pid string) (monkey.Service, bool)
	HoarderByPid(pid string) (hoarder.Service, bool)
	SubstrateByPid(pid string) (substrate.Service, bool)
	ListNumber(name string) int
	GetServicePids(name string) ([]string, error)
	//
	PortFor(string, string) int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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