node

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 23 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	Manager = "node"
	// UpdateInterval is the safety net: nodes push every change of their
	// device list, so the master only asks them this often.
	UpdateInterval = 5 * time.Minute
)
View Source
const ConnectionTimeout = 10 * time.Second

Variables

View Source
var (
	ErrManagerNotFound = fmt.Errorf("manager not found")
	ErrDeviceNotFound  = fmt.Errorf("device not found")
)

Functions

func NewMemoryDeviceStore

func NewMemoryDeviceStore(cfg map[string]config.Manager) *deviceStore

Types

type Handler

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

func NewHandler

func NewHandler(log *logrus.Logger, ds storage.Device, nm manager.Nodes, db *gorm.DB) *Handler

func (*Handler) GetDevice

func (h *Handler) GetDevice(deviceID string) (error, manager.NodeIdentifier, device.Device)

func (*Handler) GetDevices

func (h *Handler) GetDevices() ([]device.Device, error)

func (*Handler) Handle

func (h *Handler) Handle(payload events.NodeConnectedPayload)

func (*Handler) HasDevice

func (h *Handler) HasDevice(device2 device.Device) bool

func (*Handler) Init

func (h *Handler) Init(masterUrl, nodeIdentifier string, authToken *string) error

func (*Handler) Name

func (h *Handler) Name() string

func (*Handler) RefreshDevices

func (h *Handler) RefreshDevices(force bool) error

RefreshDevices fetches the device lists of all nodes over RPC. Nodes push their changes (UpdateNodeDevices), so this runs when the master starts, when a node connects or drops, and every UpdateInterval as a safety net.

func (*Handler) RegisterDevice

func (h *Handler) RegisterDevice(data device.RegisterData) (device.Device, error)

func (*Handler) Run

func (h *Handler) Run(ctx context.Context, runSocketListener bool) error

func (*Handler) Start

func (h *Handler) Start() error

func (*Handler) StartDevice

func (h *Handler) StartDevice(deviceID string) error

func (*Handler) Stop

func (h *Handler) Stop() error

func (*Handler) StopDevice

func (h *Handler) StopDevice(deviceID string) error

func (*Handler) UpdateNodeDevices added in v1.1.0

func (h *Handler) UpdateNodeDevices(nodeIdentifier manager.NodeIdentifier, managers map[string][]device.Device, sentAt int64) error

UpdateNodeDevices applies a device list a node pushed. Pushes older than the last applied one (sentAt, node clock) are dropped, and so are pushes of a node that isn't connected: it is refreshed completely when it connects.

type NodeDevice

type NodeDevice struct {
	generic.Device
	// contains filtered or unexported fields
}

func (*NodeDevice) ClearAppData added in v1.1.0

func (d *NodeDevice) ClearAppData(params *app.Parameter) error

func (*NodeDevice) ConnectionTimeout

func (d *NodeDevice) ConnectionTimeout() time.Duration

func (*NodeDevice) DeviceID

func (d *NodeDevice) DeviceID() string

func (*NodeDevice) DeviceName

func (d *NodeDevice) DeviceName() string

func (*NodeDevice) DeviceOSName

func (d *NodeDevice) DeviceOSName() string

func (*NodeDevice) DeviceOSVersion

func (d *NodeDevice) DeviceOSVersion() string

func (*NodeDevice) DeviceParameter

func (d *NodeDevice) DeviceParameter() map[string]string

func (*NodeDevice) DeviceState

func (d *NodeDevice) DeviceState() device.State

func (*NodeDevice) DeviceType

func (d *NodeDevice) DeviceType() int

func (*NodeDevice) Execute

func (d *NodeDevice) Execute(data string)

func (*NodeDevice) GetNodeID

func (d *NodeDevice) GetNodeID() manager.NodeIdentifier

func (*NodeDevice) GetScreenshot

func (d *NodeDevice) GetScreenshot() ([]byte, int, int, error)

func (*NodeDevice) HasFeature

func (d *NodeDevice) HasFeature(feature string) bool

func (*NodeDevice) InputText added in v1.1.0

func (d *NodeDevice) InputText(text string) error

InputText implements device.InputCapable by forwarding to the node.

func (*NodeDevice) InstallApp

func (d *NodeDevice) InstallApp(params *app.Parameter) error

func (*NodeDevice) IsAppConnected

func (d *NodeDevice) IsAppConnected() bool

func (*NodeDevice) IsAppInstalled

func (d *NodeDevice) IsAppInstalled(params *app.Parameter) (bool, error)

func (*NodeDevice) NodeManager

func (d *NodeDevice) NodeManager() manager.Nodes

func (*NodeDevice) PlatformType

func (d *NodeDevice) PlatformType() int

func (*NodeDevice) PressKey added in v1.1.0

func (d *NodeDevice) PressKey(key string) error

PressKey implements device.InputCapable by forwarding to the node.

func (*NodeDevice) ReadLogs added in v1.1.0

func (d *NodeDevice) ReadLogs(lines int) ([]string, error)

ReadLogs implements device.LogReader by forwarding to the node.

func (*NodeDevice) RunNativeScript

func (d *NodeDevice) RunNativeScript(script []byte)

func (*NodeDevice) Send

func (d *NodeDevice) Send(script []byte) error

func (*NodeDevice) SetDeviceState

func (d *NodeDevice) SetDeviceState(state string)

func (*NodeDevice) StartApp

func (d *NodeDevice) StartApp(_ *device.DeviceConfig, appParams *app.Parameter, sessionId string, nodeUrl string) error

func (*NodeDevice) StartRecording

func (d *NodeDevice) StartRecording(path string) error

func (*NodeDevice) StartVideo added in v1.1.0

func (d *NodeDevice) StartVideo(ctx context.Context, opts device.VideoOptions) (device.VideoStream, error)

StartVideo implements device.VideoStreamer. The node starts the stream and dials back to the master, which pairs the socket through the rendezvous.

func (*NodeDevice) StopApp

func (d *NodeDevice) StopApp(params *app.Parameter) error

func (*NodeDevice) StopRecording

func (d *NodeDevice) StopRecording() error

func (*NodeDevice) Swipe added in v1.1.0

func (d *NodeDevice) Swipe(fromX, fromY, toX, toY int, duration time.Duration) error

Swipe implements device.InputCapable by forwarding to the node.

func (*NodeDevice) Tap added in v1.1.0

func (d *NodeDevice) Tap(x, y int) error

Tap implements device.InputCapable by forwarding to the node.

func (*NodeDevice) TargetVersion

func (d *NodeDevice) TargetVersion() string

func (*NodeDevice) UninstallApp

func (d *NodeDevice) UninstallApp(params *app.Parameter) error

func (*NodeDevice) UpdateDeviceInfos

func (d *NodeDevice) UpdateDeviceInfos(parameter map[string]string)

Jump to

Keyboard shortcuts

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