Documentation
¶
Index ¶
- func ExecuteJob(ctx context.Context, cfg *Config, rco *RetryClientOptions) error
- type AcquireRes
- type BigQuery
- func (bq *BigQuery) Close() error
- func (bq *BigQuery) DeliveryEventExists(ctx context.Context, eventsTableID, deliveryID string) (bool, error)
- func (bq *BigQuery) RetrieveCheckpointID(ctx context.Context, checkpointTableID, githubDomain string) (string, error)
- func (bq *BigQuery) WriteCheckpointID(ctx context.Context, ...) error
- type CheckpointEntry
- type CloseRes
- type Config
- type Datastore
- type GitHubSource
- type MockDatastore
- func (f *MockDatastore) Close() error
- func (f *MockDatastore) DeliveryEventExists(ctx context.Context, eventsTableID, deliveryID string) (bool, error)
- func (f *MockDatastore) RetrieveCheckpointID(ctx context.Context, checkpointTableID, githubDomain string) (string, error)
- func (f *MockDatastore) WriteCheckpointID(ctx context.Context, ...) error
- func (f *MockDatastore) WriteFailureEvent(ctx context.Context, failureEventTableID, deliveryID, createdAt string) error
- type MockGitHub
- type MockLock
- type RetryClientOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteJob ¶ added in v0.3.0
func ExecuteJob(ctx context.Context, cfg *Config, rco *RetryClientOptions) error
ExecuteJob runs the retry job to find and retry failed webhook events.
Types ¶
type AcquireRes ¶ added in v0.3.0
type AcquireRes struct {
Err error
}
type BigQuery ¶
type BigQuery struct {
// contains filtered or unexported fields
}
BigQuery provides a client and dataset identifiers.
func NewBigQuery ¶
func NewBigQuery(ctx context.Context, projectID, datasetID string, opts ...option.ClientOption) (*BigQuery, error)
NewBigQuery creates a new instance of a BigQuery client.
func (*BigQuery) DeliveryEventExists ¶
func (bq *BigQuery) DeliveryEventExists(ctx context.Context, eventsTableID, deliveryID string) (bool, error)
Check if an entry with a given delivery_id already exists in the events table, this attempts to prevent duplicate processing of events.
func (*BigQuery) RetrieveCheckpointID ¶
func (bq *BigQuery) RetrieveCheckpointID(ctx context.Context, checkpointTableID, githubDomain string) (string, error)
Retrieve the latest checkpoint cursor value (deliveryID) in the checkpoint table. This is used by the retry service.
func (*BigQuery) WriteCheckpointID ¶
func (bq *BigQuery) WriteCheckpointID(ctx context.Context, checkpointTableID, deliveryID, createdAt, githubDomain string) error
WriteCheckpointID writes the latest checkpoint that was successfully processed. This is used by the retry service to mark the last successfully processed event.
type CheckpointEntry ¶
type CheckpointEntry struct {
// contains filtered or unexported fields
}
CheckpointEntry is the shape of an entry to the checkpoint table.
type Config ¶
type Config struct {
GitHub githubclient.Config
GitHubDomain string
BigQueryProjectID string
BucketName string
CheckpointTableID string
EventsTableID string
DatasetID string
LockTTLClockSkew time.Duration
LockTTL time.Duration
ProjectID string
Port string
JobTimeout time.Duration
}
Config defines the set of environment variables required for running the retry service.
func (*Config) ToFlags ¶
ToFlags binds the config to the cli.FlagSet and returns it.
type Datastore ¶
type Datastore interface {
RetrieveCheckpointID(ctx context.Context, checkpointTableID, githubDomain string) (string, error)
WriteCheckpointID(ctx context.Context, checkpointTableID, deliveryID, createdAt, githubDomain string) error
DeliveryEventExists(ctx context.Context, eventsTableID, deliveryID string) (bool, error)
Close() error
}
Datastore adheres to the interaction the retry service has with a datastore.
type GitHubSource ¶
type GitHubSource interface {
ListDeliveries(ctx context.Context, opts *github.ListCursorOptions) ([]*github.HookDelivery, *github.Response, error)
RedeliverEvent(ctx context.Context, deliveryID int64) error
}
GitHubSource adheres to the interaction the retry service has with GitHub APIs.
type MockDatastore ¶
type MockDatastore struct {
// contains filtered or unexported fields
}
func (*MockDatastore) Close ¶
func (f *MockDatastore) Close() error
func (*MockDatastore) DeliveryEventExists ¶
func (*MockDatastore) RetrieveCheckpointID ¶
func (*MockDatastore) WriteCheckpointID ¶
func (f *MockDatastore) WriteCheckpointID(ctx context.Context, checkpointTableID, deliveryID, createdAt, githubDomain string) error
func (*MockDatastore) WriteFailureEvent ¶
func (f *MockDatastore) WriteFailureEvent(ctx context.Context, failureEventTableID, deliveryID, createdAt string) error
type MockGitHub ¶
type MockGitHub struct {
// contains filtered or unexported fields
}
func (*MockGitHub) ListDeliveries ¶
func (m *MockGitHub) ListDeliveries(ctx context.Context, opts *github.ListCursorOptions) ([]*github.HookDelivery, *github.Response, error)
func (*MockGitHub) RedeliverEvent ¶
func (m *MockGitHub) RedeliverEvent(ctx context.Context, deliveryID int64) error
type MockLock ¶
type RetryClientOptions ¶
type RetryClientOptions struct {
BigQueryClientOpts []option.ClientOption
GCSLockClientOpts []option.ClientOption
DatastoreClientOverride Datastore // used for unit testing
GCSLockClientOverride gcslock.Lockable // used for unit testing
GitHubOverride GitHubSource // used for unit testing
// GitHubClientCreator is used to create a new GitHub client.
// If nil, githubclient.New is used.
GitHubClientCreator func(context.Context, *githubclient.Config) (GitHubSource, error)
}
RetryClientOptions encapsulate client config options as well as dependency implementation overrides.