Add session and provider controller interfaces. Begun designing worker system.

This commit is contained in:
2025-09-18 04:00:41 +00:00
parent 7109acc207
commit 56a36283e5
5 changed files with 35 additions and 3 deletions

View File

@@ -0,0 +1,22 @@
package manager
import (
"time"
"github.com/google/uuid"
"gitlab.michelsen.id/phillmichelsen/tessera/services/data_service/internal/domain"
"gitlab.michelsen.id/phillmichelsen/tessera/services/data_service/internal/provider"
)
type SessionController interface {
NewSession(idleAfter time.Duration) uuid.UUID
AttachClient(id uuid.UUID, inBuf, outBuf int) (chan<- domain.Message, <-chan domain.Message, error)
DetachClient(id uuid.UUID) error
ConfigureSession(id uuid.UUID, next []domain.Identifier) error
CloseSession(id uuid.UUID) error
}
type ProviderController interface {
AddProvider(name string, p provider.Provider) error
RemoveProvider(name string) error
}

View File

@@ -47,7 +47,7 @@ func NewManager(r *router.Router) *Manager {
return m
}
// Public API (posts commands to loop)
// API
// AddProvider adds and starts a new provider.
func (m *Manager) AddProvider(name string, p provider.Provider) error {

View File

@@ -1 +0,0 @@
package worker

View File

@@ -1 +0,0 @@
package worker

View File

@@ -0,0 +1,12 @@
package worker
import (
"github.com/google/uuid"
"gitlab.michelsen.id/phillmichelsen/tessera/services/data_service/internal/manager"
)
type Worker interface {
ID() uuid.UUID
Start(cfg map[string]string, controller manager.SessionController) error
Stop()
}