port

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 7 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 (
	// ErrResourceNotExist is an error that indicates that the resource does not exist.
	ErrResourceNotExist = errors.New("resource does not exist")
	// ErrMultipleResourceExist is an error that indicates that multiple resources exist.
	ErrMultipleResourceExist = errors.New("multiple resources exist")
)

Functions

This section is empty.

Types

type AgentGroupPersistencePort added in v0.1.18

type AgentGroupPersistencePort interface {
	// GetAgentGroup retrieves an agent group by its ID.
	GetAgentGroup(ctx context.Context, name string) (*agentgroup.AgentGroup, error)
	// PutAgentGroup saves the agent group.
	PutAgentGroup(ctx context.Context, name string, agentGroup *agentgroup.AgentGroup) error
	// ListAgentGroups retrieves a list of agent groups with pagination options.
	ListAgentGroups(ctx context.Context, options *model.ListOptions) (*model.ListResponse[*agentgroup.AgentGroup], error)
}

AgentGroupPersistencePort is an interface that defines the methods for agent group persistence.

type AgentGroupRelatedUsecase added in v0.1.18

type AgentGroupRelatedUsecase interface {
	// ListAgentsByAgentGroup lists agents belonging to a specific agent group.
	ListAgentsByAgentGroup(
		ctx context.Context,
		agentGroup *agentgroup.AgentGroup,
		options *model.ListOptions,
	) (*model.ListResponse[*model.Agent], error)
}

AgentGroupRelatedUsecase is an interface that defines methods related to agent groups.

type AgentGroupUsecase added in v0.1.18

type AgentGroupUsecase interface {
	// GetAgentGroup retrieves an agent group by its name
	GetAgentGroup(ctx context.Context, name string) (*agentgroup.AgentGroup, error)
	// SaveAgentGroup saves the agent group.
	ListAgentGroups(ctx context.Context, options *model.ListOptions) (*model.ListResponse[*agentgroup.AgentGroup], error)
	// SaveAgentGroup saves the agent group.
	SaveAgentGroup(ctx context.Context, name string, agentGroup *agentgroup.AgentGroup) error
	// DeleteAgentGroup deletes the agent group by its ID.
	DeleteAgentGroup(ctx context.Context, name string, deletedAt time.Time, deletedBy string) error
}

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

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
	// ListAgents retrieves a list of agents with pagination options.
	ListAgents(ctx context.Context, options *model.ListOptions) (*model.ListResponse[*model.Agent], error)
}

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

type AgentUsecase

type AgentUsecase 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)
	// SaveAgent saves the agent.
	SaveAgent(ctx context.Context, agent *model.Agent) error
	// ListAgents lists all agents.
	ListAgents(ctx context.Context, options *model.ListOptions) (*model.ListResponse[*model.Agent], error)
	UpdateAgentConfigUsecase
}

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 {
	// 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
	// ListCommands lists all commands.
	ListCommands(ctx context.Context, options *model.ListOptions) (*model.ListResponse[*model.Command], error)
}

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, options *model.ListOptions) (*model.ListResponse[*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 Index added in v0.1.18

type Index map[string]sets.String

Index maps the indexed value to a set of keys in the store that match on that value.

type IndexFunc added in v0.1.18

type IndexFunc[T any] func(obj T) ([]string, error)

IndexFunc defines a function that extracts indexed values from an object of type T.

type Indexer added in v0.1.18

type Indexer[T any] interface {
	Store[T]
	Index(indexName string, obj T) ([]any, error)
	IndexKeys(indexName, indexedValue string) ([]string, error)
	ListIndexFuncValues(indexName string) []string
	ByIndex(indexName, indexedValue string) ([]T, error)
	GetIndexers() Indexers[T]
	AddIndexers(newIndexers Indexers[T]) error
}

Indexer defines methods for indexing and retrieving objects of type T.

type Indexers added in v0.1.18

type Indexers[T any] map[string]IndexFunc[T]

Indexers maps a name to an IndexFunc.

type Indices added in v0.1.18

type Indices map[string]Index

Indices maps a name to an Index.

type Store added in v0.1.18

type Store[T any] interface {
	Add(obj T) error
	Update(obj T) error
	Delete(obj T) error
	List() []T
	ListKeys() []string
	Get(partialObj T) (obj *T, exists bool, err error)
	GetByKey(key string) (item *T, exists bool, err error)
	Replace(list []T, resourceVersion string) error
}

Store defines the basic operations for a storage system.

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