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 registered datasets, the storages they live on, and the sharing rows that open either up.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataProductRepository

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

DataProductRepository reads and writes registered datasets.

func NewDataProductRepository

func NewDataProductRepository(db *gorm.DB) *DataProductRepository

NewDataProductRepository returns a repository backed by db.

func (*DataProductRepository) Delete

Delete removes a product.

func (*DataProductRepository) FindAll

FindAll returns every product across every owner.

func (*DataProductRepository) FindByDataStorageID

func (r *DataProductRepository) FindByDataStorageID(ctx context.Context, storageID string) ([]model.DataProduct, error)

FindByDataStorageID returns every product staged on one storage. It is what makes deleting a storage still in use reportable as a conflict.

func (*DataProductRepository) FindByID

FindByID returns one product, or gorm.ErrRecordNotFound.

func (*DataProductRepository) FindByIDsExcludingOwner

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

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

The ids come from the sharing table, which no longer knows what kind of record it is opening up beyond its type tag; this turns them back into entities. Data products 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 (*DataProductRepository) FindByOwnerID

func (r *DataProductRepository) FindByOwnerID(ctx context.Context, userID string) ([]model.DataProduct, error)

FindByOwnerID returns every product owned by one user.

func (*DataProductRepository) Save

Save inserts or updates a product.

func (*DataProductRepository) WithTx

WithTx returns a repository bound to tx.

type SCPDataStorageRepository

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

SCPDataStorageRepository reads and writes SCP data storages.

Reads preload the SSH credential because the response DTO carries its public summary: the host and the login user are columns on the storage itself, but the key it presents is a reference, and a storage without it is not much use to a caller deciding whether to put data there.

func NewSCPDataStorageRepository

func NewSCPDataStorageRepository(db *gorm.DB) *SCPDataStorageRepository

NewSCPDataStorageRepository returns a repository backed by db.

func (*SCPDataStorageRepository) CountByKeyID

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

CountByKeyID reports how many storages still present one SSH credential, for the same reason the cluster configs do: the key's foreign key is RESTRICT, and a 409 naming what holds it beats a constraint violation.

func (*SCPDataStorageRepository) Delete

Delete removes a storage.

func (*SCPDataStorageRepository) FindAll

FindAll returns every storage.

func (*SCPDataStorageRepository) FindByID

FindByID returns one storage, or gorm.ErrRecordNotFound.

func (*SCPDataStorageRepository) FindByIDsExcludingOwner

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

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

The ids come from the sharing table, which no longer knows what kind of record it is opening up beyond its type tag; this turns them back into entities. Storages 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 (*SCPDataStorageRepository) FindByOwnerID

func (r *SCPDataStorageRepository) FindByOwnerID(ctx context.Context, userID string) ([]model.SCPDataStorage, error)

FindByOwnerID returns every storage owned by one user.

func (*SCPDataStorageRepository) Save

Save inserts or updates a storage.

func (*SCPDataStorageRepository) WithTx

WithTx returns a repository bound to tx.

type VirtualDataDirectoryRepository

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

func NewVirtualDataDirectoryRepository

func NewVirtualDataDirectoryRepository(db *gorm.DB) *VirtualDataDirectoryRepository

func (*VirtualDataDirectoryRepository) CountByDataProductID

func (r *VirtualDataDirectoryRepository) CountByDataProductID(ctx context.Context, productID string) (int64, error)

CountByDataProductID reports how many directory nodes cite one product. It is what makes deleting a product still used by a dataset reportable as a conflict.

func (*VirtualDataDirectoryRepository) Delete

func (*VirtualDataDirectoryRepository) FindAll

func (*VirtualDataDirectoryRepository) FindByID

func (*VirtualDataDirectoryRepository) FindByIDsExcludingOwner

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

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

The ids come from the sharing table, which no longer knows what kind of record it is opening up beyond its type tag; this turns them back into entities. Directories 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 (*VirtualDataDirectoryRepository) FindByNameUnderParent

func (r *VirtualDataDirectoryRepository) FindByNameUnderParent(ctx context.Context, parentID *string, ownerID, name string) (*model.VirtualDataDirectory, error)

func (*VirtualDataDirectoryRepository) FindChildDirectories

func (r *VirtualDataDirectoryRepository) FindChildDirectories(ctx context.Context, parentID string) ([]model.VirtualDataDirectory, error)

func (*VirtualDataDirectoryRepository) FindRootsByOwnerID

func (r *VirtualDataDirectoryRepository) FindRootsByOwnerID(ctx context.Context, userID string) ([]model.VirtualDataDirectory, error)

func (*VirtualDataDirectoryRepository) FindSubtreeIDs

func (r *VirtualDataDirectoryRepository) FindSubtreeIDs(ctx context.Context, id string, maxDepth int) ([]string, error)

FindSubtreeIDs returns id and the ids of every directory beneath it, breadth first.

Deleting a directory cascades the rows under it through the self-referencing foreign key, but the shares hanging off those rows point at nothing and so are not cascaded with them. The caller deletes them by id, which is what this is for.

maxDepth bounds the walk: the schema cannot express "no cycles", and a cycle would otherwise make this loop forever. Nodes already seen are not revisited, so a cycle yields a finite set rather than a wrong one.

func (*VirtualDataDirectoryRepository) Save

func (*VirtualDataDirectoryRepository) WithTx

type VirtualDataFileRepository

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

func NewVirtualDataFileRepository

func NewVirtualDataFileRepository(db *gorm.DB) *VirtualDataFileRepository

func (*VirtualDataFileRepository) CountByDataProductID

func (r *VirtualDataFileRepository) CountByDataProductID(ctx context.Context, productID string) (int64, error)

func (*VirtualDataFileRepository) Delete

func (*VirtualDataFileRepository) FindByID

func (*VirtualDataFileRepository) FindByNameUnderParent

func (r *VirtualDataFileRepository) FindByNameUnderParent(ctx context.Context, parentID, name string) (*model.VirtualDataFile, error)

func (*VirtualDataFileRepository) FindByParentID

func (r *VirtualDataFileRepository) FindByParentID(ctx context.Context, parentID string) ([]model.VirtualDataFile, error)

func (*VirtualDataFileRepository) Save

func (*VirtualDataFileRepository) WithTx

Jump to

Keyboard shortcuts

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