Documentation ¶
Index ¶
Constants ¶
const ( // Auth scope required to use this package. AUTH_SCOPE = pubsub.ScopePubSub // Template used for building pubsub topic names. TOPIC_TMPL = "gitstore-%s-%s-%d" )
Variables ¶
This section is empty.
Functions ¶
func NewSubscriber ¶
func NewSubscriber(ctx context.Context, btConf *bt_gitstore.BTConfig, subscriberID string, repoID int64, ts oauth2.TokenSource, callback func(*pubsub.Message, map[string]string)) error
NewSubscriber creates a pubsub subscription associated with the given GitStore and calls the given function whenever a message is received. The parameters to the callback function are the message itself and the branch heads as of the time that the message was sent, with names as keys and commit hashes as values. The callback function is responsible for calling Ack() or Nack() on the message.
Types ¶
type AutoUpdateCallback ¶
AutoUpdateCallback is a callback function used in UpdateUsingPubSub which is called after the Graph is updated but before the changes are committed. If the callback returns an error, the changes are not committed. In addition to the Graph itself, the callback accepts two functions as parameters, ack and nack, which in turn call the Ack() or Nack() functions on the pubsub message(s) which triggered the update. The callback function should call one of them to ensure that the message(s) get redelivered or not, as desired.
type AutoUpdateMap ¶
AutoUpdateMap is a wrapper around repograph.Map which provides a convenience method for auto-updating the Graphs in the Map.
func NewAutoUpdateMap ¶
func NewAutoUpdateMap(ctx context.Context, repoUrls []string, btConf *bt_gitstore.BTConfig) (*AutoUpdateMap, error)
NewBTGitStoreMap is a wrapper around bt_gitstore.NewBTGitStoreMap which provides a convenience method for auto-updating the Graphs in the Map.
func (*AutoUpdateMap) Start ¶
func (m *AutoUpdateMap) Start(ctx context.Context, subscriberID string, ts oauth2.TokenSource, fallbackInterval time.Duration, callback AutoUpdateMapCallback) error
Start initializes auto-updating of the AutoUpdateMap.
type AutoUpdateMapCallback ¶
type AutoUpdateMapCallback func(ctx context.Context, repoUrl string, g *repograph.Graph, ack, nack func()) error
AutoUpdateMapCallback is like AutoUpdateCallback, except that it's handed to NewAutoUpdateMap.Start() and also includes the repo URL.
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
Publisher is a struct used for publishing pubsub messages for a GitStore.
func NewPublisher ¶
func NewPublisher(ctx context.Context, btConf *bt_gitstore.BTConfig, repoID int64, ts oauth2.TokenSource) (*Publisher, error)
NewPublisher returns a Publisher instance associated with the given GitStore.