mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-12 08:45:38 +02:00
⭐ feat(maitred): Update maitred - hookup to the API (#198)
## Description We are attempting to hookup maitred to the API Maitred duties will be: - [ ] Hookup to the API - [ ] Wait for signal (from the API) to start Steam - [ ] Stop signal to stop the gaming session, clean up Steam... and maybe do the backup ## Summary by CodeRabbit - **New Features** - Introduced Docker-based deployment configurations for both the main and relay applications. - Added new API endpoints enabling real-time machine messaging and enhanced IoT operations. - Expanded database schema and actor types to support improved machine tracking. - **Improvements** - Enhanced real-time communication and relay management with streamlined room handling. - Upgraded dependencies, logging, and error handling for greater stability and performance. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: DatCaptainHorse <DatCaptainHorse@users.noreply.github.com> Co-authored-by: Kristian Ollikainen <14197772+DatCaptainHorse@users.noreply.github.com>
This commit is contained in:
38
packages/maitred/internal/containers/containers.go
Normal file
38
packages/maitred/internal/containers/containers.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package containers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Container represents a container instance
|
||||
type Container struct {
|
||||
ID string
|
||||
Name string
|
||||
State string
|
||||
Image string
|
||||
}
|
||||
|
||||
// ContainerEngine defines the common interface for differing container engines
|
||||
type ContainerEngine interface {
|
||||
Close() error
|
||||
ListContainers(ctx context.Context) ([]Container, error)
|
||||
ListContainersByImage(ctx context.Context, img string) ([]Container, error)
|
||||
NewContainer(ctx context.Context, img string, envs []string) (string, error)
|
||||
StartContainer(ctx context.Context, id string) error
|
||||
StopContainer(ctx context.Context, id string) error
|
||||
RemoveContainer(ctx context.Context, id string) error
|
||||
InspectContainer(ctx context.Context, id string) (*Container, error)
|
||||
PullImage(ctx context.Context, img string) error
|
||||
Info(ctx context.Context) (string, error)
|
||||
LogsContainer(ctx context.Context, id string) (string, error)
|
||||
}
|
||||
|
||||
func NewContainerEngine() (ContainerEngine, error) {
|
||||
dockerEngine, err := NewDockerEngine()
|
||||
if err == nil {
|
||||
return dockerEngine, nil
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("failed to create container engine: %w", err)
|
||||
}
|
||||
Reference in New Issue
Block a user