repository

package
v1.0.0-alpha1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 3 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package repository reads and writes Slurm clusters, their partitions, and the login configs users reach them through.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterPartitionRepository

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

ClusterPartitionRepository reads and writes partitions.

func NewClusterPartitionRepository

func NewClusterPartitionRepository(db *gorm.DB) *ClusterPartitionRepository

NewClusterPartitionRepository returns a repository backed by db.

func (*ClusterPartitionRepository) Delete

Delete removes a partition.

func (*ClusterPartitionRepository) FindByClusterID

func (r *ClusterPartitionRepository) FindByClusterID(ctx context.Context, clusterID string) ([]model.ClusterPartition, error)

FindByClusterID returns every partition of one cluster.

func (*ClusterPartitionRepository) FindByIDAndClusterID

func (r *ClusterPartitionRepository) FindByIDAndClusterID(ctx context.Context, partitionID, clusterID string) (*model.ClusterPartition, error)

FindByIDAndClusterID looks a partition up within one cluster.

Scoping the lookup by cluster is deliberate: it stops a partition id belonging to one cluster from being reached through another cluster's path.

func (*ClusterPartitionRepository) Save

Save inserts or updates a partition.

func (*ClusterPartitionRepository) WithTx

WithTx returns a repository bound to tx.

type SlurmClusterConfigRepository

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

SlurmClusterConfigRepository reads and writes cluster login configs.

Reads preload the cluster and the key summary because the response DTO carries both: a config without the machine it logs in to, and without which key it presents, is not much use to a caller deciding whether to launch through it.

func NewSlurmClusterConfigRepository

func NewSlurmClusterConfigRepository(db *gorm.DB) *SlurmClusterConfigRepository

NewSlurmClusterConfigRepository returns a repository backed by db.

func (*SlurmClusterConfigRepository) CountByKeyID

func (r *SlurmClusterConfigRepository) CountByKeyID(ctx context.Context, keyID string) (int64, error)

CountByKeyID reports how many configs still present one SSH credential. The credentials vertical asks before deleting a key: the foreign key is RESTRICT, so without this the delete would fail as an opaque constraint violation rather than a 409 naming what still holds it.

func (*SlurmClusterConfigRepository) Delete

Delete removes a config.

func (*SlurmClusterConfigRepository) FindAll

FindAll returns every config.

func (*SlurmClusterConfigRepository) FindByID

FindByID returns one config, or gorm.ErrRecordNotFound.

func (*SlurmClusterConfigRepository) FindByIDsExcludingOwner

func (r *SlurmClusterConfigRepository) FindByIDsExcludingOwner(ctx context.Context, ids []string, userID string) ([]model.SlurmClusterConfig, error)

FindByIDsExcludingOwner returns the configs named by ids that userID does not own.

The ids come from the sharing table, which knows a resource only by its type tag; this turns them back into entities. Configs the caller owns are dropped, because ownership is not a share and the caller asking "what has been shared with me?" already has /me for their own.

func (*SlurmClusterConfigRepository) FindByOwnerID

FindByOwnerID returns every config owned by one user.

func (*SlurmClusterConfigRepository) FindBySlurmClusterID

func (r *SlurmClusterConfigRepository) FindBySlurmClusterID(ctx context.Context, clusterID string) ([]model.SlurmClusterConfig, error)

FindBySlurmClusterID returns every config registered against one cluster. It is what makes deleting a cluster still in use reportable as a conflict rather than a foreign key error.

func (*SlurmClusterConfigRepository) Save

Save inserts or updates a config.

func (*SlurmClusterConfigRepository) WithTx

WithTx returns a repository bound to tx.

type SlurmClusterRepository

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

SlurmClusterRepository reads and writes clusters.

Reads preload Partitions because the response DTO always carries them; the Java service achieved the same thing by running reads inside a transaction so the lazy association could still be walked during mapping.

func NewSlurmClusterRepository

func NewSlurmClusterRepository(db *gorm.DB) *SlurmClusterRepository

NewSlurmClusterRepository returns a repository backed by db.

func (*SlurmClusterRepository) Delete

Delete removes a cluster; its partitions go with it via the cascading constraint.

func (*SlurmClusterRepository) ExistsByName

func (r *SlurmClusterRepository) ExistsByName(ctx context.Context, name string) (bool, error)

ExistsByName reports whether a cluster of that name is already registered.

Carried over from the Java repository, which declared it but never called it — no service rejects a duplicate name, and no unique constraint backs it either.

func (*SlurmClusterRepository) FindAll

FindAll returns every cluster with its partitions.

func (*SlurmClusterRepository) FindByID

FindByID returns one cluster with its partitions, or gorm.ErrRecordNotFound.

func (*SlurmClusterRepository) Save

Save inserts or updates a cluster.

func (*SlurmClusterRepository) WithTx

WithTx returns a repository bound to tx.

Jump to

Keyboard shortcuts

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