codesearch

package
v0.0.0-...-8cd15fe Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: MIT Imports: 49 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 {
	RefreshSchedule string  `yaml:"refresh_schedule,omitempty"`
	Rules           []*Rule `yaml:"rules,omitempty"`
}

func ReadConfig

func ReadConfig(r io.Reader) (*Config, error)

func ReadConfigFile

func ReadConfigFile(p string) (*Config, error)

type IndexGC

type IndexGC struct {
	// contains filtered or unexported fields
}

func NewIndexGC

func NewIndexGC(s StorageClient, bucket string) *IndexGC

func (*IndexGC) GC

func (g *IndexGC) GC(ctx context.Context) error

type Indexer

type Indexer struct {
	Indexes []*RepositoryIndex
	// contains filtered or unexported fields
}

func NewIndexer

func NewIndexer(
	rules *Config,
	workDir, ctags string,
	githubRESTClient *github.Client,
	githubGraphQLClient *githubv4.Client,
	tokenProvider *githubutil.TokenProvider,
	initRun bool,
	parallelism int,
	caBundle []byte,
) *Indexer

func (*Indexer) BuildIndex

func (x *Indexer) BuildIndex(ctx context.Context) error

func (*Indexer) Cleanup

func (x *Indexer) Cleanup(ctx context.Context) error

func (*Indexer) Reset

func (x *Indexer) Reset()

func (*Indexer) Sync

func (x *Indexer) Sync(ctx context.Context) error

type IndexerCommand

type IndexerCommand struct {
	ConfigFile       string
	WorkDir          string
	Ctags            string
	RunScheduler     bool
	InitRun          bool
	WithoutFetch     bool
	DisableCleanup   bool
	Parallelism      int
	HTTPAddr         string
	URLReplaceRegexp []string
	CABundleFile     string

	Bucket                      string
	MinIOEndpoint               string
	MinIORegion                 string
	MinIOName                   string
	MinIONamespace              string
	MinIOPort                   int
	MinIOAccessKey              string
	MinIOSecretAccessKey        string
	S3Endpoint                  string
	S3Region                    string
	S3AccessKey                 string
	S3SecretAccessKey           string
	S3CACertFile                string
	S3PartSize                  uint64
	DisableObjectStorageCleanup bool

	NATSURL        string
	NATSStreamName string
	NATSSubject    string

	Dev bool
	// contains filtered or unexported fields
}

func NewIndexerCommand

func NewIndexerCommand() *IndexerCommand

func (*IndexerCommand) Flags

func (r *IndexerCommand) Flags(fs *cli.FlagSet)

func (*IndexerCommand) Init

func (r *IndexerCommand) Init() error

func (*IndexerCommand) Run

func (r *IndexerCommand) Run() error

func (*IndexerCommand) ValidateFlags

func (r *IndexerCommand) ValidateFlags() error

type Manifest

type Manifest struct {
	CreatedAt time.Time
	// Indexes has Repository.Name and the index path prefix.
	// The key is Repository.Name. The value is the index path prefix.
	Indexes        map[string]string
	ExecutionKey   uint64
	TotalIndexSize uint64
	// contains filtered or unexported fields
}

func NewManifest

func NewManifest(executionKey uint64, indexes map[string]string, totalSize uint64) Manifest

type ManifestManager

type ManifestManager struct {
	// contains filtered or unexported fields
}

func NewManifestManager

func NewManifestManager(backend StorageClient) *ManifestManager

func (*ManifestManager) Delete

func (m *ManifestManager) Delete(ctx context.Context, manifest Manifest) error

func (*ManifestManager) FindExpiredManifests

func (m *ManifestManager) FindExpiredManifests(ctx context.Context) ([]Manifest, error)

func (*ManifestManager) Get

func (m *ManifestManager) Get(ctx context.Context, ts uint64) (Manifest, error)

func (*ManifestManager) GetAll

func (m *ManifestManager) GetAll(ctx context.Context) ([]Manifest, error)

func (*ManifestManager) GetLatest

func (m *ManifestManager) GetLatest(ctx context.Context) (Manifest, error)

func (*ManifestManager) Update

func (m *ManifestManager) Update(ctx context.Context, manifest Manifest) error

type Notify

type Notify struct {
	// contains filtered or unexported fields
}

func NewNotify

func NewNotify(u, streamName, subject string) (*Notify, error)

func (*Notify) Notify

func (n *Notify) Notify(ctx context.Context, manifest *Manifest) error

func (*Notify) Subscribe

func (n *Notify) Subscribe(manifestManager *ManifestManager) (*Subscription, error)

type ObjectStorageIndexManager

type ObjectStorageIndexManager struct {
	// contains filtered or unexported fields
}

func NewObjectStorageIndexManager

func NewObjectStorageIndexManager(s StorageClient, bucket string) *ObjectStorageIndexManager

func (*ObjectStorageIndexManager) Add

func (s *ObjectStorageIndexManager) Add(ctx context.Context, name string, files []string) (string, uint64, error)

func (*ObjectStorageIndexManager) CleanUploadedFiles

func (s *ObjectStorageIndexManager) CleanUploadedFiles(ctx context.Context) error

func (*ObjectStorageIndexManager) Delete

func (s *ObjectStorageIndexManager) Delete(ctx context.Context, manifests []Manifest) error

func (*ObjectStorageIndexManager) Download

func (s *ObjectStorageIndexManager) Download(ctx context.Context, indexDir string, manifest Manifest) error

func (*ObjectStorageIndexManager) ExecutionKey

func (s *ObjectStorageIndexManager) ExecutionKey() uint64

type Repository

type Repository struct {
	Name             string
	URL              string
	DisableVendoring bool
	Refs             []plumbing.ReferenceName
	CABundle         []byte
	// contains filtered or unexported fields
}

func NewRepository

func NewRepository(name, url string, refs []plumbing.ReferenceName, disableVendoring bool, caBundle []byte) *Repository

type RepositoryIndex

type RepositoryIndex struct {
	Name  string
	Files []string
}

func NewRepositoryIndex

func NewRepositoryIndex(name, indexDir string) (*RepositoryIndex, error)

type RepositoryLister

type RepositoryLister struct {
	// contains filtered or unexported fields
}

func NewRepositoryLister

func NewRepositoryLister(rules []*Rule, restClient *github.Client, graphqlClient *githubv4.Client, caBundle []byte) *RepositoryLister

func (*RepositoryLister) ClearCache

func (x *RepositoryLister) ClearCache()

func (*RepositoryLister) List

func (x *RepositoryLister) List(ctx context.Context) []*Repository

type RepositoryListerOpt

type RepositoryListerOpt func(lister *RepositoryLister) error

type RepositorySchema

type RepositorySchema struct {
	Name  string
	Owner struct {
		Login string
	}
	URL        githubv4.URI
	IsArchived bool
}

type Rule

type Rule struct {
	Owner    string   `yaml:"owner,omitempty"`
	Name     string   `yaml:"name,omitempty"`
	Query    string   `yaml:"query,omitempty"`
	Branches []string `yaml:"branches,omitempty"`
	Tags     []string `yaml:"tags,omitempty"`

	URLReplace string `yaml:"url_replace"`

	DisableVendoring bool `yaml:"disable_vendoring"`
	// contains filtered or unexported fields
}

type StorageClient

type StorageClient interface {
	Name() string
	Get(context.Context, string) (*storage.Object, error)
	Delete(context.Context, string) error
	Put(context.Context, string, []byte) error
	PutReader(context.Context, string, io.Reader) error
	List(context.Context, string) ([]*storage.Object, error)
}

type Subscription

type Subscription struct {
	// contains filtered or unexported fields
}

func (*Subscription) Close

func (s *Subscription) Close()

type UpdaterCommand

type UpdaterCommand struct {
	IndexDir  string
	Subscribe bool
	HTTPAddr  string

	Bucket               string
	MinIOEndpoint        string
	MinIORegion          string
	MinIOName            string
	MinIONamespace       string
	MinIOPort            int
	MinIOAccessKey       string
	MinIOSecretAccessKey string
	S3Endpoint           string
	S3Region             string
	S3AccessKey          string
	S3SecretAccessKey    string
	S3CACertFile         string

	NATSURL        string
	NATSStreamName string
	NATSSubject    string

	Dev bool
	// contains filtered or unexported fields
}

func NewUpdaterCommand

func NewUpdaterCommand() *UpdaterCommand

func (*UpdaterCommand) Collect

func (u *UpdaterCommand) Collect(ch chan<- prometheus.Metric)

func (*UpdaterCommand) Describe

func (u *UpdaterCommand) Describe(desc chan<- *prometheus.Desc)

func (*UpdaterCommand) Flags

func (u *UpdaterCommand) Flags(fs *pflag.FlagSet)

func (*UpdaterCommand) Run

func (u *UpdaterCommand) Run() error

Jump to

Keyboard shortcuts

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