Documentation
¶
Overview ¶
Package lro provides Long Running Operation (LRO) background processing.
Index ¶
- Constants
- func StateToString(state pb.Process_Status_State) string
- type LRO
- type Service
- func (s *Service) AddRealmRemoval(id, realm string, identity *ga4gh.Identity, tx storage.Tx) (*pb.Process_Work, error)
- func (s *Service) CleanupWork(ctx context.Context, state *pb.Process, workName string, ...) error
- func (s *Service) ProcessActiveWork(ctx context.Context, state *pb.Process, workName string, work *pb.Process_Work, ...) error
- func (s *Service) Remove(id string, tx storage.Tx) error
- func (s *Service) Run(ctx context.Context)
- func (s *Service) Wait(ctx context.Context, schedule time.Duration) bool
- func (s *Service) WaitCondition(fn func(ctx context.Context, duration time.Duration) bool)
Constants ¶
const ( // Active indicates the item is in the queue to be processed, or is being processed. Active = "active" // Inactive indicates the item has been ABORTED or COMPLETED Inactive = "inactive" )
Variables ¶
This section is empty.
Functions ¶
func StateToString ¶
func StateToString(state pb.Process_Status_State) string
StateToString offers a human-readable label for a State enum.
Types ¶
type LRO ¶
type LRO interface { AddRealmRemoval(id, realm string, identity *ga4gh.Identity, tx storage.Tx) (*pb.Process_Work, error) Remove(id string, tx storage.Tx) error Run(ctx context.Context) }
LRO is an interface for long running operations.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a long running operation service.
func New ¶
func New(name string, wakeFrequency, maxProgress time.Duration, store storage.Store, tx storage.Tx) (*Service, error)
New creates a new LRO processing routine that holds multiple LROs that share the same setup parameters.
func (*Service) AddRealmRemoval ¶
func (s *Service) AddRealmRemoval(id, realm string, identity *ga4gh.Identity, tx storage.Tx) (*pb.Process_Work, error)
AddRealmRemoval adds a LRO work item for the stated goal to the state for workers to process.
func (*Service) CleanupWork ¶
func (s *Service) CleanupWork(ctx context.Context, state *pb.Process, workName string, process *processlib.Process) error
CleanupWork has a worker perform the work needed to clean up a work item that was active previously.
func (*Service) ProcessActiveWork ¶
func (s *Service) ProcessActiveWork(ctx context.Context, state *pb.Process, workName string, work *pb.Process_Work, process *processlib.Process) error
ProcessActiveWork has a worker perform the work needed to process an active work item.
func (*Service) Remove ¶
Remove deletes one LRO work item from the active queue or inactive list. It does not provide any cleanup if the state is partial. Depending on execution, this deletion could later be rewritten by an active processing agent, so deleting is a best effort.
func (*Service) Run ¶
Run schedules a background process. Typically this will be on its own go routine.