repository

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateMessage

type CreateMessage any

type Entity

type Entity any

type Image

type Image interface {
	Repository[*metal.Image, *apiv2.Image, *adminv2.ImageServiceCreateRequest, *adminv2.ImageServiceUpdateRequest, *apiv2.ImageQuery]
	GetMostRecentImageFor(id string, images []*metal.Image) (*metal.Image, error)
	SortImages(images []*metal.Image) []*metal.Image
}

type Message

type Message any

type ProjectScope

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

type Query

type Query any

type Repository

type Repository[E Entity, M Message, C CreateMessage, U UpdateMessage, Q Query] interface {
	Get(ctx context.Context, id string) (E, error)

	ValidateCreate(ctx context.Context, create C) (*Validated[C], error)
	Create(ctx context.Context, c *Validated[C]) (E, error)

	ValidateUpdate(ctx context.Context, msg U) (*Validated[U], error)
	Update(ctx context.Context, msg *Validated[U]) (E, error)

	ValidateDelete(ctx context.Context, e E) (*Validated[E], error)
	Delete(ctx context.Context, e *Validated[E]) (E, error)

	Find(ctx context.Context, query Q) (E, error)
	List(ctx context.Context, query Q) ([]E, error)

	ConvertToInternal(msg M) (E, error)
	ConvertToProto(e E) (M, error)

	MatchScope(e E) error
}

type Store

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

func New

func New(log *slog.Logger, mdc mdm.Client, ds generic.Datastore, ipam ipamv1connect.IpamServiceClient, redis *redis.Client) (*Store, error)

func (*Store) FilesystemLayout

func (r *Store) FilesystemLayout() FilesystemLayout

func (*Store) IP

func (r *Store) IP(project string) IP

func (*Store) Image

func (r *Store) Image() Image

func (*Store) IpDeleteHandleFn

func (r *Store) IpDeleteHandleFn(ctx context.Context, t *asynq.Task) error

func (*Store) Network

func (r *Store) Network(project string) Network

func (*Store) NetworkDeleteHandleFn added in v0.0.3

func (r *Store) NetworkDeleteHandleFn(ctx context.Context, t *asynq.Task) error

NetworkDeleteHandleFn is called async to ensure all dependent entities are deleted Async deletion must be scheduled by async.NewNetworkDeleteTask

func (*Store) Partition

func (r *Store) Partition() Partition

func (*Store) Project

func (r *Store) Project(project string) Project

func (*Store) Tenant

func (r *Store) Tenant() Tenant

func (*Store) UnscopedIP

func (r *Store) UnscopedIP() IP

func (*Store) UnscopedNetwork

func (r *Store) UnscopedNetwork() Network

func (*Store) UnscopedProject

func (r *Store) UnscopedProject() Project

type UpdateMessage

type UpdateMessage any

type Validated

type Validated[M any] struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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