Documentation ¶
Index ¶
- Constants
- Variables
- func CheckWorkerTimeout(event *api.Event)
- func DeleteEvent(id string) error
- func GetEvent(id string) (*api.Event, error)
- func Init(wopts *cloud.WorkerOptions, cloudAutoDiscovery bool)
- func IsEventFinished(event *api.Event) bool
- func Resource2Quota(resource api.BuildResource, def cloud.Quota) cloud.Quota
- func SendCreateServiceEvent(service *api.Service) error
- func SendCreateVersionEvent(service *api.Service, version *api.Version) error
- func UpdateEvent(event *api.Event) error
- type EventManager
- type Handler
- type Operation
- type PostHook
Constants ¶
const ( // CreateServiceOps defines the operation to create a service, currently it // involves: clone repository (to check if repository exists). CreateServiceOps api.Operation = "create-service" // CreateVersionOps defines the operation to create a version, currently it // involves: clone repository, run CI if caicloud.yml exists and the operation // field in the version is not "Publish", thern tag it based on version name, // build docker image and push to caicloud registry, then run the postbuild // hook. CreateVersionOps api.Operation = "create-version" // CreateProjectVersionOps defines the operation to create a project version. CreateProjectVersionOps api.Operation = "create-projectversion" // PostStartPhase hooks phase PostStartPhase = "postStart" // PreStopPhase hooks phase PreStopPhase = "preStop" )
Variables ¶
var (
CloudController *cloud.Controller
)
Functions ¶
func DeleteEvent ¶
DeleteEvent deletes the event. If it is running, delete its worker at the same time.
func Init ¶
func Init(wopts *cloud.WorkerOptions, cloudAutoDiscovery bool)
Init init event manager Step1: init cloud controller Step2: init event operation map Step3: new event manager Step4: create a goroutine to watch events Step5: new a remote api manager
func IsEventFinished ¶
IsEventFinished return true if event is finished.
func Resource2Quota ¶
Resource2Quota TODO: FIXME
func SendCreateServiceEvent ¶
SendCreateServiceEvent is a helper method which sends a create service event in MongoDB and wait for the event to be acked.
func SendCreateVersionEvent ¶
SendCreateVersionEvent is a helper method which sends a create version event in MongoDB and wait for the event to be acked.
func UpdateEvent ¶
UpdateEvent updates the event. If it is finished, delete it and trigger the post hook.
Types ¶
type EventManager ¶
EventManager represents the manager of events.
func NewEventManager ¶
func NewEventManager(ds *store.DataStore) EventManager
NewEventManager creates the event manager.