node

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2019 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package node is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcurrentExecutor

type ConcurrentExecutor interface {
	// Run runs the provide ServiceNodeFn concurrently
	Run() error
}

ConcurrentExecutor executes functions on a collection of service nodes concurrently

func NewConcurrentExecutor

func NewConcurrentExecutor(
	nodes []ServiceNode,
	concurrency int,
	timeout time.Duration,
	fn ServiceNodeFn,
) ConcurrentExecutor

NewConcurrentExecutor returns a new concurrent executor

type Configuration

type Configuration struct {
	OperationTimeout   *time.Duration          `yaml:"operationTimeout"`
	TransferBufferSize *int                    `yaml:"transferBufferSize"`
	Retry              *xretry.Configuration   `yaml:"retry"`
	Heartbeat          *HeartbeatConfiguration `yaml:"heartbeat"`
}

Configuration is a YAML wrapper around Options

func (*Configuration) Options

func (c *Configuration) Options(iopts instrument.Options) Options

Options returns `Options` corresponding to the provided struct values

type HeartbeatConfiguration

type HeartbeatConfiguration struct {
	Enabled       *bool          `yaml:"enabled"`
	Timeout       *time.Duration `yaml:"timeout"`
	Interval      *time.Duration `yaml:"interval"`
	CheckInterval *time.Duration `yaml:"checkInterval"`
}

HeartbeatConfiguration is a YAML compatible wrapper around HeartbeatOptions

func (*HeartbeatConfiguration) Options

Options returns HeartbeatOptions corresponding to the values in the HeartbeatConfiguration

type HeartbeatOptions

type HeartbeatOptions interface {
	// Validate validates the HeartbeatOptions
	Validate() error

	// SetEnabled sets whether the Heartbeating is enabled
	SetEnabled(bool) HeartbeatOptions

	// Enabled returns whether the Heartbeating is enabled
	Enabled() bool

	// SetNowFn sets the NowFn
	SetNowFn(xclock.NowFn) HeartbeatOptions

	// NowFn returns the NowFn
	NowFn() xclock.NowFn

	// SetInterval sets the heartbeating interval
	SetInterval(time.Duration) HeartbeatOptions

	// Interval returns the heartbeating interval
	Interval() time.Duration

	// SetCheckInterval sets the frequency with which heartbeating timeouts
	// are checked
	SetCheckInterval(time.Duration) HeartbeatOptions

	// CheckInterval returns the frequency with which heartbeating timeouts
	// are checked
	CheckInterval() time.Duration

	// SetTimeout sets the heartbeat timeout duration, i.e. the window of
	// time after which missing heartbeats are considered errorneous
	SetTimeout(time.Duration) HeartbeatOptions

	// Timeout returns the heartbeat timeout duration, i.e. the window of
	// time after which missing heartbeats are considered errorneous
	Timeout() time.Duration

	// SetHeartbeatRouter sets the heartbeat router to be used
	SetHeartbeatRouter(HeartbeatRouter) HeartbeatOptions

	// HeartbeatRouter returns the heartbeat router in use
	HeartbeatRouter() HeartbeatRouter
}

HeartbeatOptions are the knobs to control heartbeating behavior

func NewHeartbeatOptions

func NewHeartbeatOptions() HeartbeatOptions

NewHeartbeatOptions returns the default HeartbeatOptions

type HeartbeatRouter

type HeartbeatRouter interface {
	hb.HeartbeaterServer

	// Endpoint returns the router endpoint
	Endpoint() string

	// Register registers the specified server under the given id
	Register(string, hb.HeartbeaterServer) error

	// Deregister un-registers any server registered under the given id
	Deregister(string) error
}

HeartbeatRouter routes heartbeats based on registered servers

func NewHeartbeatRouter

func NewHeartbeatRouter(endpoint string) HeartbeatRouter

NewHeartbeatRouter returns a new heartbeat router

type Listener

type Listener interface {
	// OnProcessTerminate is invoked when the remote process being run terminates
	OnProcessTerminate(node ServiceNode, desc string)

	// OnHeartbeatTimeout is invoked upon remote heartbeats having timed-out
	OnHeartbeatTimeout(node ServiceNode, lastHeartbeatTs time.Time)

	// OnOverwrite is invoked if remote agent control is overwritten by another
	// coordinator
	OnOverwrite(node ServiceNode, desc string)
}

Listener provides callbacks invoked upon remote process state transitions

func NewListener

func NewListener(
	onProcessTerminate func(ServiceNode, string),
	onHeartbeatTimeout func(ServiceNode, time.Time),
	onOverwrite func(ServiceNode, string),
) Listener

NewListener creates a new listener

type ListenerID

type ListenerID int

ListenerID is a unique identifier for a registered listener

type MockOptions

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

MockOptions is a mock of Options interface

func NewMockOptions

func NewMockOptions(ctrl *gomock.Controller) *MockOptions

NewMockOptions creates a new mock instance

func (*MockOptions) EXPECT

func (m *MockOptions) EXPECT() *MockOptionsMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockOptions) HeartbeatOptions

func (m *MockOptions) HeartbeatOptions() HeartbeatOptions

HeartbeatOptions mocks base method

func (*MockOptions) InstrumentOptions

func (m *MockOptions) InstrumentOptions() instrument.Options

InstrumentOptions mocks base method

func (*MockOptions) MaxPullSize

func (m *MockOptions) MaxPullSize() int64

MaxPullSize mocks base method

func (*MockOptions) OperationTimeout

func (m *MockOptions) OperationTimeout() time.Duration

OperationTimeout mocks base method

func (*MockOptions) OperatorClientFn

func (m *MockOptions) OperatorClientFn() OperatorClientFn

OperatorClientFn mocks base method

func (*MockOptions) Retrier

func (m *MockOptions) Retrier() retry.Retrier

Retrier mocks base method

func (*MockOptions) SetHeartbeatOptions

func (m *MockOptions) SetHeartbeatOptions(arg0 HeartbeatOptions) Options

SetHeartbeatOptions mocks base method

func (*MockOptions) SetInstrumentOptions

func (m *MockOptions) SetInstrumentOptions(arg0 instrument.Options) Options

SetInstrumentOptions mocks base method

func (*MockOptions) SetMaxPullSize

func (m *MockOptions) SetMaxPullSize(arg0 int64) Options

SetMaxPullSize mocks base method

func (*MockOptions) SetOperationTimeout

func (m *MockOptions) SetOperationTimeout(arg0 time.Duration) Options

SetOperationTimeout mocks base method

func (*MockOptions) SetOperatorClientFn

func (m *MockOptions) SetOperatorClientFn(arg0 OperatorClientFn) Options

SetOperatorClientFn mocks base method

func (*MockOptions) SetRetrier

func (m *MockOptions) SetRetrier(arg0 retry.Retrier) Options

SetRetrier mocks base method

func (*MockOptions) SetTransferBufferSize

func (m *MockOptions) SetTransferBufferSize(arg0 int) Options

SetTransferBufferSize mocks base method

func (*MockOptions) TransferBufferSize

func (m *MockOptions) TransferBufferSize() int

TransferBufferSize mocks base method

func (*MockOptions) Validate

func (m *MockOptions) Validate() error

Validate mocks base method

type MockOptionsMockRecorder

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

MockOptionsMockRecorder is the mock recorder for MockOptions

func (*MockOptionsMockRecorder) HeartbeatOptions

func (mr *MockOptionsMockRecorder) HeartbeatOptions() *gomock.Call

HeartbeatOptions indicates an expected call of HeartbeatOptions

func (*MockOptionsMockRecorder) InstrumentOptions

func (mr *MockOptionsMockRecorder) InstrumentOptions() *gomock.Call

InstrumentOptions indicates an expected call of InstrumentOptions

func (*MockOptionsMockRecorder) MaxPullSize

func (mr *MockOptionsMockRecorder) MaxPullSize() *gomock.Call

MaxPullSize indicates an expected call of MaxPullSize

func (*MockOptionsMockRecorder) OperationTimeout

func (mr *MockOptionsMockRecorder) OperationTimeout() *gomock.Call

OperationTimeout indicates an expected call of OperationTimeout

func (*MockOptionsMockRecorder) OperatorClientFn

func (mr *MockOptionsMockRecorder) OperatorClientFn() *gomock.Call

OperatorClientFn indicates an expected call of OperatorClientFn

func (*MockOptionsMockRecorder) Retrier

func (mr *MockOptionsMockRecorder) Retrier() *gomock.Call

Retrier indicates an expected call of Retrier

func (*MockOptionsMockRecorder) SetHeartbeatOptions

func (mr *MockOptionsMockRecorder) SetHeartbeatOptions(arg0 interface{}) *gomock.Call

SetHeartbeatOptions indicates an expected call of SetHeartbeatOptions

func (*MockOptionsMockRecorder) SetInstrumentOptions

func (mr *MockOptionsMockRecorder) SetInstrumentOptions(arg0 interface{}) *gomock.Call

SetInstrumentOptions indicates an expected call of SetInstrumentOptions

func (*MockOptionsMockRecorder) SetMaxPullSize

func (mr *MockOptionsMockRecorder) SetMaxPullSize(arg0 interface{}) *gomock.Call

SetMaxPullSize indicates an expected call of SetMaxPullSize

func (*MockOptionsMockRecorder) SetOperationTimeout

func (mr *MockOptionsMockRecorder) SetOperationTimeout(arg0 interface{}) *gomock.Call

SetOperationTimeout indicates an expected call of SetOperationTimeout

func (*MockOptionsMockRecorder) SetOperatorClientFn

func (mr *MockOptionsMockRecorder) SetOperatorClientFn(arg0 interface{}) *gomock.Call

SetOperatorClientFn indicates an expected call of SetOperatorClientFn

func (*MockOptionsMockRecorder) SetRetrier

func (mr *MockOptionsMockRecorder) SetRetrier(arg0 interface{}) *gomock.Call

SetRetrier indicates an expected call of SetRetrier

func (*MockOptionsMockRecorder) SetTransferBufferSize

func (mr *MockOptionsMockRecorder) SetTransferBufferSize(arg0 interface{}) *gomock.Call

SetTransferBufferSize indicates an expected call of SetTransferBufferSize

func (*MockOptionsMockRecorder) TransferBufferSize

func (mr *MockOptionsMockRecorder) TransferBufferSize() *gomock.Call

TransferBufferSize indicates an expected call of TransferBufferSize

func (*MockOptionsMockRecorder) Validate

func (mr *MockOptionsMockRecorder) Validate() *gomock.Call

Validate indicates an expected call of Validate

type MockServiceNode

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

MockServiceNode is a mock of ServiceNode interface

func NewMockServiceNode

func NewMockServiceNode(ctrl *gomock.Controller) *MockServiceNode

NewMockServiceNode creates a new mock instance

func (*MockServiceNode) Clone

func (m *MockServiceNode) Clone() placement.Instance

Clone mocks base method

func (*MockServiceNode) Close

func (m *MockServiceNode) Close() error

Close mocks base method

func (*MockServiceNode) DeregisterListener

func (m *MockServiceNode) DeregisterListener(arg0 ListenerID)

DeregisterListener mocks base method

func (*MockServiceNode) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockServiceNode) Endpoint

func (m *MockServiceNode) Endpoint() string

Endpoint mocks base method

func (*MockServiceNode) GetRemoteOutput

func (m *MockServiceNode) GetRemoteOutput(arg0 RemoteOutputType, arg1 string) (bool, error)

GetRemoteOutput mocks base method

func (*MockServiceNode) Hostname

func (m *MockServiceNode) Hostname() string

Hostname mocks base method

func (*MockServiceNode) ID

func (m *MockServiceNode) ID() string

ID mocks base method

func (*MockServiceNode) IsAvailable

func (m *MockServiceNode) IsAvailable() bool

IsAvailable mocks base method

func (*MockServiceNode) IsInitializing

func (m *MockServiceNode) IsInitializing() bool

IsInitializing mocks base method

func (*MockServiceNode) IsLeaving

func (m *MockServiceNode) IsLeaving() bool

IsLeaving mocks base method

func (*MockServiceNode) IsolationGroup

func (m *MockServiceNode) IsolationGroup() string

IsolationGroup mocks base method

func (*MockServiceNode) Port

func (m *MockServiceNode) Port() uint32

Port mocks base method

func (*MockServiceNode) Proto

func (m *MockServiceNode) Proto() (*placementpb.Instance, error)

Proto mocks base method

func (*MockServiceNode) RegisterListener

func (m *MockServiceNode) RegisterListener(arg0 Listener) ListenerID

RegisterListener mocks base method

func (*MockServiceNode) SetEndpoint

func (m *MockServiceNode) SetEndpoint(arg0 string) placement.Instance

SetEndpoint mocks base method

func (*MockServiceNode) SetHostname

func (m *MockServiceNode) SetHostname(arg0 string) placement.Instance

SetHostname mocks base method

func (*MockServiceNode) SetID

func (m *MockServiceNode) SetID(arg0 string) placement.Instance

SetID mocks base method

func (*MockServiceNode) SetIsolationGroup

func (m *MockServiceNode) SetIsolationGroup(arg0 string) placement.Instance

SetIsolationGroup mocks base method

func (*MockServiceNode) SetPort

func (m *MockServiceNode) SetPort(arg0 uint32) placement.Instance

SetPort mocks base method

func (*MockServiceNode) SetShardSetID

func (m *MockServiceNode) SetShardSetID(arg0 uint32) placement.Instance

SetShardSetID mocks base method

func (*MockServiceNode) SetShards

func (m *MockServiceNode) SetShards(arg0 shard.Shards) placement.Instance

SetShards mocks base method

func (*MockServiceNode) SetWeight

func (m *MockServiceNode) SetWeight(arg0 uint32) placement.Instance

SetWeight mocks base method

func (*MockServiceNode) SetZone

func (m *MockServiceNode) SetZone(arg0 string) placement.Instance

SetZone mocks base method

func (*MockServiceNode) Setup

func (m *MockServiceNode) Setup(arg0 build.ServiceBuild, arg1 build.ServiceConfiguration, arg2 string, arg3 bool) error

Setup mocks base method

func (*MockServiceNode) ShardSetID

func (m *MockServiceNode) ShardSetID() uint32

ShardSetID mocks base method

func (*MockServiceNode) Shards

func (m *MockServiceNode) Shards() shard.Shards

Shards mocks base method

func (*MockServiceNode) Start

func (m *MockServiceNode) Start() error

Start mocks base method

func (*MockServiceNode) Status

func (m *MockServiceNode) Status() Status

Status mocks base method

func (*MockServiceNode) Stop

func (m *MockServiceNode) Stop() error

Stop mocks base method

func (*MockServiceNode) String

func (m *MockServiceNode) String() string

String mocks base method

func (*MockServiceNode) Teardown

func (m *MockServiceNode) Teardown() error

Teardown mocks base method

func (*MockServiceNode) TransferLocalFile

func (m *MockServiceNode) TransferLocalFile(arg0 string, arg1 []string, arg2 bool) error

TransferLocalFile mocks base method

func (*MockServiceNode) Weight

func (m *MockServiceNode) Weight() uint32

Weight mocks base method

func (*MockServiceNode) Zone

func (m *MockServiceNode) Zone() string

Zone mocks base method

type MockServiceNodeMockRecorder

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

MockServiceNodeMockRecorder is the mock recorder for MockServiceNode

func (*MockServiceNodeMockRecorder) Clone

Clone indicates an expected call of Clone

func (*MockServiceNodeMockRecorder) Close

Close indicates an expected call of Close

func (*MockServiceNodeMockRecorder) DeregisterListener

func (mr *MockServiceNodeMockRecorder) DeregisterListener(arg0 interface{}) *gomock.Call

DeregisterListener indicates an expected call of DeregisterListener

func (*MockServiceNodeMockRecorder) Endpoint

func (mr *MockServiceNodeMockRecorder) Endpoint() *gomock.Call

Endpoint indicates an expected call of Endpoint

func (*MockServiceNodeMockRecorder) GetRemoteOutput

func (mr *MockServiceNodeMockRecorder) GetRemoteOutput(arg0, arg1 interface{}) *gomock.Call

GetRemoteOutput indicates an expected call of GetRemoteOutput

func (*MockServiceNodeMockRecorder) Hostname

func (mr *MockServiceNodeMockRecorder) Hostname() *gomock.Call

Hostname indicates an expected call of Hostname

func (*MockServiceNodeMockRecorder) ID

ID indicates an expected call of ID

func (*MockServiceNodeMockRecorder) IsAvailable

func (mr *MockServiceNodeMockRecorder) IsAvailable() *gomock.Call

IsAvailable indicates an expected call of IsAvailable

func (*MockServiceNodeMockRecorder) IsInitializing

func (mr *MockServiceNodeMockRecorder) IsInitializing() *gomock.Call

IsInitializing indicates an expected call of IsInitializing

func (*MockServiceNodeMockRecorder) IsLeaving

func (mr *MockServiceNodeMockRecorder) IsLeaving() *gomock.Call

IsLeaving indicates an expected call of IsLeaving

func (*MockServiceNodeMockRecorder) IsolationGroup

func (mr *MockServiceNodeMockRecorder) IsolationGroup() *gomock.Call

IsolationGroup indicates an expected call of IsolationGroup

func (*MockServiceNodeMockRecorder) Port

Port indicates an expected call of Port

func (*MockServiceNodeMockRecorder) Proto

Proto indicates an expected call of Proto

func (*MockServiceNodeMockRecorder) RegisterListener

func (mr *MockServiceNodeMockRecorder) RegisterListener(arg0 interface{}) *gomock.Call

RegisterListener indicates an expected call of RegisterListener

func (*MockServiceNodeMockRecorder) SetEndpoint

func (mr *MockServiceNodeMockRecorder) SetEndpoint(arg0 interface{}) *gomock.Call

SetEndpoint indicates an expected call of SetEndpoint

func (*MockServiceNodeMockRecorder) SetHostname

func (mr *MockServiceNodeMockRecorder) SetHostname(arg0 interface{}) *gomock.Call

SetHostname indicates an expected call of SetHostname

func (*MockServiceNodeMockRecorder) SetID

func (mr *MockServiceNodeMockRecorder) SetID(arg0 interface{}) *gomock.Call

SetID indicates an expected call of SetID

func (*MockServiceNodeMockRecorder) SetIsolationGroup

func (mr *MockServiceNodeMockRecorder) SetIsolationGroup(arg0 interface{}) *gomock.Call

SetIsolationGroup indicates an expected call of SetIsolationGroup

func (*MockServiceNodeMockRecorder) SetPort

func (mr *MockServiceNodeMockRecorder) SetPort(arg0 interface{}) *gomock.Call

SetPort indicates an expected call of SetPort

func (*MockServiceNodeMockRecorder) SetShardSetID

func (mr *MockServiceNodeMockRecorder) SetShardSetID(arg0 interface{}) *gomock.Call

SetShardSetID indicates an expected call of SetShardSetID

func (*MockServiceNodeMockRecorder) SetShards

func (mr *MockServiceNodeMockRecorder) SetShards(arg0 interface{}) *gomock.Call

SetShards indicates an expected call of SetShards

func (*MockServiceNodeMockRecorder) SetWeight

func (mr *MockServiceNodeMockRecorder) SetWeight(arg0 interface{}) *gomock.Call

SetWeight indicates an expected call of SetWeight

func (*MockServiceNodeMockRecorder) SetZone

func (mr *MockServiceNodeMockRecorder) SetZone(arg0 interface{}) *gomock.Call

SetZone indicates an expected call of SetZone

func (*MockServiceNodeMockRecorder) Setup

func (mr *MockServiceNodeMockRecorder) Setup(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

Setup indicates an expected call of Setup

func (*MockServiceNodeMockRecorder) ShardSetID

func (mr *MockServiceNodeMockRecorder) ShardSetID() *gomock.Call

ShardSetID indicates an expected call of ShardSetID

func (*MockServiceNodeMockRecorder) Shards

func (mr *MockServiceNodeMockRecorder) Shards() *gomock.Call

Shards indicates an expected call of Shards

func (*MockServiceNodeMockRecorder) Start

Start indicates an expected call of Start

func (*MockServiceNodeMockRecorder) Status

func (mr *MockServiceNodeMockRecorder) Status() *gomock.Call

Status indicates an expected call of Status

func (*MockServiceNodeMockRecorder) Stop

Stop indicates an expected call of Stop

func (*MockServiceNodeMockRecorder) String

func (mr *MockServiceNodeMockRecorder) String() *gomock.Call

String indicates an expected call of String

func (*MockServiceNodeMockRecorder) Teardown

func (mr *MockServiceNodeMockRecorder) Teardown() *gomock.Call

Teardown indicates an expected call of Teardown

func (*MockServiceNodeMockRecorder) TransferLocalFile

func (mr *MockServiceNodeMockRecorder) TransferLocalFile(arg0, arg1, arg2 interface{}) *gomock.Call

TransferLocalFile indicates an expected call of TransferLocalFile

func (*MockServiceNodeMockRecorder) Weight

func (mr *MockServiceNodeMockRecorder) Weight() *gomock.Call

Weight indicates an expected call of Weight

func (*MockServiceNodeMockRecorder) Zone

Zone indicates an expected call of Zone

type OperatorClientFn

type OperatorClientFn func() (*grpc.ClientConn, m3em.OperatorClient, error)

OperatorClientFn returns a function able to construct connections to remote Operators

type Options

type Options interface {
	// Validate validates the NodeOptions
	Validate() error

	// SetInstrumentOptions sets the instrumentation options
	SetInstrumentOptions(instrument.Options) Options

	// InstrumentOptions returns the instrumentation options
	InstrumentOptions() instrument.Options

	// SetOperationTimeout returns the timeout for node operations
	SetOperationTimeout(time.Duration) Options

	// OperationTimeout returns the timeout for node operations
	OperationTimeout() time.Duration

	// SetRetrier sets the retrier for node operations
	SetRetrier(xretry.Retrier) Options

	// OperationRetrier returns the retrier for node operations
	Retrier() xretry.Retrier

	// SetTransferBufferSize sets the bytes buffer size used during file transfer
	SetTransferBufferSize(int) Options

	// TransferBufferSize returns the bytes buffer size used during file transfer
	TransferBufferSize() int

	// SetMaxPullSize sets the max bytes retrieved from remote agents when
	// fetching output files
	SetMaxPullSize(int64) Options

	// MaxPullSize returns the max bytes retrieved from remote agents when
	// fetching output files
	MaxPullSize() int64

	// SetHeartbeatOptions sets the HeartbeatOptions
	SetHeartbeatOptions(HeartbeatOptions) Options

	// HeartbeatOptions returns the HeartbeatOptions
	HeartbeatOptions() HeartbeatOptions

	// SetOperatorClientFn sets the OperatorClientFn
	SetOperatorClientFn(OperatorClientFn) Options

	// OperatorClientFn returns the OperatorClientFn
	OperatorClientFn() OperatorClientFn
}

Options are the various knobs to control Node behavior

func NewOptions

func NewOptions(
	opts instrument.Options,
) Options

NewOptions returns a new Options construct.

type RemoteOutputType

type RemoteOutputType int

RemoteOutputType describes the various outputs available on the remote agents

const (
	// RemoteProcessStdout refers to the remote process stdout
	RemoteProcessStdout RemoteOutputType = iota

	// RemoteProcessStderr refers to the remote process stderr
	RemoteProcessStderr
)

type ServiceNode

type ServiceNode interface {
	placement.Instance

	// Setup initializes the directories, config file, and binary for the process being tested.
	// It does not Start the process on the ServiceNode.
	Setup(
		build build.ServiceBuild,
		config build.ServiceConfiguration,
		token string,
		force bool,
	) error

	// Start starts the service process for this ServiceNode.
	Start() error

	// Stop stops the service process for this ServiceNode.
	Stop() error

	// Status returns the ServiceNode status.
	Status() Status

	// Teardown releases any remote resources used for testing.
	Teardown() error

	// Close releases any locally held resources
	Close() error

	// RegisterListener registers an event listener
	RegisterListener(Listener) ListenerID

	// DeregisterListener un-registers an event listener
	DeregisterListener(ListenerID)

	// TransferLocalFile transfers a local file to the specified destination paths
	// NB: destPaths are not allowed to use relative path specifiers, i.e. '..' is illegal;
	// the eventual destination path on remote hosts is relative to the working directory
	// of the remote agent.
	// e.g. if the remote agent has working directory /var/m3em-agent, and we make the call:
	// svcNode.TransferLocalFile("some/local/file/path/id", []string{"path/id", "another/path/id"})
	//
	// upon success, there will be two new files under the remote agent working directory:
	// /var/m3em-agent/
	// /var/m3em-agent/path/id          <-- same contents as "some/local/file/path/id"
	// /var/m3em-agent/another/path/id  <-- same contents as "some/local/file/path/id"
	TransferLocalFile(localSrc string, destPaths []string, overwrite bool) error

	// GetRemoteOutput transfers the specified remote file to the specified path
	GetRemoteOutput(t RemoteOutputType, localDest string) (truncated bool, err error)
}

ServiceNode represents an executable service node. This object controls both the service and resources on the host running the service (e.g. fs, processes, etc.)

func New

func New(
	node placement.Instance,
	opts Options,
) (ServiceNode, error)

New returns a new ServiceNode.

type ServiceNodeFn

type ServiceNodeFn func(ServiceNode) error

ServiceNodeFn performs an operation on a given ServiceNode

type ServiceNodes

type ServiceNodes []ServiceNode

ServiceNodes is a collection of ServiceNode(s)

type Status

type Status int

Status indicates the different states a ServiceNode can be in. The state diagram below describes the transitions between the various states:

                ┌──────────────────┐
                │                  │
┌Teardown()─────│      Error       │
│               │                  │
│               └──────────────────┘
│
▼

┌──────────────────┐ ┌───────────────-──┐ │ │ Setup() │ │ │ Uninitialized ├────────────────────────▶│ Setup │◀─┐ │ │◀───────────┐ │ │ │ └──────────────────┘ Teardown()└────────────└──────────────────┘ │

▲                                            │           │
│                                            │           │
│                                            │           │
│                                  Start()   │           │
│                              ┌─────────────┘           │
│                              │                         │
│                              │                         │
│                              │                         │
│                              ▼                         │
│                    ┌──────────────────┐                │
│Teardown()          │                  │                |
└────────────────────│     Running      │────────────Stop()
                     │                  │
                     └──────────────────┘
const (
	// StatusUninitialized refers to the state of an un-initialized node.
	StatusUninitialized Status = iota

	// StatusSetup is the state of a node which has been Setup()
	StatusSetup

	// StatusRunning is the state of a node which has been Start()-ed
	StatusRunning

	// StatusError is the state of a node which is in an Error state
	StatusError
)

Jump to

Keyboard shortcuts

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