workspace

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WorkspaceCreated  string = "WorkspaceCreated"
	WorkspaceDeleted  string = "WorkspaceDeleted"
	WorkspaceImported string = "WorkspaceImported"

	ImportWorkspace string = "ImportWorkspace"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateWorkspaceParam

type CreateWorkspaceParam struct {
	ID          string
	Name        string
	Description string
	Storage     Storage
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

CreateWorkspaceParam use to create Workspace

type Factory

type Factory struct{}

Factory workspace factory.

func NewWorkspaceFactory

func NewWorkspaceFactory(_ context.Context) *Factory

NewWorkspaceFactory return a workspace factory.

func (*Factory) CreateWithWorkspaceParam

func (fac *Factory) CreateWithWorkspaceParam(param CreateWorkspaceParam) (*Workspace, error)

CreateWithWorkspaceParam ...

type ImportWorkspaceEvent

type ImportWorkspaceEvent struct {
	WorkspaceID string
	FileName    string
	Storage     Storage
	Event       string
}

func NewImportWorkspaceEvent

func NewImportWorkspaceEvent(workspaceID, fileName string, storage Storage) *ImportWorkspaceEvent

func NewImportWorkspaceEventFromPayload

func NewImportWorkspaceEventFromPayload(data []byte) (*ImportWorkspaceEvent, error)

func (*ImportWorkspaceEvent) Delay

func (e *ImportWorkspaceEvent) Delay() time.Duration

func (*ImportWorkspaceEvent) EventType

func (e *ImportWorkspaceEvent) EventType() string

func (*ImportWorkspaceEvent) Payload

func (e *ImportWorkspaceEvent) Payload() []byte

type NFSStorage

type NFSStorage struct {
	MountPath string
}

type Repository

type Repository interface {
	Save(ctx context.Context, w *Workspace) error
	Get(ctx context.Context, id string) (*Workspace, error)
	Delete(ctx context.Context, w *Workspace) error
}

Repository allows to get/save events from/to event store.

type Service

type Service interface {
	Import(ctx context.Context, workspaceID string, fileName string, storage Storage) error
}

func NewService

func NewService(repo Repository, eventRepo eventbus.EventRepository, bus eventbus.EventBus, factory Factory) Service

type Storage

type Storage struct {
	NFS *NFSStorage
}

type Workspace

type Workspace struct {
	ID          string
	Name        string
	Description string
	CreatedAt   time.Time
	UpdatedAt   time.Time
	Storage     Storage
}

Workspace aggregate root DO.

func (*Workspace) GetCreatedAt

func (w *Workspace) GetCreatedAt() time.Time

func (*Workspace) GetDescription

func (w *Workspace) GetDescription() string

func (*Workspace) GetID

func (w *Workspace) GetID() string

func (*Workspace) GetName

func (w *Workspace) GetName() string

func (*Workspace) GetStorage

func (w *Workspace) GetStorage() Storage

func (*Workspace) GetUpdatedAt

func (w *Workspace) GetUpdatedAt() time.Time

func (*Workspace) String

func (w *Workspace) String() string

func (*Workspace) UpdateDescription

func (w *Workspace) UpdateDescription(description string)

func (*Workspace) UpdateName

func (w *Workspace) UpdateName(name string)

type WorkspaceEvent

type WorkspaceEvent struct {
	WorkspaceID string
	Event       string
}

func NewWorkspaceCreatedEvent

func NewWorkspaceCreatedEvent(workspaceID string) *WorkspaceEvent

func NewWorkspaceDeletedEvent

func NewWorkspaceDeletedEvent(workspaceID string) *WorkspaceEvent

func NewWorkspaceEventFromPayload

func NewWorkspaceEventFromPayload(data []byte) (*WorkspaceEvent, error)

func (*WorkspaceEvent) Delay

func (e *WorkspaceEvent) Delay() time.Duration

func (*WorkspaceEvent) EventType

func (e *WorkspaceEvent) EventType() string

func (*WorkspaceEvent) Payload

func (e *WorkspaceEvent) Payload() []byte

type WorkspaceImportedEvent

type WorkspaceImportedEvent struct {
	WorkspaceID   string
	ImportBaseDir string
}

func NewWorkspaceImportedEvent

func NewWorkspaceImportedEvent(workspaceID, baseDir string) *WorkspaceImportedEvent

func NewWorkspaceImportedEventFromPayload

func NewWorkspaceImportedEventFromPayload(data []byte) (*WorkspaceImportedEvent, error)

func (*WorkspaceImportedEvent) Delay

func (*WorkspaceImportedEvent) EventType

func (e *WorkspaceImportedEvent) EventType() string

func (*WorkspaceImportedEvent) Payload

func (e *WorkspaceImportedEvent) Payload() []byte

Jump to

Keyboard shortcuts

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