slave

package
v0.1.25 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package slave provides the slave node of the bloader.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrRequestNotFound is returned when the request is not found
	ErrRequestNotFound = fmt.Errorf("request not found")
	// ErrInvalidConnectionID represents an error when the connection ID is invalid
	ErrInvalidConnectionID = fmt.Errorf("invalid connection ID")
	// ErrInvalidEnvironment represents an error when the environment is invalid
	ErrInvalidEnvironment = fmt.Errorf("must connect to the same environment")
	// ErrInvalidCommandID represents an error when the command ID is invalid
	ErrInvalidCommandID = fmt.Errorf("invalid command ID")
	// ErrLoaderNotFound represents an error when the loader is not found
	ErrLoaderNotFound = fmt.Errorf("loader not found")
	// ErrFailedToSendLoaderResourceRequest represents an error when the loader resource request is failed to send
	ErrFailedToSendLoaderResourceRequest = fmt.Errorf("failed to send loader resource request")
	// ErrCommandNotFound represents an error when the command is not found
	ErrCommandNotFound = fmt.Errorf("command not found")
)

Functions

func Run

func Run(ctr *container.Container) error

Run runs the slave node

func StreamServerInterceptor

func StreamServerInterceptor(encrypter encrypt.Encrypter) grpc.StreamServerInterceptor

StreamServerInterceptor is a server-side interceptor that encrypts the request and decrypts the response.

func UnaryServerEncryptInterceptor

func UnaryServerEncryptInterceptor(encrypter encrypt.Encrypter) grpc.UnaryServerInterceptor

UnaryServerEncryptInterceptor is a server-side interceptor that encrypts the request and decrypts the response.

Types

type AuthenticatorFactor

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

AuthenticatorFactor represents the slave authenticator factor

func (*AuthenticatorFactor) Factorize

func (s *AuthenticatorFactor) Factorize(
	ctx context.Context,
	authID string,
	isDefault bool,
) (auth.SetAuthor, error)

Factorize returns the factorized authenticator

func (*AuthenticatorFactor) IsDefault

func (s *AuthenticatorFactor) IsDefault(authID string) bool

IsDefault returns if the authenticator is the default authenticator

type Output

type Output struct {
	// OutputID represents the output ID
	OutputID string
	// contains filtered or unexported fields
}

Output represents the slave output service

func NewSlaveOutput

func NewSlaveOutput(outputID string, outputChan chan<- *pb.CallExecResponse) Output

NewSlaveOutput creates a new SlaveOutput

func (Output) HTTPDataWriteFactory

func (o Output) HTTPDataWriteFactory(
	ctx context.Context,
	_ logger.Logger,
	enabled bool,
	uniqueName string,
	header []string,
) (output.HTTPDataWrite, output.Close, error)

HTTPDataWriteFactory returns the HTTPDataWrite function

type OutputFactor

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

OutputFactor represents the factory

func (*OutputFactor) Factorize

func (f *OutputFactor) Factorize(_ context.Context, outputID string) (output.Output, error)

Factorize returns the factorized output

type Server

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

Server represents the server for the worker node

func NewServer

func NewServer(ctr *container.Container, slaveConCtr *runner.ConnectionContainer) *Server

NewServer creates a new server for the worker node

func (*Server) CallExec

CallExec handles the exec request from the master node

func (*Server) Connect

func (s *Server) Connect(_ context.Context, req *pb.ConnectRequest) (*pb.ConnectResponse, error)

Connect handles the connection request from the master node

func (*Server) Disconnect

func (s *Server) Disconnect(_ context.Context, req *pb.DisconnectRequest) (*pb.DisconnectResponse, error)

Disconnect handles the disconnection request from the master node

func (*Server) ReceiveChanelConnect

ReceiveChanelConnect handles the channel connection request from the master node

func (*Server) ReceiveLoadTermChannel

func (s *Server) ReceiveLoadTermChannel(
	ctx context.Context,
	req *pb.ReceiveLoadTermChannelRequest,
) (*pb.ReceiveLoadTermChannelResponse, error)

ReceiveLoadTermChannel handles the load term channel request from the master node

func (*Server) SendAuth

func (s *Server) SendAuth(_ context.Context, req *pb.SendAuthRequest) (*pb.SendAuthResponse, error)

SendAuth handles the auth request from the master node

func (*Server) SendLoader

SendLoader handles the loader request from the master node

func (*Server) SendStoreData

SendStoreData handles the store data request from the master node

func (*Server) SendStoreOk

func (s *Server) SendStoreOk(_ context.Context, req *pb.SendStoreOkRequest) (*pb.SendStoreOkResponse, error)

SendStoreOk handles the store ok request from the master node

func (*Server) SendTarget

func (s *Server) SendTarget(_ context.Context, req *pb.SendTargetRequest) (*pb.SendTargetResponse, error)

SendTarget handles the target request from the master node

func (*Server) SlaveCommand

func (s *Server) SlaveCommand(ctx context.Context, req *pb.SlaveCommandRequest) (*pb.SlaveCommandResponse, error)

SlaveCommand handles the command request from the master node

func (*Server) SlaveCommandDefaultStore

SlaveCommandDefaultStore handles the command default store request from the master node

type Store

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

Store represents the store for the slave node

func (*Store) Import

Import loads the data

func (*Store) Store

Store stores the data

func (*Store) StoreWithExtractor

func (s *Store) StoreWithExtractor(
	ctx context.Context,
	res any,
	data []runner.ValidExecRequestStoreData,
	cb runner.StoreWithExtractorCallback,
) error

StoreWithExtractor stores the data with extractor

type TargetFactor

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

TargetFactor represents the factory for the slave target

func (*TargetFactor) Factorize

func (s *TargetFactor) Factorize(ctx context.Context, targetID string) (target.Target, error)

Factorize returns the factorized target

type TmplFactor

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

TmplFactor represents the slave template factor

func (*TmplFactor) TmplFactorize

func (s *TmplFactor) TmplFactorize(ctx context.Context, path string) (string, error)

TmplFactorize is a function that factorizes the template

Directories

Path Synopsis
Package slcontainer provides the container for the slave node
Package slcontainer provides the container for the slave node

Jump to

Keyboard shortcuts

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