service

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// VendorVersion is the version of this CSP SP.
	VendorVersion = "0.1.0"
)

Variables

View Source
var CacheSacnInterval = 60 * time.Second
View Source
var ErrConflict = errors.New("conflict")
View Source
var NewPuller = func(ctx context.Context, pullCfg *config.PullConfig, hook *Hook, diskQuotaChecker *DiskQuotaChecker) Puller {
	return &puller{
		pullCfg:          pullCfg,
		hook:             hook,
		diskQuotaChecker: diskQuotaChecker,
	}
}

Functions

This section is empty.

Types

type CacheManager

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

func NewCacheManager

func NewCacheManager(cfg *config.Config) (*CacheManager, error)

func (*CacheManager) Scan

func (cm *CacheManager) Scan() error

type ContextMap

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

func NewContextMap

func NewContextMap() *ContextMap

func (*ContextMap) Get

func (cm *ContextMap) Get(key string) *context.CancelFunc

func (*ContextMap) Set

func (cm *ContextMap) Set(key string, cancelFunc *context.CancelFunc)

type DiskQuotaChecker

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

func NewDiskQuotaChecker

func NewDiskQuotaChecker(cfg *config.Config) *DiskQuotaChecker

func (*DiskQuotaChecker) Check

func (d *DiskQuotaChecker) Check(ctx context.Context, modelArtifact *ModelArtifact, excludeModelWeights bool) error

Check checks if there is enough disk quota to mount the model.

If cfg.Features.CheckDiskQuota is enabled and the Mount request specifies checkDiskQuota = true: - When cfg.Features.DiskUsageLimit == 0: reject if available disk space < model size; - When cfg.Features.DiskUsageLimit > 0: reject if (cfg.Features.DiskUsageLimit - used space) < model size;

type Hook

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

func NewHook

func NewHook(ctx context.Context, progressCb func(progress status.Progress)) *Hook

func (*Hook) AfterPullLayer

func (h *Hook) AfterPullLayer(desc ocispec.Descriptor, err error)

func (*Hook) BeforePullLayer

func (h *Hook) BeforePullLayer(desc ocispec.Descriptor, manifest ocispec.Manifest)

func (*Hook) GetProgress

func (h *Hook) GetProgress() status.Progress

type ModelArtifact

type ModelArtifact struct {
	Reference string
	// contains filtered or unexported fields
}

func NewModelArtifact

func NewModelArtifact(b backend.Backend, reference string, plainHTTP bool) *ModelArtifact

func (*ModelArtifact) GetPatterns

func (m *ModelArtifact) GetPatterns(ctx context.Context, excludeWeights bool) ([]string, error)

func (*ModelArtifact) GetSize

func (m *ModelArtifact) GetSize(ctx context.Context, excludeWeights bool) (int64, error)

type MountRequest

type MountRequest struct {
	MountID             string `json:"mount_id"`
	Reference           string `json:"reference"`
	CheckDiskQuota      bool   `json:"check_disk_quota"`
	ExcludeModelWeights bool   `json:"exclude_model_weights"`
}

type PullHook

type PullHook interface {
	BeforePullLayer(desc ocispec.Descriptor, manifest ocispec.Manifest)
	AfterPullLayer(desc ocispec.Descriptor, err error)
}

type Puller

type Puller interface {
	Pull(ctx context.Context, reference, targetDir string, excludeModelWeights bool) error
}

type Service

type Service struct {
	csi.UnimplementedControllerServer
	csi.UnimplementedIdentityServer
	csi.UnimplementedNodeServer
	// contains filtered or unexported fields
}

func New

func New(cfg *config.Config) (*Service, error)

func (*Service) ControllerExpandVolume

func (*Service) CreateSnapshot

func (s *Service) CreateSnapshot(
	ctx context.Context,
	req *csi.CreateSnapshotRequest) (
	*csi.CreateSnapshotResponse, error)

func (*Service) CreateVolume

func (s *Service) CreateVolume(
	ctx context.Context,
	req *csi.CreateVolumeRequest) (
	*csi.CreateVolumeResponse, error)

func (*Service) DeleteSnapshot

func (s *Service) DeleteSnapshot(
	ctx context.Context,
	req *csi.DeleteSnapshotRequest) (
	*csi.DeleteSnapshotResponse, error)

func (*Service) DeleteVolume

func (s *Service) DeleteVolume(
	ctx context.Context,
	req *csi.DeleteVolumeRequest) (
	*csi.DeleteVolumeResponse, error)

func (*Service) GetCapacity

func (s *Service) GetCapacity(
	ctx context.Context,
	req *csi.GetCapacityRequest) (
	*csi.GetCapacityResponse, error)

func (*Service) GetDynamicVolume

func (s *Service) GetDynamicVolume(ctx context.Context, volumeName, mountID string) (*modelStatus.Status, error)

func (*Service) GetPluginCapabilities

func (*Service) GetPluginInfo

func (s *Service) GetPluginInfo(
	ctx context.Context,
	req *csi.GetPluginInfoRequest) (
	*csi.GetPluginInfoResponse, error)

func (*Service) ListDynamicVolumes

func (s *Service) ListDynamicVolumes(ctx context.Context, volumeName string) ([]modelStatus.Status, error)

func (*Service) ListSnapshots

func (s *Service) ListSnapshots(
	ctx context.Context,
	req *csi.ListSnapshotsRequest) (
	*csi.ListSnapshotsResponse, error)

func (*Service) ListVolumes

func (s *Service) ListVolumes(
	ctx context.Context,
	req *csi.ListVolumesRequest) (
	*csi.ListVolumesResponse, error)

func (*Service) NodeExpandVolume

func (s *Service) NodeExpandVolume(
	ctx context.Context,
	req *csi.NodeExpandVolumeRequest) (
	*csi.NodeExpandVolumeResponse, error)

func (*Service) NodeGetCapabilities

func (*Service) NodeGetInfo

func (s *Service) NodeGetInfo(
	ctx context.Context,
	req *csi.NodeGetInfoRequest) (
	*csi.NodeGetInfoResponse, error)

func (*Service) NodeGetVolumeStats

func (*Service) NodePublishVolume

func (s *Service) NodePublishVolume(
	ctx context.Context,
	req *csi.NodePublishVolumeRequest) (
	*csi.NodePublishVolumeResponse, error)

func (*Service) NodeStageVolume

func (s *Service) NodeStageVolume(
	ctx context.Context,
	req *csi.NodeStageVolumeRequest) (
	*csi.NodeStageVolumeResponse, error)

func (*Service) NodeUnpublishVolume

func (*Service) NodeUnstageVolume

func (s *Service) NodeUnstageVolume(
	ctx context.Context,
	req *csi.NodeUnstageVolumeRequest) (
	*csi.NodeUnstageVolumeResponse, error)

func (*Service) Probe

func (s *Service) Probe(
	ctx context.Context,
	req *csi.ProbeRequest) (
	*csi.ProbeResponse, error)

func (*Service) StatusManager

func (svc *Service) StatusManager() *status.StatusManager

type Worker

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

func NewWorker

func NewWorker(cfg *config.Config, sm *status.StatusManager) (*Worker, error)

func (*Worker) DeleteModel

func (worker *Worker) DeleteModel(ctx context.Context, isStaticVolume bool, volumeName, mountID string) error

func (*Worker) PullModel

func (worker *Worker) PullModel(
	ctx context.Context,
	isStaticVolume bool,
	volumeName, mountID,
	reference,
	modelDir string,
	checkDiskQuota bool,
	excludeModelWeights bool,
) error

Jump to

Keyboard shortcuts

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