Documentation ¶
Overview ¶
Package retry is the retry server responsible for interacting with GitHub APIs to retry failed events.
Index ¶
- 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 string) (string, error)
- func (bq *BigQuery) WriteCheckpointID(ctx context.Context, checkpointTableID, deliveryID, createdAt string) error
- type CheckpointEntry
- 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 string) (string, error)
- func (f *MockDatastore) WriteCheckpointID(ctx context.Context, checkpointTableID, deliveryID, createdAt string) error
- func (f *MockDatastore) WriteFailureEvent(ctx context.Context, failureEventTableID, deliveryID, createdAt string) error
- type MockGitHub
- type MockLock
- type RetryClientOptions
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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.
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 { GitHubAppID string `env:"GITHUB_APP_ID,required"` GitHubPrivateKey string `env:"GITHUB_PRIVATE_KEY,required"` BigQueryProjectID string `env:"BIG_QUERY_PROJECT_ID,default=$PROJECT_ID"` BucketName string `env:"BUCKET_NAME,required"` CheckpointTableID string `env:"CHECKPOINT_TABLE_ID,required"` EventsTableID string `env:"EVENTS_TABLE_ID,required"` DatasetID string `env:"DATASET_ID,required"` LockTTLClockSkew time.Duration `env:"LOCK_TTL_CLOCK_SKEW,default=10s"` LockTTL time.Duration `env:"LOCK_TTL,default=5m"` ProjectID string `env:"PROJECT_ID,required"` Port string `env:"PORT,default=8080"` }
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 string) (string, error) WriteCheckpointID(ctx context.Context, checkpointTableID, deliveryID, createdAt 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 aheres to the interaction the retyr 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 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 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 }
RetryClientOptions encapsulate client config options as well as dependency implementation overrides.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(ctx context.Context, h *renderer.Renderer, cfg *Config, rco *RetryClientOptions) (*Server, error)
NewServer creates a new HTTP server implementation that will handle communication with GitHub APIs.