Documentation ¶
Index ¶
- Constants
- Variables
- func NewCommitCommentSubscriber(topic, subscriberLabel string, ts oauth2.TokenSource, ...) (context.CancelFunc, error)
- func NewJobSubscriber(topic, subscriberLabel string, ts oauth2.TokenSource, ...) (context.CancelFunc, error)
- func NewModifiedComments(taskCommentsTopic, taskSpecCommentsTopic, commitCommentsTopic string, ...) (db.ModifiedComments, error)
- func NewModifiedData(topicSet, label string, ts oauth2.TokenSource) (db.ModifiedData, error)
- func NewModifiedJobs(topic, label string, ts oauth2.TokenSource) (db.ModifiedJobs, error)
- func NewModifiedTasks(topic, label string, ts oauth2.TokenSource) (db.ModifiedTasks, error)
- func NewTaskCommentSubscriber(topic, subscriberLabel string, ts oauth2.TokenSource, ...) (context.CancelFunc, error)
- func NewTaskSpecCommentSubscriber(topic, subscriberLabel string, ts oauth2.TokenSource, ...) (context.CancelFunc, error)
- func NewTaskSubscriber(topic, subscriberLabel string, ts oauth2.TokenSource, ...) (context.CancelFunc, error)
- type CommitCommentPublisher
- type JobPublisher
- type TaskCommentPublisher
- type TaskPublisher
- type TaskSpecCommentPublisher
Constants ¶
const ( // Auth scope. AUTH_SCOPE = pubsub.ScopePubSub // Default project ID. PROJECT_ID = "skia-public" // Sets of topic, based on scheduler instance. TOPIC_SET_PROD = "prod" TOPIC_SET_INTERNAL = "internal" TOPIC_SET_STAGING = "staging" // Known topic names. TOPIC_TASKS = "task-scheduler-modified-tasks" TOPIC_TASKS_INTERNAL = "task-scheduler-modified-tasks-internal" TOPIC_TASKS_STAGING = "task-scheduler-modified-tasks-staging" TOPIC_JOBS = "task-scheduler-modified-jobs" TOPIC_JOBS_INTERNAL = "task-scheduler-modified-jobs-internal" TOPIC_JOBS_STAGING = "task-scheduler-modified-jobs-staging" TOPIC_TASK_COMMENTS = "task-scheduler-modified-task-comments" TOPIC_TASK_COMMENTS_INTERNAL = "task-scheduler-modified-task-comments-internal" TOPIC_TASK_COMMENTS_STAGING = "task-scheduler-modified-task-comments-staging" TOPIC_TASKSPEC_COMMENTS = "task-scheduler-modified-taskspec-comments" TOPIC_TASKSPEC_COMMENTS_INTERNAL = "task-scheduler-modified-taskspec-comments-internal" TOPIC_TASKSPEC_COMMENTS_STAGING = "task-scheduler-modified-taskspec-comments-staging" TOPIC_COMMIT_COMMENTS = "task-scheduler-modified-commit-comments" TOPIC_COMMIT_COMMENTS_INTERNAL = "task-scheduler-modified-commit-comments-internal" TOPIC_COMMIT_COMMENTS_STAGING = "task-scheduler-modified-commit-comments-staging" // Job or task ID. ATTR_ID = "id" // Modification or insertion timestamp of the contained data. ATTR_TIMESTAMP = "ts" // Unique identifier for the sender of the message. ATTR_SENDER_ID = "sender" )
Variables ¶
var ( VALID_TOPIC_SETS = []string{ TOPIC_SET_PROD, TOPIC_SET_INTERNAL, TOPIC_SET_STAGING, } )
Functions ¶
func NewCommitCommentSubscriber ¶
func NewCommitCommentSubscriber(topic, subscriberLabel string, ts oauth2.TokenSource, callback func(*types.CommitComment) error) (context.CancelFunc, error)
NewCommitCommentSubscriber creates a subscriber which calls the given callback function for every pubsub message. The topic should be one of the TOPIC_* constants defined in this package. The subscriberLabel is included in the subscription ID, along with a timestamp; this should help to debug zombie subscriptions. Acknowledgement of the message is done automatically based on the return value of the callback: if the callback returns an error, the message is Nack'd and will be re-sent at a later time, otherwise the message is Ack'd and will not be re-sent. Therefore, if the comment is not valid or otherwise cannot ever be processed, the callback should return nil to prevent the message from being re-sent.
func NewJobSubscriber ¶
func NewJobSubscriber(topic, subscriberLabel string, ts oauth2.TokenSource, callback func(*types.Job) error) (context.CancelFunc, error)
NewJobSubscriber creates a subscriber which calls the given callback function for every pubsub message. The topic should be one of the TOPIC_* constants defined in this package. The subscriberLabel is included in the subscription ID, along with a timestamp; this should help to debug zombie subscriptions. Acknowledgement of the message is done automatically based on the return value of the callback: if the callback returns an error, the message is Nack'd and will be re-sent at a later time, otherwise the message is Ack'd and will not be re-sent. Therefore, if the job is not valid or otherwise cannot ever be processed, the callback should return nil to prevent the message from being re-sent.
func NewModifiedComments ¶
func NewModifiedComments(taskCommentsTopic, taskSpecCommentsTopic, commitCommentsTopic string, label string, ts oauth2.TokenSource) (db.ModifiedComments, error)
NewModifiedComments returns a db.ModifiedComments which uses pubsub. The topics should be one of the sets of TOPIC_* constants defined in this package. The subscriberLabel is included in the subscription ID, along with a timestamp; this should help to debug zombie subscriptions. It should be descriptive and unique to this process, or if the process uses multiple instances of ModifiedJobs, unique to each instance.
func NewModifiedData ¶
func NewModifiedData(topicSet, label string, ts oauth2.TokenSource) (db.ModifiedData, error)
NewModifiedData returns a db.ModifiedData instance which uses pubsub.
func NewModifiedJobs ¶
func NewModifiedJobs(topic, label string, ts oauth2.TokenSource) (db.ModifiedJobs, error)
NewModifiedJobs returns a db.ModifiedJobs which uses pubsub. The topic should be one of the TOPIC_* constants defined in this package. The subscriberLabel is included in the subscription ID, along with a timestamp; this should help to debug zombie subscriptions. It should be descriptive and unique to this process, or if the process uses multiple instances of ModifiedJobs, unique to each instance.
func NewModifiedTasks ¶
func NewModifiedTasks(topic, label string, ts oauth2.TokenSource) (db.ModifiedTasks, error)
NewModifiedTasks returns a db.ModifiedTasks which uses pubsub. The topic should be one of the TOPIC_* constants defined in this package. The subscriberLabel is included in the subscription ID, along with a timestamp; this should help to debug zombie subscriptions. It should be descriptive and unique to this process, or if the process uses multiple instances of ModifiedTasks, unique to each instance.
func NewTaskCommentSubscriber ¶
func NewTaskCommentSubscriber(topic, subscriberLabel string, ts oauth2.TokenSource, callback func(*types.TaskComment) error) (context.CancelFunc, error)
NewTaskCommentSubscriber creates a subscriber which calls the given callback function for every pubsub message. The topic should be one of the TOPIC_* constants defined in this package. The subscriberLabel is included in the subscription ID, along with a timestamp; this should help to debug zombie subscriptions. Acknowledgement of the message is done automatically based on the return value of the callback: if the callback returns an error, the message is Nack'd and will be re-sent at a later time, otherwise the message is Ack'd and will not be re-sent. Therefore, if the comment is not valid or otherwise cannot ever be processed, the callback should return nil to prevent the message from being re-sent.
func NewTaskSpecCommentSubscriber ¶
func NewTaskSpecCommentSubscriber(topic, subscriberLabel string, ts oauth2.TokenSource, callback func(*types.TaskSpecComment) error) (context.CancelFunc, error)
NewTaskSpecCommentSubscriber creates a subscriber which calls the given callback function for every pubsub message. The topic should be one of the TOPIC_* constants defined in this package. The subscriberLabel is included in the subscription ID, along with a timestamp; this should help to debug zombie subscriptions. Acknowledgement of the message is done automatically based on the return value of the callback: if the callback returns an error, the message is Nack'd and will be re-sent at a later time, otherwise the message is Ack'd and will not be re-sent. Therefore, if the comment is not valid or otherwise cannot ever be processed, the callback should return nil to prevent the message from being re-sent.
func NewTaskSubscriber ¶
func NewTaskSubscriber(topic, subscriberLabel string, ts oauth2.TokenSource, callback func(*types.Task) error) (context.CancelFunc, error)
NewTaskSubscriber creates a subscriber which calls the given callback function for every pubsub message. The topic should be one of the TOPIC_* constants defined in this package. The subscriberLabel is included in the subscription ID, along with a timestamp; this should help to debug zombie subscriptions. Acknowledgement of the message is done automatically based on the return value of the callback: if the callback returns an error, the message is Nack'd and will be re-sent at a later time, otherwise the message is Ack'd and will not be re-sent. Therefore, if the task is not valid or otherwise cannot ever be processed, the callback should return nil to prevent the message from being re-sent.
Types ¶
type CommitCommentPublisher ¶
type CommitCommentPublisher struct {
// contains filtered or unexported fields
}
CommitCommentPublisher sends pubsub messages for comments.
func NewCommitCommentPublisher ¶
func NewCommitCommentPublisher(topic string, ts oauth2.TokenSource) (*CommitCommentPublisher, error)
NewCommitCommentPublisher creates a CommitCommentPublisher instance. It creates the given topic if it does not already exist.
func (*CommitCommentPublisher) Publish ¶
func (p *CommitCommentPublisher) Publish(t *types.CommitComment)
Publish publishes a pubsub message for the given comment.
type JobPublisher ¶
type JobPublisher struct {
// contains filtered or unexported fields
}
JobPublisher sends pubsub messages for modified jobs.
func NewJobPublisher ¶
func NewJobPublisher(topic string, ts oauth2.TokenSource) (*JobPublisher, error)
NewJobPublisher creates a JobPublisher instance. It creates the given topic if it does not already exist.
func (*JobPublisher) Publish ¶
func (p *JobPublisher) Publish(j *types.Job)
Publish publishes a pubsub message for the given job.
type TaskCommentPublisher ¶
type TaskCommentPublisher struct {
// contains filtered or unexported fields
}
TaskCommentPublisher sends pubsub messages for comments.
func NewTaskCommentPublisher ¶
func NewTaskCommentPublisher(topic string, ts oauth2.TokenSource) (*TaskCommentPublisher, error)
NewTaskCommentPublisher creates a TaskCommentPublisher instance. It creates the given topic if it does not already exist.
func (*TaskCommentPublisher) Publish ¶
func (p *TaskCommentPublisher) Publish(t *types.TaskComment)
Publish publishes a pubsub message for the given comment.
type TaskPublisher ¶
type TaskPublisher struct {
// contains filtered or unexported fields
}
TaskPublisher sends pubsub messages for modified tasks.
func NewTaskPublisher ¶
func NewTaskPublisher(topic string, ts oauth2.TokenSource) (*TaskPublisher, error)
NewTaskPublisher creates a TaskPublisher instance. It creates the given topic if it does not already exist.
func (*TaskPublisher) Publish ¶
func (p *TaskPublisher) Publish(t *types.Task)
Publish publishes a pubsub message for the given task.
type TaskSpecCommentPublisher ¶
type TaskSpecCommentPublisher struct {
// contains filtered or unexported fields
}
TaskSpecCommentPublisher sends pubsub messages for comments.
func NewTaskSpecCommentPublisher ¶
func NewTaskSpecCommentPublisher(topic string, ts oauth2.TokenSource) (*TaskSpecCommentPublisher, error)
NewTaskSpecCommentPublisher creates a TaskSpecCommentPublisher instance. It creates the given topic if it does not already exist.
func (*TaskSpecCommentPublisher) Publish ¶
func (p *TaskSpecCommentPublisher) Publish(t *types.TaskSpecComment)
Publish publishes a pubsub message for the given comment.