dream

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: BSD-3-Clause Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Ports map[string]int

	DreamlandApiListen = DefaultHost + ":1421"

	DefaultHost             string = "127.0.0.1"
	DefaultP2PListenFormat  string = "/ip4/" + DefaultHost + "/tcp/%d"
	DefaultHTTPListenFormat string = "%s://" + DefaultHost + ":%d"

	BaseAfterStartDelay = 500  // Millisecond
	MaxAfterStartDelay  = 1000 // Millisecond
	MeshTimeout         = 5 * time.Second
)

TODO: Need to verify which vars need to be exported

View Source
var FixtureMap = map[string]FixtureDefinition{
	"setBranch": {
		Description: "set the default branch for services to resolve",
		ImportRef:   "libdream/common/fixtures",
		Variables: []FixtureVariable{
			{
				Name:     "name",
				Alias:    "n",
				Required: true,
			},
		},
	},
	"createProjectWithJobs": {
		Description: "creates jobs for code and config repos",
		ImportRef:   "patrick",
		Internal:    true,
	},
	"pushAll": {
		Description: "pushes all ",
		ImportRef:   "patrick",
		Variables: []FixtureVariable{
			{
				Name:     "project-id",
				Alias:    "pid",
				Required: false,
			},
			{
				Name:     "branch",
				Alias:    "b",
				Required: false,
			},
		},
	},
	"pushConfig": {
		Description: "pushes into config repo",
		ImportRef:   "patrick",
		Internal:    true,
	},
	"pushCode": {
		Description: "pushes into code repo",
		ImportRef:   "patrick",
		Internal:    true,
	},
	"pushWebsite": {
		Description: "pushes website repo",
		ImportRef:   "patrick",
		Internal:    true,
	},
	"pushLibrary": {
		Description: "pushes library repo",
		ImportRef:   "patrick",
		Internal:    true,
	},
	"attachDomain": {
		Description: "attaches default FQDN",
		ImportRef:   "substrate",
		Internal:    true,
	},
	"clearRepos": {
		Description: "delete all unused repos",
		ImportRef:   "dreamland-test/fixtures",
		Internal:    true,
	},
	"attachPlugin": {
		Description: "inject a plugin binary built using VM-Orbit",
		ImportRef:   "substrate",
		Variables: []FixtureVariable{
			{
				Name:        "paths",
				Description: "comma separated list of binary paths",
				Alias:       "p",
				Required:    true,
			},
		},
	},
	"pushSpecific": {
		Description: "pushes specific repos",
		ImportRef:   "patrick",
		Variables: []FixtureVariable{
			{
				Name:     "repository-id",
				Alias:    "rid",
				Required: true,
			},
			{
				Name:        "repository-fullname",
				Alias:       "fn",
				Description: "ex: taubyte-test/tb_repo",
				Required:    true,
			},
			{
				Name:        "project-id",
				Alias:       "pid",
				Description: "Defaults to the test project id",
				Required:    false,
			},
			{
				Name:        "branch",
				Alias:       "b",
				Description: fmt.Sprintf("Defaults to %v", commonSpec.DefaultBranches),
				Required:    false,
			},
		},
	},
	"attachProdProject": {
		Description: "Attach a production project to dreamland",
		ImportRef:   "dreamland-test/fixtures",
		Internal:    true,
		Variables: []FixtureVariable{
			{
				Name:        "project-id",
				Alias:       "pid",
				Description: "",
				Required:    true,
			},
			{
				Name:        "git-token",
				Alias:       "t",
				Description: "",
				Required:    true,
			},
		},
	},
	"importProdProject": {
		Description: "Import a production project to dreamland and push all the repos",
		ImportRef:   "dreamland-test/fixtures",
		Internal:    true,
		Variables: []FixtureVariable{
			{
				Name:        "project-id",
				Alias:       "pid",
				Description: "",
				Required:    true,
			},
			{
				Name:        "git-token",
				Alias:       "t",
				Description: "",
				Required:    true,
			},
			{
				Name:        "branch",
				Alias:       "b",
				Description: fmt.Sprintf("Defaults to %v", commonSpec.DefaultBranches),
				Required:    false,
			},
		},
	},
	"fakeProject": {
		Description: "Pushes the internal project to tns",
		ImportRef:   "tau/dream/common/fixtures",
		Internal:    true,
	},
	"injectProject": {
		Description: "Pass in a *projectSchema.Project to inject it into tns",
		ImportRef:   "tau/dream/common/fixtures",
		BlockCLI:    true,
		Internal:    true,
	},
	"compileFor": {
		Description: "pushes specific repos",
		ImportRef:   "monkey/fixtures/compile",
		Internal:    true,
		Variables: []FixtureVariable{
			{
				Name:        "project-id",
				Alias:       "pid",
				Description: "Defaults to the test project id",
				Required:    true,
			},
			{
				Name:        "application-id",
				Alias:       "app",
				Description: "",
				Required:    false,
			},
			{
				Name:        "resource-id",
				Alias:       "rid",
				Description: "",
				Required:    true,
			},
			{
				Name:        "branch",
				Alias:       "b",
				Description: fmt.Sprintf("Defaults to %v", commonSpec.DefaultBranches),
				Required:    false,
			},
			{
				Name:        "path",
				Alias:       "p",
				Description: "Can be a directory, go file, or a wasm file.  Defaults to a ping/pong wasm file",
				Required:    false,
			},
			{
				Name:        "call",
				Alias:       "c",
				Description: "",
				Required:    false,
			},
		},
	},
	"buildLocalProject": {
		Description: "pushes specific repos",
		ImportRef:   "monkey/fixtures/compile",
		Internal:    true,
		Variables: []FixtureVariable{
			{
				Name:        "config",
				Description: "Do build config",
				Required:    true,
			},
			{
				Name:        "code",
				Description: "Do build code",
				Required:    true,
			},
			{
				Name:        "path",
				Alias:       "p",
				Description: "path/to/taubyte/project",
				Required:    true,
			},
			{
				Name:        "branch",
				Alias:       "b",
				Description: fmt.Sprintf("Defaults to %v", commonSpec.DefaultBranches),
				Required:    false,
			},
		},
	},
}

TODO: This should be generated

View Source
var Registry *handlerRegistry

Functions

func RegisterFixture

func RegisterFixture(name string, handler FixtureHandler)

Register a fixture

func ValidFixtures

func ValidFixtures() []string

func Zeno

func Zeno()

kill them all ref: https://dragonball.fandom.com/wiki/Zeno

Types

type ClientCreationMethod

type ClientCreationMethod func(*commonIface.ClientConfig) error

type Config

type Config struct {
	Services map[string]commonIface.ServiceConfig
	Simples  map[string]SimpleConfig
}

type FixtureDefinition

type FixtureDefinition struct {
	Description string
	ImportRef   string
	Variables   []FixtureVariable
	BlockCLI    bool
	Internal    bool
}

type FixtureHandler

type FixtureHandler func(universe *Universe, params ...interface{}) error

Order of params important!

type FixtureVariable

type FixtureVariable struct {
	Name        string
	Alias       string
	Description string
	Required    bool
}

type Multiverse

type Multiverse struct{}

func MultiVerse

func MultiVerse() *Multiverse

func (*Multiverse) Context

func (m *Multiverse) Context() context.Context

func (*Multiverse) Status

func (m *Multiverse) Status() interface{}

func (*Multiverse) Universe

func (m *Multiverse) Universe(name string) *Universe

func (*Multiverse) Universes

func (m *Multiverse) Universes() interface{}

type NodeInfo

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

type Simple

type Simple struct {
	peer.Node
	// contains filtered or unexported fields
}

func (*Simple) Auth

func (s *Simple) Auth() (authIface.Client, error)

func (*Simple) Hoarder

func (s *Simple) Hoarder() (hoarderIface.Client, error)

func (*Simple) Monkey

func (s *Simple) Monkey() (monkeyIface.Client, error)

func (*Simple) Patrick

func (s *Simple) Patrick() (patrickIface.Client, error)

func (*Simple) PeerNode

func (s *Simple) PeerNode() peer.Node

func (*Simple) Provides

func (s *Simple) Provides(clients ...string) error

func (*Simple) Seer

func (s *Simple) Seer() (seerIface.Client, error)

func (*Simple) TNS

func (s *Simple) TNS() (tnsIface.Client, error)

type SimpleConfig

type SimpleConfig struct {
	commonIface.CommonConfig
	Clients map[string]*commonIface.ClientConfig
}

type SimpleConfigClients

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

Deprecated use Map[string]*commonIface.ClientConfig{}

func (SimpleConfigClients) Compat

type Universe

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

func GetUniverse

func GetUniverse(name string) (*Universe, error)

func New

func New(config UniverseConfig) *Universe

create or fetch a universe

func (*Universe) All

func (u *Universe) All() []peer.Node

func (*Universe) Auth

func (u *Universe) Auth() auth.Service

func (*Universe) AuthByPid

func (u *Universe) AuthByPid(pid string) (auth.Service, bool)

func (*Universe) Cleanup

func (u *Universe) Cleanup()

func (*Universe) Context

func (u *Universe) Context() context.Context

func (*Universe) CreateSimpleNode

func (u *Universe) CreateSimpleNode(name string, config *SimpleConfig) (peer.Node, error)

func (*Universe) Gateway

func (u *Universe) Gateway() gateway.Service

func (*Universe) GetInfo

func (u *Universe) GetInfo(node peer.Node) (*NodeInfo, error)

func (*Universe) GetPortHttp

func (u *Universe) GetPortHttp(node peer.Node) (int, error)

func (*Universe) GetServicePids

func (u *Universe) GetServicePids(name string) ([]string, error)

func (*Universe) GetURLHttp

func (u *Universe) GetURLHttp(node peer.Node) (string, error)

func (*Universe) GetURLHttps

func (u *Universe) GetURLHttps(node peer.Node) (string, error)

func (*Universe) Hoarder

func (u *Universe) Hoarder() hoarder.Service

func (*Universe) HoarderByPid

func (u *Universe) HoarderByPid(pid string) (hoarder.Service, bool)

func (*Universe) Id

func (u *Universe) Id() string

func (*Universe) Kill

func (u *Universe) Kill(name string) error

func (*Universe) KillNodeByNameID

func (u *Universe) KillNodeByNameID(name, id string) error

func (*Universe) ListNumber

func (u *Universe) ListNumber(name string) int

func (*Universe) Lookup

func (u *Universe) Lookup(id string) (*NodeInfo, bool)

func (*Universe) Mesh

func (u *Universe) Mesh(newNodes ...peer.Node)

func (*Universe) Monkey

func (u *Universe) Monkey() monkey.Service

func (*Universe) MonkeyByPid

func (u *Universe) MonkeyByPid(pid string) (monkey.Service, bool)

func (*Universe) Name

func (u *Universe) Name() string

func (*Universe) Patrick

func (u *Universe) Patrick() patrick.Service

func (*Universe) PatrickByPid

func (u *Universe) PatrickByPid(pid string) (patrick.Service, bool)

func (*Universe) PortFor

func (u *Universe) PortFor(proto, _type string) (int, error)

func (*Universe) Provides

func (u *Universe) Provides(services ...string) error

func (*Universe) Register

func (u *Universe) Register(node peer.Node, name string, ports map[string]int)

func (*Universe) Root

func (u *Universe) Root() string

func (*Universe) RunFixture

func (u *Universe) RunFixture(name string, params ...interface{}) error

func (*Universe) Seer

func (u *Universe) Seer() seer.Service

func (*Universe) SeerByPid

func (u *Universe) SeerByPid(pid string) (seer.Service, bool)

func (*Universe) Service

func (u *Universe) Service(name string, config *commonIface.ServiceConfig) error

func (*Universe) Simple

func (u *Universe) Simple(name string) (*Simple, error)

func (*Universe) StartAll

func (u *Universe) StartAll(simples ...string) error

func (*Universe) StartWithConfig

func (u *Universe) StartWithConfig(mainConfig *Config) error

Start universe based on config

func (*Universe) Stop

func (u *Universe) Stop()

compatibility

func (*Universe) Substrate

func (u *Universe) Substrate() substrate.Service

func (*Universe) SubstrateByPid

func (u *Universe) SubstrateByPid(pid string) (substrate.Service, bool)

func (*Universe) SwarmKey

func (u *Universe) SwarmKey() []byte

func (*Universe) TNS

func (u *Universe) TNS() tns.Service

func (*Universe) TnsByPid

func (u *Universe) TnsByPid(pid string) (tns.Service, bool)

type UniverseConfig

type UniverseConfig struct {
	Name     string
	Id       string
	KeepRoot bool
}

Directories

Path Synopsis
git

Jump to

Keyboard shortcuts

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