56 lines
1.1 KiB
Go
56 lines
1.1 KiB
Go
package application
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"chub/internal/domain"
|
||
|
|
)
|
||
|
|
|
||
|
|
type BrowserManager interface {
|
||
|
|
Start(context.Context, domain.LaunchSpec) (domain.InstanceView, error)
|
||
|
|
List(context.Context) ([]domain.InstanceView, error)
|
||
|
|
Get(context.Context, string) (domain.InstanceView, error)
|
||
|
|
Stop(context.Context, string, bool) error
|
||
|
|
Restart(context.Context, string) (domain.InstanceView, error)
|
||
|
|
}
|
||
|
|
|
||
|
|
type EventSink func(domain.BrowserEvent)
|
||
|
|
|
||
|
|
type ProcessHandle interface {
|
||
|
|
PID() int
|
||
|
|
Wait(context.Context) (int, error)
|
||
|
|
}
|
||
|
|
|
||
|
|
type ProcessLauncher interface {
|
||
|
|
Start(context.Context, domain.LaunchSpec) (ProcessHandle, error)
|
||
|
|
}
|
||
|
|
|
||
|
|
type ExecutableResolver interface {
|
||
|
|
Resolve(context.Context, domain.BrowserKind, string) (string, error)
|
||
|
|
}
|
||
|
|
|
||
|
|
type ProcessIdentity struct {
|
||
|
|
PID int
|
||
|
|
Executable string
|
||
|
|
CommandLine string
|
||
|
|
UserDataDir string
|
||
|
|
}
|
||
|
|
|
||
|
|
type ProcessInspector interface {
|
||
|
|
Inspect(context.Context, int) (ProcessIdentity, error)
|
||
|
|
Alive(context.Context, int) (bool, error)
|
||
|
|
}
|
||
|
|
|
||
|
|
type ProfileUse struct {
|
||
|
|
Occupied bool
|
||
|
|
PID int
|
||
|
|
Source string
|
||
|
|
}
|
||
|
|
|
||
|
|
type ProfileInspector interface {
|
||
|
|
Inspect(context.Context, string) (ProfileUse, error)
|
||
|
|
}
|
||
|
|
|
||
|
|
type Clock func() time.Time
|