port

package
v0.1.2-debug-auth Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package port provides ports which is defined in the hexagonal architecture.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrConnectionAlreadyExists is an error that indicates that the connection already exists.
	ErrConnectionAlreadyExists = errors.New("connection already exists")
	// ErrConnectionNotFound is an error that indicates that the connection was not found.
	ErrConnectionNotFound = errors.New("connection not found")
)
View Source
var (
	// ErrAgentNotExist is an error that indicates that the agent does not exist.
	ErrAgentNotExist = errors.New("agent does not exist")
	// ErrMultipleAgentExist is an error that indicates that multiple agents exist.
	ErrMultipleAgentExist = errors.New("multiple agent exists")
)

Functions

This section is empty.

Types

type AgentPersistencePort

type AgentPersistencePort interface {
	// GetAgent retrieves an agent by its instance UID.
	GetAgent(ctx context.Context, instanceUID uuid.UUID) (*model.Agent, error)
	// GetAgentByID retrieves an agent by its ID.
	PutAgent(ctx context.Context, agent *model.Agent) error
	// GetAgentByID retrieves an agent by its ID.
	ListAgents(ctx context.Context) ([]*model.Agent, error)
}

AgentPersistencePort is an interface that defines the methods for agent persistence.

type AgentUsecase

AgentUsecase is an interface that defines the methods for agent use cases.

type CommandPersistencePort

type CommandPersistencePort interface {
	// GetCommand retrieves a command by its ID.
	GetCommand(ctx context.Context, commandID uuid.UUID) (*model.Command, error)
	// GetCommandByInstanceUID retrieves a command by its instance UID.
	GetCommandByInstanceUID(ctx context.Context, instanceUID uuid.UUID) (*model.Command, error)
	// SaveCommand saves the command.
	SaveCommand(ctx context.Context, command *model.Command) error
}

CommandPersistencePort is an interface that defines the methods for command persistence.

type CommandUsecase

type CommandUsecase interface {
	GetCommandUsecase
	ListCommandsUsecase
	SaveCommandUsecase
}

CommandUsecase is an interface that defines the methods for command use cases.

type ConnectionUsecase

type ConnectionUsecase interface {
	// GetConnectionByInstanceUID returns the connection for the given instance UID.
	GetConnectionByInstanceUID(ctx context.Context, instanceUID uuid.UUID) (*model.Connection, error)
	// GetConnectionByID returns the connection for the given ID.
	GetConnectionByID(ctx context.Context, id any) (*model.Connection, error)
	// ListConnections returns the list of connections.
	ListConnections(ctx context.Context) ([]*model.Connection, error)
	// SaveConnection saves the connection.
	SaveConnection(ctx context.Context, connection *model.Connection) error
	// DeleteConnection deletes the connection.
	DeleteConnection(ctx context.Context, connection *model.Connection) error
}

ConnectionUsecase is an interface that defines the methods for connection use cases.

type GetAgentUsecase

type GetAgentUsecase interface {
	// GetAgent retrieves an agent by its instance UID.
	GetAgent(ctx context.Context, instanceUID uuid.UUID) (*model.Agent, error)
	// GetOrCreateAgent retrieves an agent by its instance UID or creates a new one if it does not exist.
	GetOrCreateAgent(ctx context.Context, instanceUID uuid.UUID) (*model.Agent, error)
}

GetAgentUsecase is an interface that defines the methods for getting agents.

type GetCommandUsecase

type GetCommandUsecase interface {
	// GetCommand retrieves a command by its ID.
	GetCommand(ctx context.Context, commandID uuid.UUID) (*model.Command, error)
	// GetCommandByInstanceUID retrieves a command by its instance UID.
	GetCommandByInstanceUID(ctx context.Context, instanceUID uuid.UUID) ([]*model.Command, error)
}

GetCommandUsecase is an interface that defines the methods for getting commands.

type ListAgentUsecase

type ListAgentUsecase interface {
	// ListAgents lists all agents.
	ListAgents(ctx context.Context) ([]*model.Agent, error)
}

ListAgentUsecase is an interface that defines the methods for listing agents.

type ListCommandsUsecase added in v0.0.2

type ListCommandsUsecase interface {
	// ListCommands lists all commands.
	ListCommands(ctx context.Context) ([]*model.Command, error)
}

ListCommandsUsecase is an interface that defines the methods for listing commands.

type SaveAgentUsecase

type SaveAgentUsecase interface {
	// SaveAgent saves the agent.
	SaveAgent(ctx context.Context, agent *model.Agent) error
}

SaveAgentUsecase is an interface that defines the methods for saving agents.

type SaveCommandUsecase

type SaveCommandUsecase interface {
	// SaveCommand saves the command.
	SaveCommand(ctx context.Context, command *model.Command) error
}

SaveCommandUsecase is an interface that defines the methods for saving commands.

type UpdateAgentConfigUsecase added in v0.0.2

type UpdateAgentConfigUsecase interface {
	// UpdateAgentConfig updates the agent configuration.
	UpdateAgentConfig(ctx context.Context, instanceUID uuid.UUID, config any) error
}

UpdateAgentConfigUsecase is an interface that defines the methods for updating agent configurations.

Jump to

Keyboard shortcuts

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