ports

package
v0.0.0-...-b2ee15e Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCredentialID

func GenerateCredentialID() common.ID

GenerateCredentialID is default implementation of CredIDGenerator

Types

type CredIDGenerator

type CredIDGenerator func() common.ID

CredIDGenerator generates a new unique credential ID.

The reason for this to exist is to extract out the logic for generating new credential ID, make it easier to test handlers.

type IncomingEventHandlers

type IncomingEventHandlers interface {
	EventCredentialAddRequested(ctx context.Context, request service.CredentialCreateRequest, sink OutgoingEvents)
	EventCredentialDeleteRequested(ctx context.Context, request service.CredentialDeleteRequest, sink OutgoingEvents)
	EventCredentialUpdateRequested(ctx context.Context, request service.CredentialUpdateRequest, sink OutgoingEvents)
	EventSystemCredentialGenerationRequested(ctx context.Context, request service.CredentialCreateRequest, sink OutgoingEvents)
}

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

type IncomingEventPort

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

IncomingEventPort is an example interface for an event port.

type IncomingQueryHandlers

IncomingQueryHandlers ...

type IncomingQueryPort

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

IncomingQueryPort is an example interface for a query port. Internal to the adapter there may be additional methods, but at the very least, it is an async port Also, incoming and outgoing ports are declared separately for illustrative purposes method set signatures will allow one adapter fulfill the purposes of both income and outgoing query ports

type OutgoingEvents

type OutgoingEvents interface {
	EventCredentialAdded(service.CredentialCreateResponse)
	EventCredentialAddError(service.CredentialCreateResponse)
	EventCredentialDeleted(service.CredentialDeleteResponse)
	EventCredentialDeleteError(service.CredentialDeleteResponse)
	EventCredentialUpdated(service.CredentialUpdateResponse)
	EventCredentialUpdateError(service.CredentialUpdateResponse)
}

OutgoingEvents is an abstraction for publishing events, each method publish an event corresponding to the name of the method, this interface contains all events that will be published by this service.

type PersistentStoragePort

type PersistentStoragePort interface {
	Port
	Create(d service.CredentialModel) error
	Delete(d service.CredentialModel) error
	// GetAndDelete get current cred and delete cred, return nil, nil if credential not found
	GetAndDelete(d service.CredentialModel) (*service.CredentialModel, error)
	Get(d service.CredentialModel) (service.CredentialModel, error)
	Update(credUpdate types.CredUpdate) error
	List(d types.ListQueryData) ([]service.CredentialModel, error)
}

PersistentStoragePort is a port to store messages. The persistence storage should ensure the uniqueness of the combination of username and ID.

type Port

type Port interface {
	Init(c types.Config) error
}

Port is the base interface for Ports, in which all should support an Init() function (but it may be noop)

type TimeSrc

type TimeSrc func() time.Time

TimeSrc returns the current time

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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