operation

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelOperationRequest

type CancelOperationRequest struct {
	ID string `json:"id" validate:"required"`
}

func (CancelOperationRequest) Validate

func (r CancelOperationRequest) Validate() error

Validate does struct validation and returns an error when invalid.

type GetOperationRequest

type GetOperationRequest struct {
	ID string `json:"id" validate:"required"`
}

func (GetOperationRequest) Validate

func (r GetOperationRequest) Validate() error

Validate does struct validation and returns an error when invalid.

type ListOperationsRequest

type ListOperationsRequest struct {
	Parent string `validate:"required"`
	Filter filtering.Filter
}

func (ListOperationsRequest) Validate

func (r ListOperationsRequest) Validate() error

type ListOperationsResponse

type ListOperationsResponse struct {
	Operations []Operation
}

type Operation

type Operation struct {
	ID     string `json:"json"`
	Done   bool   `json:"done"`
	Result Result `json:"result,omitempty"`
}

func ServiceModel

func ServiceModel(op opstorage.StoredOperation) (*Operation, error)

ServiceModel converts a storage.StoredOperation to an Operation. The Result.Response field is introspected and converted into the service layer's model.

type Result

type Result struct {
	Error    string `json:"error,omitempty"`
	Response any    `json:"response,omitempty"`
}

type Service

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

func NewOperationService

func NewOperationService(s storage.ServiceStorage) (*Service, error)

func (Service) CancelOperation

func (s Service) CancelOperation(ctx context.Context, request CancelOperationRequest) (*Operation, error)

func (Service) GetOperation

func (s Service) GetOperation(ctx context.Context, request GetOperationRequest) (*Operation, error)

func (Service) ListOperations

func (s Service) ListOperations(ctx context.Context, request ListOperationsRequest) (*ListOperationsResponse, error)

func (Service) Status

func (s Service) Status() framework.Status

func (Service) Type

func (s Service) Type() framework.Type

type ServiceModelFunc

type ServiceModelFunc func(any) any

type Storage

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

func NewOperationStorage

func NewOperationStorage(db storage.ServiceStorage) (*Storage, error)

func (Storage) CancelOperation

func (s Storage) CancelOperation(ctx context.Context, id string) (*opstorage.StoredOperation, error)

func (Storage) DeleteOperation

func (s Storage) DeleteOperation(ctx context.Context, id string) error

func (Storage) GetOperation

func (s Storage) GetOperation(ctx context.Context, id string) (opstorage.StoredOperation, error)

func (Storage) ListOperations

func (s Storage) ListOperations(ctx context.Context, parent string, filter filtering.Filter) ([]opstorage.StoredOperation, error)

func (Storage) StoreOperation

func (s Storage) StoreOperation(ctx context.Context, op opstorage.StoredOperation) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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