adapters

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: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventAdapter

type EventAdapter struct {
	// contains filtered or unexported fields
}

EventAdapter communicates to IncomingEventPort and implements OutgoingEventPort

func NewEventAdapter

func NewEventAdapter(conn messaging2.EventConnection) *EventAdapter

NewEventAdapter creates a new EventAdapter from EventConnection

func (*EventAdapter) CreateFailed

func (adapter *EventAdapter) CreateFailed(actor string, emulator string, workspace types.Workspace, creationError error, transactionID cacao_common.TransactionID) error

CreateFailed publishes cacao_common_service.WorkspaceCreateFailedEvent

func (*EventAdapter) Created

func (adapter *EventAdapter) Created(actor string, emulator string, workspace types.Workspace, transactionID cacao_common.TransactionID) error

Created publishes cacao_common_service.WorkspaceCreatedEvent

func (*EventAdapter) DeleteFailed

func (adapter *EventAdapter) DeleteFailed(actor string, emulator string, workspace types.Workspace, deletionError error, transactionID cacao_common.TransactionID) error

DeleteFailed publishes cacao_common_service.WorkspaceDeleteFailedEvent

func (*EventAdapter) Deleted

func (adapter *EventAdapter) Deleted(actor string, emulator string, workspace types.Workspace, transactionID cacao_common.TransactionID) error

Deleted publishes cacao_common_service.WorkspaceDeletedEvent

func (*EventAdapter) SetHandlers

func (adapter *EventAdapter) SetHandlers(handlers ports.IncomingEventHandlers)

SetHandlers ...

func (*EventAdapter) Start

func (adapter *EventAdapter) Start(ctx context.Context, wg *sync.WaitGroup) error

Start starts the adapter

func (*EventAdapter) UpdateFailed

func (adapter *EventAdapter) UpdateFailed(actor string, emulator string, workspace types.Workspace, updateError error, transactionID cacao_common.TransactionID) error

UpdateFailed publishes cacao_common_service.WorkspaceUpdateFailedEvent

func (*EventAdapter) Updated

func (adapter *EventAdapter) Updated(actor string, emulator string, workspace types.Workspace, transactionID cacao_common.TransactionID) error

Updated publishes cacao_common_service.WorkspaceUpdatedEvent.

type MongoAdapter

type MongoAdapter struct {
	// contains filtered or unexported fields
}

MongoAdapter implements PersistentStoragePort

func (*MongoAdapter) Close

func (adapter *MongoAdapter) Close() error

Close closes Mongo DB connection

func (*MongoAdapter) Create

func (adapter *MongoAdapter) Create(ctx context.Context, workspace types.Workspace) error

Create inserts a workspace

func (*MongoAdapter) Delete

func (adapter *MongoAdapter) Delete(ctx context.Context, user string, workspaceID cacao_common.ID) error

Delete deletes a workspace

func (*MongoAdapter) Get

func (adapter *MongoAdapter) Get(ctx context.Context, user string, workspaceID cacao_common.ID) (types.Workspace, error)

Get returns the workspace with the ID

func (*MongoAdapter) GetMock

func (adapter *MongoAdapter) GetMock() *mock.Mock

GetMock returns Mock

func (*MongoAdapter) Init

func (adapter *MongoAdapter) Init(config *types.Config) error

Init initialize mongodb adapter

func (*MongoAdapter) List

func (adapter *MongoAdapter) List(ctx context.Context, user string) ([]types.Workspace, error)

List returns workspaces owned by a user

func (*MongoAdapter) MockCreate

func (adapter *MongoAdapter) MockCreate(workspace types.Workspace, expectedError error) error

MockCreate sets expected results for Create

func (*MongoAdapter) MockDelete

func (adapter *MongoAdapter) MockDelete(user string, workspaceID cacao_common.ID, existingWorkspace types.Workspace, expectedError error) error

MockDelete sets expected results for Delete

func (*MongoAdapter) MockGet

func (adapter *MongoAdapter) MockGet(user string, workspaceID cacao_common.ID, expectedWorkspace types.Workspace, expectedError error) error

MockGet sets expected results for Get

func (*MongoAdapter) MockList

func (adapter *MongoAdapter) MockList(user string, expectedWorkspaces []types.Workspace, expectedError error) error

MockList sets expected results for List

func (*MongoAdapter) MockUpdate

func (adapter *MongoAdapter) MockUpdate(existingWorkspace types.Workspace, newWorkspace types.Workspace, expectedError error) error

MockUpdate sets expected results for Update

func (*MongoAdapter) Update

func (adapter *MongoAdapter) Update(ctx context.Context, workspace types.Workspace, updateFieldNames []string) error

Update updates/edits a workspace

type QueryAdapter

type QueryAdapter struct {
	// contains filtered or unexported fields
}

QueryAdapter communicates to IncomingQueryPort

func NewQueryAdapter

func NewQueryAdapter(queryConn messaging2.QueryConnection) *QueryAdapter

NewQueryAdapter ...

func (*QueryAdapter) SetHandlers

func (adapter *QueryAdapter) SetHandlers(handlers ports.IncomingQueryHandlers)

SetHandlers ...

func (*QueryAdapter) Start

func (adapter *QueryAdapter) Start(ctx context.Context, wg *sync.WaitGroup) error

Start starts the adapter

Jump to

Keyboard shortcuts

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