cache

package
v0.0.0-...-5f0dc1b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2024 License: CC0-1.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Event

func Event(targetRepositoryID string, event *api.WebhookEvent) error

func InitCache

func InitCache(repositoryIDs string, redisConfig *RedisConfig) []string

func InternalEvent

func InternalEvent(targetRepositoryID string, eventBodyBytes []byte, headers http.Header) (bool, error)

func NewInMemoryStore

func NewInMemoryStore() *inMemoryStore

func NewRedisStore

func NewRedisStore(config *RedisConfig) *redisStore

func PrepareForShutdown

func PrepareForShutdown()

TODO should probably have some logic for closing the stores for example, disconnecting the Redis client if it is connected

Types

type EventStore

type EventStore interface {
	Store(repositoryId string, event *api.WebhookEventInternal) bool
	Remove(repositoryId string, event *api.WebhookEventInternal) bool
	RetrieveEventsForRepository(repositoryId string) []*api.WebhookEventInternal
	CountEventsForRepository(repositoryId string) int
	IsConnected() bool
}
var Store EventStore

type RedisConfig

type RedisConfig struct {
	Host     string
	Port     string
	Password string
	Database string
}

type RepositoryWatcher

type RepositoryWatcher struct {
	Repositories []string
}
var Repositories RepositoryWatcher

func (*RepositoryWatcher) AddRepository

func (r *RepositoryWatcher) AddRepository(repositoryId string)

func (*RepositoryWatcher) ReportWatchedRepositories

func (r *RepositoryWatcher) ReportWatchedRepositories()

func (*RepositoryWatcher) RepositoryIsWatched

func (r *RepositoryWatcher) RepositoryIsWatched(repositoryID string) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL