repository

package
v0.0.41 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	// QueueEvent - Called when a new event is received. If store is true, the event should be stored in the database.
	// Note: Avoid performing any long-running operations in this function.
	QueueEvent(event *eventv1.EventPayload, store bool) error

	// Started - Returns true if the handler has started.
	Started() bool

	// Start - Called when the handler should start processing events.
	// This is your chance to set up any resources, e.g., database connections, run loops, etc.
	// This will only be called once.
	Start(context.Context)

	// Stop - Called when the handler should stop processing events and clean up resources.
	Stop()
}

Handler - Interface for handling events for a repository.

type HandlerParams

type HandlerParams struct {
	Dir           string
	Bucket        *blob.Bucket
	RemoteOptions []remote.Option
	NameOptions   []name.Option

	BeskarMeta *gossip.BeskarMeta
	Sync       config.SyncConfig
	// contains filtered or unexported fields
}

func (HandlerParams) GetBeskarRegistryHostPort added in v0.0.21

func (hp HandlerParams) GetBeskarRegistryHostPort() string

func (HandlerParams) GetBeskarServiceHostPort added in v0.0.21

func (hp HandlerParams) GetBeskarServiceHostPort() string

func (HandlerParams) Remove

func (hp HandlerParams) Remove(repository string)

type Manager

type Manager[H Handler] struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager[H Handler](
	params *HandlerParams,
	newHandler func(*slog.Logger, *RepoHandler) H,
) *Manager[H]

func (*Manager[H]) Get

func (m *Manager[H]) Get(ctx context.Context, repository string) H

func (*Manager[H]) GetAll

func (m *Manager[H]) GetAll() map[string]H

func (*Manager[H]) Has

func (m *Manager[H]) Has(repository string) bool

type RepoHandler

type RepoHandler struct {
	Repository string
	Params     *HandlerParams

	Queued chan struct{}

	Stopped atomic.Bool
	// contains filtered or unexported fields
}

RepoHandler - A partial default implementation of the Handler interface that provides some common functionality. You can embed this in your own handler to get some default functionality, e.g., an event queue.

func NewRepoHandler

func NewRepoHandler(repository string, params *HandlerParams, cancel context.CancelFunc) *RepoHandler

func (*RepoHandler) DeleteManifest added in v0.0.9

func (rh *RepoHandler) DeleteManifest(ref string) (errFn error)

func (*RepoHandler) DequeueEvents

func (rh *RepoHandler) DequeueEvents() []*eventv1.EventPayload

func (*RepoHandler) DownloadBlob

func (rh *RepoHandler) DownloadBlob(ref string, destinationPath string) (errFn error)

func (*RepoHandler) EnqueueEvent

func (rh *RepoHandler) EnqueueEvent(event *eventv1.EventPayload)

func (*RepoHandler) EventQueueLength

func (rh *RepoHandler) EventQueueLength() int

func (*RepoHandler) EventQueueUpdate

func (rh *RepoHandler) EventQueueUpdate()

func (*RepoHandler) GetManifestDigest added in v0.0.9

func (rh *RepoHandler) GetManifestDigest(ref string) (string, error)

func (*RepoHandler) PullManifest added in v0.0.21

func (rh *RepoHandler) PullManifest(ref string) (errFn error)

func (*RepoHandler) Started

func (rh *RepoHandler) Started() bool

func (*RepoHandler) Stop

func (rh *RepoHandler) Stop()

func (*RepoHandler) SyncArtifact added in v0.0.18

func (rh *RepoHandler) SyncArtifact(ctx context.Context, name string, timeout time.Duration) (chan error, func() error)

func (*RepoHandler) SyncArtifactReset added in v0.0.18

func (rh *RepoHandler) SyncArtifactReset()

func (*RepoHandler) SyncArtifactResult added in v0.0.18

func (rh *RepoHandler) SyncArtifactResult(name string, err error)

Jump to

Keyboard shortcuts

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