Documentation ¶
Overview ¶
Package service holds the business logic allowing the manipulation of assets. The main entry point is the ServiceProvider, from which the services are accessible. Services can rely on each other when multiple assets are involved in the same transaction. Storage is isolated in the persistence layer and services should only deal with their dedicated asset's persistence.
Index ¶
- func GetParentTaskKeys(inputs []*asset.ComputeTaskInput) []string
- type ChannelProvider
- type ComputePlanAPI
- type ComputePlanDependencyProvider
- type ComputePlanService
- func (s *ComputePlanService) ApplyPlanAction(key string, action asset.ComputePlanAction, requester string) error
- func (s *ComputePlanService) GetPlan(key string) (*asset.ComputePlan, error)
- func (s *ComputePlanService) IsPlanRunning(key string) (bool, error)
- func (s *ComputePlanService) QueryPlans(p *common.Pagination, filter *asset.PlanQueryFilter) ([]*asset.ComputePlan, common.PaginationToken, error)
- func (s *ComputePlanService) RegisterPlan(input *asset.NewComputePlan, owner string) (*asset.ComputePlan, error)
- func (s *ComputePlanService) UpdatePlan(a *asset.UpdateComputePlanParam, requester string) error
- type ComputePlanServiceProvider
- type ComputeTaskAPI
- type ComputeTaskDependencyProvider
- type ComputeTaskService
- func (s *ComputeTaskService) ApplyTaskAction(key string, action asset.ComputeTaskAction, reason string, requester string) error
- func (s *ComputeTaskService) DisableOutput(taskKey string, identifier string, requester string) error
- func (s *ComputeTaskService) GetInputAssets(key string) ([]*asset.ComputeTaskInputAsset, error)
- func (s *ComputeTaskService) GetTask(key string) (*asset.ComputeTask, error)
- func (s *ComputeTaskService) GetTasksByFunction(functionKey string, statuses []asset.ComputeTaskStatus) ([]*asset.ComputeTask, error)
- func (s *ComputeTaskService) PropagateActionFromFunction(functionKey string, action asset.ComputeTaskAction, reason string, ...) error
- func (s *ComputeTaskService) QueryTasks(p *common.Pagination, filter *asset.TaskQueryFilter) ([]*asset.ComputeTask, common.PaginationToken, error)
- func (s *ComputeTaskService) RegisterTasks(tasks []*asset.NewComputeTask, owner string) ([]*asset.ComputeTask, error)
- func (s *ComputeTaskService) StartDependentTask(child *asset.ComputeTask, reason string) error
- type ComputeTaskServiceProvider
- type DataManagerAPI
- type DataManagerDependencyProvider
- type DataManagerPermissions
- type DataManagerService
- func (s *DataManagerService) CheckDataManager(datamanager *asset.DataManager, dataSampleKeys []string, owner string) error
- func (s *DataManagerService) CheckOwner(keys []string, requester string) error
- func (s *DataManagerService) GetDataManager(key string) (*asset.DataManager, error)
- func (s *DataManagerService) QueryDataManagers(p *common.Pagination) ([]*asset.DataManager, common.PaginationToken, error)
- func (s *DataManagerService) RegisterDataManager(d *asset.NewDataManager, owner string) (*asset.DataManager, error)
- func (s *DataManagerService) UpdateDataManager(a *asset.UpdateDataManagerParam, requester string) error
- type DataManagerServiceProvider
- type DataSampleAPI
- type DataSampleDependencyProvider
- type DataSampleService
- func (s *DataSampleService) CheckSameManager(managerKey string, sampleKeys []string) error
- func (s *DataSampleService) GetDataSample(key string) (*asset.DataSample, error)
- func (s *DataSampleService) GetDataSampleKeysByManager(managerKey string) ([]string, error)
- func (s *DataSampleService) QueryDataSamples(p *common.Pagination, filter *asset.DataSampleQueryFilter) ([]*asset.DataSample, common.PaginationToken, error)
- func (s *DataSampleService) RegisterDataSamples(samples []*asset.NewDataSample, owner string) ([]*asset.DataSample, error)
- func (s *DataSampleService) UpdateDataSamples(d *asset.UpdateDataSamplesParam, owner string) error
- type DataSampleServiceProvider
- type DatasetAPI
- type DatasetDependencyProvider
- type DatasetService
- type DatasetServiceProvider
- type DependenciesProvider
- type EventAPI
- type EventDependencyProvider
- type EventService
- type EventServiceProvider
- type FailureReportAPI
- type FailureReportDependencyProvider
- type FailureReportService
- type FailureReportServiceProvider
- type FunctionAPI
- type FunctionDependencyProvider
- type FunctionService
- func (s *FunctionService) ApplyFunctionAction(key string, action asset.FunctionAction, reason string, requester string) error
- func (s *FunctionService) CanDownload(key string, requester string) (bool, error)
- func (s *FunctionService) FunctionExists(key string) (bool, error)
- func (s *FunctionService) GetFunction(key string) (*asset.Function, error)
- func (s *FunctionService) QueryFunctions(p *common.Pagination, filter *asset.FunctionQueryFilter) ([]*asset.Function, common.PaginationToken, error)
- func (s *FunctionService) RegisterFunction(a *asset.NewFunction, owner string) (*asset.Function, error)
- func (s *FunctionService) UpdateFunction(a *asset.UpdateFunctionParam, requester string) error
- type FunctionServiceProvider
- type LoggerProvider
- type ModelAPI
- type ModelDependencyProvider
- type ModelService
- func (s *ModelService) GetCheckedModel(key string, worker string) (*asset.Model, error)
- func (s *ModelService) GetComputeTaskOutputModels(key string) ([]*asset.Model, error)
- func (s *ModelService) GetModel(key string) (*asset.Model, error)
- func (s *ModelService) RegisterModels(models []*asset.NewModel, owner string) ([]*asset.Model, error)
- type ModelServiceProvider
- type OrganizationAPI
- type OrganizationDependencyProvider
- type OrganizationService
- func (s *OrganizationService) GetAllOrganizations() ([]*asset.Organization, error)
- func (s *OrganizationService) GetOrganization(id string) (*asset.Organization, error)
- func (s *OrganizationService) RegisterOrganization(id string, newOrganization *asset.RegisterOrganizationParam) (*asset.Organization, error)
- type OrganizationServiceProvider
- type PerformanceAPI
- type PerformanceDependencyProvider
- type PerformanceService
- type PerformanceServiceProvider
- type PermissionAPI
- type PermissionDependencyProvider
- type PermissionService
- func (s *PermissionService) CanProcess(perms *asset.Permissions, requester string) bool
- func (s *PermissionService) CreatePermission(owner string, newPerms *asset.NewPermissions) (*asset.Permission, error)
- func (s *PermissionService) CreatePermissions(owner string, newPerms *asset.NewPermissions) (*asset.Permissions, error)
- func (s *PermissionService) IntersectPermission(x, y *asset.Permission) *asset.Permission
- func (s *PermissionService) IntersectPermissions(x, y *asset.Permissions) *asset.Permissions
- func (s *PermissionService) UnionPermission(x, y *asset.Permission) *asset.Permission
- func (s *PermissionService) UnionPermissions(x, y *asset.Permissions) *asset.Permissions
- type PermissionServiceProvider
- type ProfilingAPI
- type ProfilingDependencyProvider
- type ProfilingService
- type ProfilingServiceProvider
- type Provider
- func (sc *Provider) GetChannel() string
- func (sc *Provider) GetComputePlanDBAL() persistence.ComputePlanDBAL
- func (sc *Provider) GetComputePlanService() ComputePlanAPI
- func (sc *Provider) GetComputeTaskDBAL() persistence.ComputeTaskDBAL
- func (sc *Provider) GetComputeTaskService() ComputeTaskAPI
- func (sc *Provider) GetDataManagerDBAL() persistence.DataManagerDBAL
- func (sc *Provider) GetDataManagerService() DataManagerAPI
- func (sc *Provider) GetDataSampleDBAL() persistence.DataSampleDBAL
- func (sc *Provider) GetDataSampleService() DataSampleAPI
- func (sc *Provider) GetDatasetService() DatasetAPI
- func (sc *Provider) GetEventDBAL() persistence.EventDBAL
- func (sc *Provider) GetEventService() EventAPI
- func (sc *Provider) GetFailureReportDBAL() persistence.FailureReportDBAL
- func (sc *Provider) GetFailureReportService() FailureReportAPI
- func (sc *Provider) GetFunctionDBAL() persistence.FunctionDBAL
- func (sc *Provider) GetFunctionService() FunctionAPI
- func (sc *Provider) GetLogger() *zerolog.Logger
- func (sc *Provider) GetModelDBAL() persistence.ModelDBAL
- func (sc *Provider) GetModelService() ModelAPI
- func (sc *Provider) GetOrganizationDBAL() persistence.OrganizationDBAL
- func (sc *Provider) GetOrganizationService() OrganizationAPI
- func (sc *Provider) GetPerformanceDBAL() persistence.PerformanceDBAL
- func (sc *Provider) GetPerformanceService() PerformanceAPI
- func (sc *Provider) GetPermissionService() PermissionAPI
- func (sc *Provider) GetProfilingService() ProfilingAPI
- func (sc *Provider) GetTimeService() TimeAPI
- type TimeAPI
- type TimeService
- type TimeServiceProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetParentTaskKeys ¶
func GetParentTaskKeys(inputs []*asset.ComputeTaskInput) []string
GetParentTaskKeys returns the parent task keys based on task inputs
Types ¶
type ChannelProvider ¶
type ChannelProvider interface {
GetChannel() string
}
type ComputePlanAPI ¶
type ComputePlanAPI interface { RegisterPlan(plan *asset.NewComputePlan, owner string) (*asset.ComputePlan, error) GetPlan(key string) (*asset.ComputePlan, error) QueryPlans(p *common.Pagination, filter *asset.PlanQueryFilter) ([]*asset.ComputePlan, common.PaginationToken, error) ApplyPlanAction(key string, action asset.ComputePlanAction, requester string) error UpdatePlan(computePlan *asset.UpdateComputePlanParam, requester string) error IsPlanRunning(key string) (bool, error) // contains filtered or unexported methods }
ComputePlanAPI defines the methods to act on ComputePlans
type ComputePlanDependencyProvider ¶
type ComputePlanDependencyProvider interface { LoggerProvider persistence.ComputePlanDBALProvider EventServiceProvider ComputeTaskServiceProvider TimeServiceProvider }
ComputePlanDependencyProvider defines what the ComputePlanService needs to perform its duty
type ComputePlanService ¶
type ComputePlanService struct {
ComputePlanDependencyProvider
}
ComputePlanService is the compute plan manipulation entry point
func NewComputePlanService ¶
func NewComputePlanService(provider ComputePlanDependencyProvider) *ComputePlanService
NewComputePlanService creates a new service
func (*ComputePlanService) ApplyPlanAction ¶
func (s *ComputePlanService) ApplyPlanAction(key string, action asset.ComputePlanAction, requester string) error
func (*ComputePlanService) GetPlan ¶
func (s *ComputePlanService) GetPlan(key string) (*asset.ComputePlan, error)
func (*ComputePlanService) IsPlanRunning ¶
func (s *ComputePlanService) IsPlanRunning(key string) (bool, error)
IsPlanRunning indicates whether there are tasks belonging to the compute plan being executed or waiting to be executed
func (*ComputePlanService) QueryPlans ¶
func (s *ComputePlanService) QueryPlans(p *common.Pagination, filter *asset.PlanQueryFilter) ([]*asset.ComputePlan, common.PaginationToken, error)
func (*ComputePlanService) RegisterPlan ¶
func (s *ComputePlanService) RegisterPlan(input *asset.NewComputePlan, owner string) (*asset.ComputePlan, error)
func (*ComputePlanService) UpdatePlan ¶
func (s *ComputePlanService) UpdatePlan(a *asset.UpdateComputePlanParam, requester string) error
UpdatePlan updates mutable fields of a compute plan. List of mutable fields : name.
type ComputePlanServiceProvider ¶
type ComputePlanServiceProvider interface {
GetComputePlanService() ComputePlanAPI
}
ComputePlanServiceProvider defines an object able to provide a ComputePlanAPI instance
type ComputeTaskAPI ¶
type ComputeTaskAPI interface { RegisterTasks(tasks []*asset.NewComputeTask, owner string) ([]*asset.ComputeTask, error) GetTask(key string) (*asset.ComputeTask, error) QueryTasks(p *common.Pagination, filter *asset.TaskQueryFilter) ([]*asset.ComputeTask, common.PaginationToken, error) ApplyTaskAction(key string, action asset.ComputeTaskAction, reason string, requester string) error GetInputAssets(key string) ([]*asset.ComputeTaskInputAsset, error) DisableOutput(taskKey string, identifier string, requester string) error PropagateActionFromFunction(functionKey string, action asset.ComputeTaskAction, reason string, requester string) error GetTasksByFunction(functionKey string, statuses []asset.ComputeTaskStatus) ([]*asset.ComputeTask, error) StartDependentTask(child *asset.ComputeTask, reason string) error // contains filtered or unexported methods }
ComputeTaskAPI defines the methods to act on ComputeTasks
type ComputeTaskDependencyProvider ¶
type ComputeTaskDependencyProvider interface { LoggerProvider ChannelProvider persistence.ComputeTaskDBALProvider EventServiceProvider FunctionServiceProvider DataManagerServiceProvider DataSampleServiceProvider PermissionServiceProvider OrganizationServiceProvider ComputePlanServiceProvider ModelServiceProvider TimeServiceProvider }
ComputeTaskDependencyProvider defines what the ComputeTaskService needs to perform its duty
type ComputeTaskService ¶
type ComputeTaskService struct { ComputeTaskDependencyProvider // contains filtered or unexported fields }
ComputeTaskService is the compute task manipulation entry point
func NewComputeTaskService ¶
func NewComputeTaskService(provider ComputeTaskDependencyProvider) *ComputeTaskService
NewComputeTaskService creates a new service
func (*ComputeTaskService) ApplyTaskAction ¶
func (s *ComputeTaskService) ApplyTaskAction(key string, action asset.ComputeTaskAction, reason string, requester string) error
ApplyTaskAction apply an asset.ComputeTaskAction to the task. It checks the permission and delegate to `applyTaskAction` Depending on the current state and action, this may update children tasks
func (*ComputeTaskService) DisableOutput ¶
func (s *ComputeTaskService) DisableOutput(taskKey string, identifier string, requester string) error
func (*ComputeTaskService) GetInputAssets ¶
func (s *ComputeTaskService) GetInputAssets(key string) ([]*asset.ComputeTaskInputAsset, error)
GetInputAssets returns the assets necessary to process the task.
func (*ComputeTaskService) GetTask ¶
func (s *ComputeTaskService) GetTask(key string) (*asset.ComputeTask, error)
GetTask return a single task
func (*ComputeTaskService) GetTasksByFunction ¶
func (s *ComputeTaskService) GetTasksByFunction(functionKey string, statuses []asset.ComputeTaskStatus) ([]*asset.ComputeTask, error)
func (*ComputeTaskService) PropagateActionFromFunction ¶
func (s *ComputeTaskService) PropagateActionFromFunction(functionKey string, action asset.ComputeTaskAction, reason string, requester string) error
func (*ComputeTaskService) QueryTasks ¶
func (s *ComputeTaskService) QueryTasks(p *common.Pagination, filter *asset.TaskQueryFilter) ([]*asset.ComputeTask, common.PaginationToken, error)
QueryTasks returns tasks matching filter
func (*ComputeTaskService) RegisterTasks ¶
func (s *ComputeTaskService) RegisterTasks(tasks []*asset.NewComputeTask, owner string) ([]*asset.ComputeTask, error)
RegisterTasks creates multiple compute tasks
func (*ComputeTaskService) StartDependentTask ¶
func (s *ComputeTaskService) StartDependentTask(child *asset.ComputeTask, reason string) error
type ComputeTaskServiceProvider ¶
type ComputeTaskServiceProvider interface {
GetComputeTaskService() ComputeTaskAPI
}
ComputeTaskServiceProvider defines an object able to provide a ComputeTaskAPI instance
type DataManagerAPI ¶
type DataManagerAPI interface { RegisterDataManager(datamanager *asset.NewDataManager, owner string) (*asset.DataManager, error) GetDataManager(key string) (*asset.DataManager, error) QueryDataManagers(p *common.Pagination) ([]*asset.DataManager, common.PaginationToken, error) CheckOwner(keys []string, requester string) error CheckDataManager(datamanager *asset.DataManager, dataSampleKeys []string, owner string) error UpdateDataManager(a *asset.UpdateDataManagerParam, requester string) error }
DataManagerAPI defines the methods to act on DataManagers
type DataManagerDependencyProvider ¶
type DataManagerDependencyProvider interface { LoggerProvider persistence.DataManagerDBALProvider PermissionServiceProvider EventServiceProvider TimeServiceProvider DataSampleServiceProvider }
DataManagerDependencyProvider defines what the DataManagerService needs to perform its duty
type DataManagerPermissions ¶
type DataManagerPermissions struct {
asset.Permission
}
type DataManagerService ¶
type DataManagerService struct {
DataManagerDependencyProvider
}
DataManagerService is the DataManager manipulation entry point it implements the API interface
func NewDataManagerService ¶
func NewDataManagerService(provider DataManagerDependencyProvider) *DataManagerService
NewDataManagerService will create a new service with given persistence layer
func (*DataManagerService) CheckDataManager ¶
func (s *DataManagerService) CheckDataManager(datamanager *asset.DataManager, dataSampleKeys []string, owner string) error
CheckDataManager returns an error if the DataManager is not processable by owner or DataSamples don't share the common manager.
func (*DataManagerService) CheckOwner ¶
func (s *DataManagerService) CheckOwner(keys []string, requester string) error
CheckOwner validates that the DataManagerKeys are owned by the requester and return an error if that's not the case.
func (*DataManagerService) GetDataManager ¶
func (s *DataManagerService) GetDataManager(key string) (*asset.DataManager, error)
GetDataManager retrieves a single DataManager by its key
func (*DataManagerService) QueryDataManagers ¶
func (s *DataManagerService) QueryDataManagers(p *common.Pagination) ([]*asset.DataManager, common.PaginationToken, error)
QueryDataManagers returns all stored DataManagers
func (*DataManagerService) RegisterDataManager ¶
func (s *DataManagerService) RegisterDataManager(d *asset.NewDataManager, owner string) (*asset.DataManager, error)
RegisterDataManager persists a DataManager
func (*DataManagerService) UpdateDataManager ¶
func (s *DataManagerService) UpdateDataManager(a *asset.UpdateDataManagerParam, requester string) error
UpdateDataManager updates mutable fields of a data manager. List of mutable fields : name.
type DataManagerServiceProvider ¶
type DataManagerServiceProvider interface {
GetDataManagerService() DataManagerAPI
}
DataManagerServiceProvider defines an object able to provide an DataManagerAPI instance
type DataSampleAPI ¶
type DataSampleAPI interface { RegisterDataSamples(datasamples []*asset.NewDataSample, owner string) ([]*asset.DataSample, error) UpdateDataSamples(datasample *asset.UpdateDataSamplesParam, owner string) error QueryDataSamples(p *common.Pagination, filter *asset.DataSampleQueryFilter) ([]*asset.DataSample, common.PaginationToken, error) CheckSameManager(managerKey string, sampleKeys []string) error GetDataSampleKeysByManager(managerKey string) ([]string, error) GetDataSample(string) (*asset.DataSample, error) }
DataSampleAPI defines the methods to act on DataSamples
type DataSampleDependencyProvider ¶
type DataSampleDependencyProvider interface { LoggerProvider persistence.DataSampleDBALProvider DataManagerServiceProvider EventServiceProvider TimeServiceProvider }
DataSampleDependencyProvider defines what the DataSampleService needs to perform its duty
type DataSampleService ¶
type DataSampleService struct {
DataSampleDependencyProvider
}
DataSampleService is the data samples manipulation entry point it implements the API interface
func NewDataSampleService ¶
func NewDataSampleService(provider DataSampleDependencyProvider) *DataSampleService
NewDataSampleService will create a new service with given dependency provider
func (*DataSampleService) CheckSameManager ¶
func (s *DataSampleService) CheckSameManager(managerKey string, sampleKeys []string) error
CheckSameManager validates that samples all have in common the given manager.
func (*DataSampleService) GetDataSample ¶
func (s *DataSampleService) GetDataSample(key string) (*asset.DataSample, error)
GetDataSample retrieves an datasample by its key
func (*DataSampleService) GetDataSampleKeysByManager ¶
func (s *DataSampleService) GetDataSampleKeysByManager(managerKey string) ([]string, error)
func (*DataSampleService) QueryDataSamples ¶
func (s *DataSampleService) QueryDataSamples(p *common.Pagination, filter *asset.DataSampleQueryFilter) ([]*asset.DataSample, common.PaginationToken, error)
QueryDataSamples returns all stored datasamples
func (*DataSampleService) RegisterDataSamples ¶
func (s *DataSampleService) RegisterDataSamples(samples []*asset.NewDataSample, owner string) ([]*asset.DataSample, error)
func (*DataSampleService) UpdateDataSamples ¶
func (s *DataSampleService) UpdateDataSamples(d *asset.UpdateDataSamplesParam, owner string) error
UpdateDataSamples update or add one or multiple datasamples
type DataSampleServiceProvider ¶
type DataSampleServiceProvider interface {
GetDataSampleService() DataSampleAPI
}
DataSampleServiceProvider defines an object able to provide a DataSampleAPI instance
type DatasetAPI ¶
DatasetAPI defines the methods to act on Datasets
type DatasetDependencyProvider ¶
type DatasetDependencyProvider interface { DataManagerServiceProvider DataSampleServiceProvider }
DatasetDependencyProvider defines what the DatasetService needs to perform its duty
type DatasetService ¶
type DatasetService struct {
DatasetDependencyProvider
}
DatasetService is the Dataset manipulation entry point it implements the API interface
func NewDatasetService ¶
func NewDatasetService(provider DatasetDependencyProvider) *DatasetService
NewDatasetService will create a new service with given persistence layer
func (*DatasetService) GetDataset ¶
func (s *DatasetService) GetDataset(id string) (*asset.Dataset, error)
GetDataset retrieves a single Dataset by its ID
type DatasetServiceProvider ¶
type DatasetServiceProvider interface {
GetDatasetService() DatasetAPI
}
DatasetServiceProvider defines an object able to provide an DatasetAPI instance
type DependenciesProvider ¶
type DependenciesProvider interface { persistence.DBALProvider OrganizationServiceProvider DataSampleServiceProvider FunctionServiceProvider PermissionServiceProvider DataManagerServiceProvider DatasetServiceProvider ComputeTaskServiceProvider ModelServiceProvider ComputePlanServiceProvider ProfilingServiceProvider PerformanceServiceProvider EventServiceProvider LoggerProvider TimeServiceProvider FailureReportServiceProvider ChannelProvider }
DependenciesProvider describes a Provider exposing all orchestration services.
type EventAPI ¶
type EventAPI interface { // RegisterEvents allows registering multiple events at once. RegisterEvents(...*asset.Event) error QueryEvents(p *common.Pagination, filter *asset.EventQueryFilter, sortOrder asset.SortOrder) ([]*asset.Event, common.PaginationToken, error) }
type EventDependencyProvider ¶
type EventDependencyProvider interface { persistence.EventDBALProvider TimeServiceProvider }
type EventService ¶
type EventService struct {
EventDependencyProvider
}
func NewEventService ¶
func NewEventService(provider EventDependencyProvider) *EventService
func (*EventService) QueryEvents ¶
func (s *EventService) QueryEvents(p *common.Pagination, filter *asset.EventQueryFilter, sortOrder asset.SortOrder) ([]*asset.Event, common.PaginationToken, error)
func (*EventService) RegisterEvents ¶
func (s *EventService) RegisterEvents(events ...*asset.Event) error
RegisterEvents assigns an ID to each event and persist them.
type EventServiceProvider ¶
type EventServiceProvider interface {
GetEventService() EventAPI
}
type FailureReportAPI ¶
type FailureReportAPI interface { RegisterFailureReport(failure *asset.NewFailureReport, owner string) (*asset.FailureReport, error) GetFailureReport(assetKey string) (*asset.FailureReport, error) }
type FailureReportDependencyProvider ¶
type FailureReportDependencyProvider interface { LoggerProvider persistence.FailureReportDBALProvider ComputeTaskServiceProvider FunctionServiceProvider EventServiceProvider TimeServiceProvider }
type FailureReportService ¶
type FailureReportService struct {
FailureReportDependencyProvider
}
func NewFailureReportService ¶
func NewFailureReportService(provider FailureReportDependencyProvider) *FailureReportService
func (*FailureReportService) GetFailureReport ¶
func (s *FailureReportService) GetFailureReport(assetKey string) (*asset.FailureReport, error)
func (*FailureReportService) RegisterFailureReport ¶
func (s *FailureReportService) RegisterFailureReport(newFailureReport *asset.NewFailureReport, requester string) (*asset.FailureReport, error)
type FailureReportServiceProvider ¶
type FailureReportServiceProvider interface {
GetFailureReportService() FailureReportAPI
}
type FunctionAPI ¶
type FunctionAPI interface { RegisterFunction(function *asset.NewFunction, owner string) (*asset.Function, error) GetFunction(string) (*asset.Function, error) QueryFunctions(p *common.Pagination, filter *asset.FunctionQueryFilter) ([]*asset.Function, common.PaginationToken, error) CanDownload(key string, requester string) (bool, error) FunctionExists(key string) (bool, error) UpdateFunction(function *asset.UpdateFunctionParam, requester string) error ApplyFunctionAction(key string, action asset.FunctionAction, reason string, requester string) error // contains filtered or unexported methods }
FunctionAPI defines the methods to act on Functions
type FunctionDependencyProvider ¶
type FunctionDependencyProvider interface { LoggerProvider persistence.FunctionDBALProvider EventServiceProvider ComputeTaskServiceProvider PermissionServiceProvider TimeServiceProvider }
FunctionDependencyProvider defines what the FunctionService needs to perform its duty
type FunctionService ¶
type FunctionService struct {
FunctionDependencyProvider
}
FunctionService is the function manipulation entry point it implements the API interface
func NewFunctionService ¶
func NewFunctionService(provider FunctionDependencyProvider) *FunctionService
NewFunctionService will create a new service with given persistence layer
func (*FunctionService) ApplyFunctionAction ¶
func (s *FunctionService) ApplyFunctionAction(key string, action asset.FunctionAction, reason string, requester string) error
ApplyFunctionAction apply an asset.FunctionStatus to the function.
func (*FunctionService) CanDownload ¶
func (s *FunctionService) CanDownload(key string, requester string) (bool, error)
CanDownload checks if the requester can download the function corresponding to the provided key
func (*FunctionService) FunctionExists ¶
func (s *FunctionService) FunctionExists(key string) (bool, error)
FunctionExists returns true if the function exists
func (*FunctionService) GetFunction ¶
func (s *FunctionService) GetFunction(key string) (*asset.Function, error)
GetFunction retrieves an function by its key
func (*FunctionService) QueryFunctions ¶
func (s *FunctionService) QueryFunctions(p *common.Pagination, filter *asset.FunctionQueryFilter) ([]*asset.Function, common.PaginationToken, error)
QueryFunctions returns all stored functions
func (*FunctionService) RegisterFunction ¶
func (s *FunctionService) RegisterFunction(a *asset.NewFunction, owner string) (*asset.Function, error)
RegisterFunction persist an function
func (*FunctionService) UpdateFunction ¶
func (s *FunctionService) UpdateFunction(a *asset.UpdateFunctionParam, requester string) error
UpdateFunction updates mutable fields of an function. List of mutable fields : name, image.
type FunctionServiceProvider ¶
type FunctionServiceProvider interface {
GetFunctionService() FunctionAPI
}
FunctionServiceProvider defines an object able to provide an FunctionAPI instance
type LoggerProvider ¶
LoggerProvider describes a provider of logger instance.
type ModelAPI ¶
type ModelAPI interface { GetComputeTaskOutputModels(key string) ([]*asset.Model, error) GetModel(key string) (*asset.Model, error) RegisterModels(models []*asset.NewModel, owner string) ([]*asset.Model, error) GetCheckedModel(key string, worker string) (*asset.Model, error) // contains filtered or unexported methods }
type ModelDependencyProvider ¶
type ModelDependencyProvider interface { LoggerProvider persistence.ModelDBALProvider PermissionServiceProvider ComputeTaskServiceProvider ComputePlanServiceProvider FunctionServiceProvider EventServiceProvider TimeServiceProvider }
type ModelService ¶
type ModelService struct {
ModelDependencyProvider
}
func NewModelService ¶
func NewModelService(provider ModelDependencyProvider) *ModelService
func (*ModelService) GetCheckedModel ¶
GetCheckedModel returns the model if it exists and it can be processed by the worker
func (*ModelService) GetComputeTaskOutputModels ¶
func (s *ModelService) GetComputeTaskOutputModels(key string) ([]*asset.Model, error)
func (*ModelService) RegisterModels ¶
type ModelServiceProvider ¶
type ModelServiceProvider interface {
GetModelService() ModelAPI
}
type OrganizationAPI ¶
type OrganizationAPI interface { RegisterOrganization(id string, newOrganization *asset.RegisterOrganizationParam) (*asset.Organization, error) GetAllOrganizations() ([]*asset.Organization, error) GetOrganization(id string) (*asset.Organization, error) }
OrganizationAPI defines the methods to act on Organizations
type OrganizationDependencyProvider ¶
type OrganizationDependencyProvider interface { persistence.OrganizationDBALProvider EventServiceProvider TimeServiceProvider }
OrganizationDependencyProvider defines what the OrganizationService needs to perform its duty
type OrganizationService ¶
type OrganizationService struct {
OrganizationDependencyProvider
}
OrganizationService is the organization manipulation entry point it implements OrganizationAPI
func NewOrganizationService ¶
func NewOrganizationService(provider OrganizationDependencyProvider) *OrganizationService
NewOrganizationService will create a new service with given persistence layer
func (*OrganizationService) GetAllOrganizations ¶
func (s *OrganizationService) GetAllOrganizations() ([]*asset.Organization, error)
GetAllOrganizations list all known organizations
func (*OrganizationService) GetOrganization ¶
func (s *OrganizationService) GetOrganization(id string) (*asset.Organization, error)
GetOrganization returns a Organization by its ID
func (*OrganizationService) RegisterOrganization ¶
func (s *OrganizationService) RegisterOrganization(id string, newOrganization *asset.RegisterOrganizationParam) (*asset.Organization, error)
RegisterOrganization persist a organization
type OrganizationServiceProvider ¶
type OrganizationServiceProvider interface {
GetOrganizationService() OrganizationAPI
}
OrganizationServiceProvider defines an object able to provide a OrganizationAPI instance
type PerformanceAPI ¶
type PerformanceAPI interface { RegisterPerformance(perf *asset.NewPerformance, requester string) (*asset.Performance, error) QueryPerformances(p *common.Pagination, filter *asset.PerformanceQueryFilter) ([]*asset.Performance, common.PaginationToken, error) }
type PerformanceDependencyProvider ¶
type PerformanceDependencyProvider interface { LoggerProvider persistence.PerformanceDBALProvider ComputeTaskServiceProvider FunctionServiceProvider EventServiceProvider TimeServiceProvider }
type PerformanceService ¶
type PerformanceService struct {
PerformanceDependencyProvider
}
func NewPerformanceService ¶
func NewPerformanceService(provider PerformanceDependencyProvider) *PerformanceService
func (*PerformanceService) QueryPerformances ¶
func (s *PerformanceService) QueryPerformances(p *common.Pagination, filter *asset.PerformanceQueryFilter) ([]*asset.Performance, common.PaginationToken, error)
func (*PerformanceService) RegisterPerformance ¶
func (s *PerformanceService) RegisterPerformance(newPerf *asset.NewPerformance, requester string) (*asset.Performance, error)
RegisterPerformance check asset validity and stores a new performance report for the given task. Note that the task key will also be the performance key (1:1 relationship).
type PerformanceServiceProvider ¶
type PerformanceServiceProvider interface {
GetPerformanceService() PerformanceAPI
}
type PermissionAPI ¶
type PermissionAPI interface { CreatePermission(owner string, newPerms *asset.NewPermissions) (*asset.Permission, error) CreatePermissions(owner string, newPerms *asset.NewPermissions) (*asset.Permissions, error) CanProcess(perms *asset.Permissions, requester string) bool IntersectPermissions(x, y *asset.Permissions) *asset.Permissions UnionPermissions(x, y *asset.Permissions) *asset.Permissions IntersectPermission(x, y *asset.Permission) *asset.Permission UnionPermission(x, y *asset.Permission) *asset.Permission }
PermissionAPI defines the methods to act on Permissions
type PermissionDependencyProvider ¶
type PermissionDependencyProvider interface { LoggerProvider OrganizationServiceProvider }
PermissionDependencyProvider defines what the PermissionService needs to perform its duty
type PermissionService ¶
type PermissionService struct {
PermissionDependencyProvider
}
PermissionService is the entry point to manipulate permissions. it implements the API interface
func NewPermissionService ¶
func NewPermissionService(provider PermissionDependencyProvider) *PermissionService
NewPermissionService creates a new service
func (*PermissionService) CanProcess ¶
func (s *PermissionService) CanProcess(perms *asset.Permissions, requester string) bool
func (*PermissionService) CreatePermission ¶
func (s *PermissionService) CreatePermission(owner string, newPerms *asset.NewPermissions) (*asset.Permission, error)
CreatePermission processes a NewPermissions object into a Permission one.
func (*PermissionService) CreatePermissions ¶
func (s *PermissionService) CreatePermissions(owner string, newPerms *asset.NewPermissions) (*asset.Permissions, error)
CreatePermissions processes a NewPermissions object into a Permissions one.
func (*PermissionService) IntersectPermission ¶
func (s *PermissionService) IntersectPermission(x, y *asset.Permission) *asset.Permission
func (*PermissionService) IntersectPermissions ¶
func (s *PermissionService) IntersectPermissions(x, y *asset.Permissions) *asset.Permissions
func (*PermissionService) UnionPermission ¶
func (s *PermissionService) UnionPermission(x, y *asset.Permission) *asset.Permission
func (*PermissionService) UnionPermissions ¶
func (s *PermissionService) UnionPermissions(x, y *asset.Permissions) *asset.Permissions
type PermissionServiceProvider ¶
type PermissionServiceProvider interface {
GetPermissionService() PermissionAPI
}
PermissionServiceProvider defines an object able to provide a PermissionAPI instance.
type ProfilingAPI ¶
type ProfilingAPI interface {
RegisterProfilingStep(function *asset.ProfilingStep) error
}
ProfilingAPI defines the methods to act on Profiling
type ProfilingDependencyProvider ¶
type ProfilingDependencyProvider interface { LoggerProvider EventServiceProvider }
ProfilingDependencyProvider defines what the ProfilingService needs to perform its duty
type ProfilingService ¶
type ProfilingService struct {
ProfilingDependencyProvider
}
ProfilingService is the function manipulation entry point it implements the API interface
func NewProfilingService ¶
func NewProfilingService(provider ProfilingDependencyProvider) *ProfilingService
NewProfilingService will create a new service with given persistence layer
func (*ProfilingService) RegisterProfilingStep ¶
func (s *ProfilingService) RegisterProfilingStep(ps *asset.ProfilingStep) error
RegisterFunction persist an function
type ProfilingServiceProvider ¶
type ProfilingServiceProvider interface {
GetProfilingService() ProfilingAPI
}
ProfilingServiceProvider defines an object able to provide an FunctionAPI instance
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is the central part of the dependency injection pattern. It is injected into each service, so that they can access their dependencies. Services are instanciated as they are required, and reused in subsequent calls. Each service should define a ServiceDependencyProvider interface which states what are its requirements. Since the Provider implements every Provider interface, it can fit all service dependencies.
func NewProvider ¶
func NewProvider(ctx context.Context, dbal persistence.DBAL, time TimeAPI, channel string) *Provider
NewProvider return an instance of Provider based on given persistence layer.
func (*Provider) GetChannel ¶
func (*Provider) GetComputePlanDBAL ¶
func (sc *Provider) GetComputePlanDBAL() persistence.ComputePlanDBAL
GetComputePlanDBAL returns the database abstraction layer for Tasks
func (*Provider) GetComputePlanService ¶
func (sc *Provider) GetComputePlanService() ComputePlanAPI
GetComputePlanService returns a ComputePlanAPI instance. The service will be instanciated if needed.
func (*Provider) GetComputeTaskDBAL ¶
func (sc *Provider) GetComputeTaskDBAL() persistence.ComputeTaskDBAL
GetComputeTaskDBAL returns the database abstraction layer for Tasks
func (*Provider) GetComputeTaskService ¶
func (sc *Provider) GetComputeTaskService() ComputeTaskAPI
GetComputeTaskService returns a ComputeTaskAPI instance. The service will be instanciated if needed.
func (*Provider) GetDataManagerDBAL ¶
func (sc *Provider) GetDataManagerDBAL() persistence.DataManagerDBAL
GetDataManagerDBAL returns the database abstraction layer for DataManagers
func (*Provider) GetDataManagerService ¶
func (sc *Provider) GetDataManagerService() DataManagerAPI
GetDataManagerService returns a DataManagerAPI instance. The service will be instanciated if needed.
func (*Provider) GetDataSampleDBAL ¶
func (sc *Provider) GetDataSampleDBAL() persistence.DataSampleDBAL
GetDataSampleDBAL returns the database abstraction layer for DataSamples
func (*Provider) GetDataSampleService ¶
func (sc *Provider) GetDataSampleService() DataSampleAPI
GetDataSampleService returns a DataSampleAPI instance. The service will be instanciated if needed.
func (*Provider) GetDatasetService ¶
func (sc *Provider) GetDatasetService() DatasetAPI
GetDatasetService returns a DataSampleAPI instance. The service will be instanciated if needed.
func (*Provider) GetEventDBAL ¶
func (sc *Provider) GetEventDBAL() persistence.EventDBAL
func (*Provider) GetEventService ¶
GetEventService returns an EventAPI instance. The service will be instanciated if needed.
func (*Provider) GetFailureReportDBAL ¶
func (sc *Provider) GetFailureReportDBAL() persistence.FailureReportDBAL
func (*Provider) GetFailureReportService ¶
func (sc *Provider) GetFailureReportService() FailureReportAPI
GetFailureReportService returns a FailureAPI instance. The service will be instantiated if needed.
func (*Provider) GetFunctionDBAL ¶
func (sc *Provider) GetFunctionDBAL() persistence.FunctionDBAL
GetFunctionDBAL returns the database abstraction layer for Functions
func (*Provider) GetFunctionService ¶
func (sc *Provider) GetFunctionService() FunctionAPI
GetFunctionService returns an FunctionAPI instance. The service will be instanciated if needed.
func (*Provider) GetModelDBAL ¶
func (sc *Provider) GetModelDBAL() persistence.ModelDBAL
GetModelDBAL returns the database abstraction layer for Tasks
func (*Provider) GetModelService ¶
GetModelService returns a ModelAPI instance. The service will be instanciated if needed.
func (*Provider) GetOrganizationDBAL ¶
func (sc *Provider) GetOrganizationDBAL() persistence.OrganizationDBAL
GetOrganizationDBAL returns the database abstraction layer for Organizations
func (*Provider) GetOrganizationService ¶
func (sc *Provider) GetOrganizationService() OrganizationAPI
GetOrganizationService returns a OrganizationAPI instance. The service will be instanciated if needed.
func (*Provider) GetPerformanceDBAL ¶
func (sc *Provider) GetPerformanceDBAL() persistence.PerformanceDBAL
GetPerformanceDBAL returns the database abstraction layer for Tasks
func (*Provider) GetPerformanceService ¶
func (sc *Provider) GetPerformanceService() PerformanceAPI
GetPerformanceService returns a PerformanceAPI instance. The service will be instanciated if needed.
func (*Provider) GetPermissionService ¶
func (sc *Provider) GetPermissionService() PermissionAPI
GetPermissionService returns a PermissionAPI instance. The service will be instanciated if needed.
func (*Provider) GetProfilingService ¶
func (sc *Provider) GetProfilingService() ProfilingAPI
GetProfilingService returns a ProfilingAPI instance. The service will be instanciated if needed.
func (*Provider) GetTimeService ¶
type TimeService ¶
type TimeService struct {
// contains filtered or unexported fields
}
func NewTimeService ¶
func NewTimeService(t time.Time) *TimeService
func (*TimeService) GetTransactionTime ¶
func (ts *TimeService) GetTransactionTime() time.Time
type TimeServiceProvider ¶
type TimeServiceProvider interface {
GetTimeService() TimeAPI
}