ports

package
v0.0.0-...-e28bd7b Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IncomingEventHandlers

type IncomingEventHandlers interface {
	Create(event cacao_common_service.InteractiveSessionModel, sink OutgoingEventPort)
	Deactivate(event cacao_common_service.InteractiveSessionModel, sink OutgoingEventPort)
}

IncomingEventHandlers represents the handlers for all event operations that this service supports

type IncomingEventPort

type IncomingEventPort interface {
	Start(ctx context.Context, wg *sync.WaitGroup) error
	SetHandlers(handlers IncomingEventHandlers)
}

IncomingEventPort is an interface for an event port.

type IncomingQueryHandlers

type IncomingQueryHandlers interface {
	List(actor string, emulator string) ([]types.InteractiveSession, error)
	Get(actor string, emulator string, interactiveSessionID cacao_common.ID) (types.InteractiveSession, error)
	GetByInstanceID(actor string, emulator string, instanceID string) (types.InteractiveSession, error)
	GetByInstanceAddress(actor string, emulator string, instanceAddress string) (types.InteractiveSession, error)
	CheckPrerequisites(protocol cacao_common_service.InteractiveSessionProtocol, instanceAddress string, instanceAdminUsername string) (bool, error)
}

IncomingQueryHandlers ...

type IncomingQueryPort

type IncomingQueryPort interface {
	SetHandlers(handlers IncomingQueryHandlers)
	Start(ctx context.Context, wg *sync.WaitGroup) error
}

IncomingQueryPort is an interface for a query port.

type OutgoingEventPort

type OutgoingEventPort interface {
	Created(event cacao_common_service.InteractiveSessionModel)
	CreateFailed(event cacao_common_service.InteractiveSessionModel)
	// CreateStarted ...
	// this event indicates that the setup has started, this is useful because this allows the REST api to be non-blocking.
	// Instead of waiting for Created event, client can obtain the interactive session ID from this event, and use polling
	// or watch for events to wait for the result of creation.
	CreateStarted(event cacao_common_service.InteractiveSessionModel)
	Deactivated(event cacao_common_service.InteractiveSessionModel)
	DeactivateFailed(event cacao_common_service.InteractiveSessionModel)
}

OutgoingEventPort represents all events that event handlers could publish.

type PersistentStoragePort

type PersistentStoragePort interface {
	Port
	List(user string) ([]types.InteractiveSession, error)
	Get(user string, interactiveSessionID cacao_common.ID) (types.InteractiveSession, error)
	GetByInstanceID(user string, instanceID string) (types.InteractiveSession, error)
	GetByInstanceAddress(user string, instanceAddress string) (types.InteractiveSession, error)
	Create(interactiveSession types.InteractiveSession) error
	Update(interactiveSession types.InteractiveSession, updateFieldNames []string) error
	DeactivateAllByInstanceID(user, instanceID string) (int64, error)
}

PersistentStoragePort is an interface for Persistent Storage.

type Port

type Port interface {
	Init(config *types.Config)
}

Port is a special type of port that will has an asynchronous behavior to it, such as being event-driven outside of the primary domain thread (e.g. incoming message queues). This ports should communicate with the domain object using a threaded approach (i.e. go routine, go channels and possibly waitgroups)

type SessionSetupPort

type SessionSetupPort interface {
	Port
	Setup(user string, cloudID string, protocol cacao_common_service.InteractiveSessionProtocol, instanceAddress string, instanceAdminUsername string) (string, error)
	CheckPrerequisites(protocol cacao_common_service.InteractiveSessionProtocol, instanceAddress string, instanceAdminUsername string) (bool, error)
}

SessionSetupPort is an interface for setting up sessions for VNC or SSH on instances

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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