synchronization

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enable     bool
	StorageDir string
	Repository []*Repository
}

Config defines the config structure

func NewConfig

func NewConfig() *Config

NewConfig is used to init config with default values

func (*Config) IsEnabled

func (c *Config) IsEnabled() bool

IsEnabled is used to return whether the current component is enabled This attribute is required in pluggable components

func (*Config) RegisterFlagsWithPrefix

func (c *Config) RegisterFlagsWithPrefix(prefix string, f *pflag.FlagSet)

RegisterFlags is used to register flags

func (*Config) Validate

func (c *Config) Validate() error

Validate is used to validate config and returns error on failure

type Repository

type Repository struct {
	Address string
	Branch  string
}

type Service

type Service struct {
	logger.Logger
	// contains filtered or unexported fields
}

func New

func New(cfg *Config, logger logger.Logger, registerer prometheus.Registerer) (*Service, error)

New is used to init service

func (*Service) Start

func (s *Service) Start(ctx context.Context, cancelFunc context.CancelFunc) error

Start is used to start the service

func (*Service) Synchronize

func (s *Service) Synchronize(ctx context.Context, callback func(repository string, updated bool, err error) error) error

func (*Service) SynchronizeRepository

func (s *Service) SynchronizeRepository(ctx context.Context, repository string, branch string, location string) (updated bool, err error)

Jump to

Keyboard shortcuts

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