mutagen

package
v0.0.0-...-b872246 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(spec *SessionSpec) error

func Flush

func Flush(names ...string) error

func ForwardCreate

func ForwardCreate(env map[string]string, local, remote string, labels map[string]string) error

ForwardCreate creates a new port forward using mutagen. local looks like tcp:127.0.0.1:<port> remote looks like <host>:<ssh-port>:tcp::<port> (ssh-port is usually 22)

func ForwardTerminate

func ForwardTerminate(env, labels map[string]string) error

func Install

func Install(url, installDir string) error

func InstallMutagenOnce

func InstallMutagenOnce(binPath string) error

func Pause

func Pause(names ...string) error

func Reset

func Reset(envVars map[string]string, names ...string) error

func Resume

func Resume(envVars map[string]string, names ...string) error

func SanitizeSessionName

func SanitizeSessionName(input string) string

SanitizeSessionName ensures the input string contains letter, number or dash runes. This matches the implementation in mutagen's codebase: https://github.com/mutagen-io/mutagen/blob/master/pkg/selection/names.go

TODO savil. Refactor SessionSpec so that this is always applied. We can make it a struct that uses a constructor, and make Sync a method on the struct.

func Terminate

func Terminate(env, labels map[string]string, names ...string) error

Types

type Endpoint

type Endpoint struct {
	User        string            `json:"user,omitempty"`
	Host        string            `json:"host,omitempty"`
	Port        uint16            `json:"port,omitempty"`
	Path        string            `json:"path"`
	Environment map[string]string `json:"environment,omitempty"`
	Parameters  map[string]string `json:"parameters,omitempty"`
	Connected   bool              `json:"connected"`
}

type Forward

type Forward struct {
	Source struct {
		Connected bool   `json:"connected"`
		Endpoint  string `json:"endpoint"`
	} `json:"source"`
	Destination struct {
		Endpoint string `json:"endpoint"`
	} `json:"destination"`
	LastError string `json:"lastError"`
}

func ForwardList

func ForwardList(env, labels map[string]string) ([]Forward, error)

type Session

type Session struct {
	Identifier      string            `json:"identifier"`
	Version         uint32            `json:"version"`
	CreationTime    string            `json:"creationTime"`
	CreatingVersion string            `json:"creatingVersion"`
	Alpha           Endpoint          `json:"alpha"`
	Beta            Endpoint          `json:"beta"`
	Name            string            `json:"name,omitempty"`
	Labels          map[string]string `json:"labels,omitempty"`
	Paused          bool              `json:"paused"`
	Status          string            `json:"status"`
}

func List

func List(envVars map[string]string, names ...string) ([]Session, error)

func Sync

func Sync(spec *SessionSpec) (*Session, error)

type SessionIgnore

type SessionIgnore struct {
	VCS   bool
	Paths []string
}

type SessionSpec

type SessionSpec struct {
	AlphaAddress string
	AlphaPath    string
	BetaAddress  string
	BetaPath     string
	Name         string
	Labels       map[string]string
	Paused       bool
	SyncMode     string
	Ignore       SessionIgnore
	EnvVars      map[string]string
}

func (*SessionSpec) Validate

func (s *SessionSpec) Validate() error

Jump to

Keyboard shortcuts

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