core

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobKindSyncResource          = "sync_resource"
	JobKindScheduledSyncResource = "sched_sync_resource"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncWorker

type AsyncWorker interface {
	Enqueue(ctx context.Context, jobs ...worker.Job) error
}

type ModuleService added in v0.1.3

type ModuleService interface {
	PlanAction(ctx context.Context, res module.ExpandedResource, act module.ActionRequest) (*module.Plan, error)
	SyncState(ctx context.Context, res module.ExpandedResource) (*resource.State, error)
	StreamLogs(ctx context.Context, res module.ExpandedResource, filter map[string]string) (<-chan module.LogChunk, error)
	GetOutput(ctx context.Context, res module.ExpandedResource) (json.RawMessage, error)
}

type Service

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

func New

func New(repo resource.Store, moduleSvc ModuleService, asyncWorker AsyncWorker, clockFn func() time.Time, lg *zap.Logger) *Service

func (*Service) ApplyAction

func (s *Service) ApplyAction(ctx context.Context, urn string, act module.ActionRequest) (*resource.Resource, error)

func (*Service) CreateResource

func (s *Service) CreateResource(ctx context.Context, res resource.Resource) (*resource.Resource, error)

func (*Service) DeleteResource

func (s *Service) DeleteResource(ctx context.Context, urn string) error

func (*Service) GetLog

func (s *Service) GetLog(ctx context.Context, urn string, filter map[string]string) (<-chan module.LogChunk, error)

func (*Service) GetResource

func (s *Service) GetResource(ctx context.Context, urn string) (*resource.Resource, error)

func (*Service) GetRevisions added in v0.1.2

func (s *Service) GetRevisions(ctx context.Context, selector resource.RevisionsSelector) ([]resource.Revision, error)

func (*Service) HandleSyncJob

func (s *Service) HandleSyncJob(ctx context.Context, job worker.Job) ([]byte, error)

HandleSyncJob is meant to be invoked by asyncWorker when an enqueued job is ready. TODO: make this private and move the registration of this handler inside New().

func (*Service) ListResources

func (s *Service) ListResources(ctx context.Context, filter resource.Filter) ([]resource.Resource, error)

func (*Service) UpdateResource

func (s *Service) UpdateResource(ctx context.Context, urn string, req resource.UpdateRequest) (*resource.Resource, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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