core

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CandidateToInternalObject

func CandidateToInternalObject(c drs.DrsObjectCandidate, now time.Time) (models.InternalObject, error)

CandidateToInternalObject converts a DRS registration candidate to our internal domain model.

func EnforceCanonicalProjectScope added in v0.3.2

func EnforceCanonicalProjectScope(obj models.InternalObject, organization, project string) (models.InternalObject, error)

func FirstSupportedAccessURL

func FirstSupportedAccessURL(obj *models.InternalObject) string

FirstSupportedAccessURL returns the first URL from an object that Syfon can sign.

func GetBaseURL

func GetBaseURL(ctx context.Context) string

GetBaseURL retrieves the base URL from the context.

func InternalObjectToInternalRecord

func InternalObjectToInternalRecord(obj models.InternalObject) internalapi.InternalRecord

InternalObjectToInternalRecord converts our internal domain model back to an API record.

func InternalObjectToInternalRecordResponse

func InternalObjectToInternalRecordResponse(obj models.InternalObject) internalapi.InternalRecordResponse

InternalObjectToInternalRecordResponse converts our internal domain model back to an API response.

func InternalRecordToInternalObject

func InternalRecordToInternalObject(r internalapi.InternalRecord, now time.Time) (models.InternalObject, error)

InternalRecordToInternalObject converts an index/internal record to our internal domain model.

func LFSCandidateToDRS

func LFSCandidateToDRS(in lfsapi.DrsObjectCandidate) drs.DrsObjectCandidate

LFSCandidateToDRS converts an LFS-specific candidate to a DRS-generic one.

func MergeInternalObjectUpdate

func MergeInternalObjectUpdate(existing models.InternalObject, update models.InternalObject, id string, now time.Time) (models.InternalObject, error)

MergeInternalObjectUpdate merges an update into an existing object.

func ObjectAccessResources added in v0.2.8

func ObjectAccessResources(obj *models.InternalObject) []string

func WithBaseURL

func WithBaseURL(ctx context.Context, baseURL string) context.Context

WithBaseURL adds the base URL to the context.

func WithStorageInspectCache added in v0.3.2

func WithStorageInspectCache(ctx context.Context) context.Context

Types

type CanonicalStorageTarget added in v0.2.9

type CanonicalStorageTarget struct {
	Bucket string
	Key    string
	URL    string
}

type CanonicalStorageTargetRequest added in v0.2.9

type CanonicalStorageTargetRequest struct {
	Object         *models.InternalObject
	AccessURL      string
	Bucket         string
	Key            string
	PreferChecksum bool
}

type DeleteOptions added in v0.2.9

type DeleteOptions struct {
	DeleteStorageData bool
}

type InspectStorageRequest added in v0.3.2

type InspectStorageRequest struct {
	ID                string
	Organization      string
	Project           string
	Key               string
	Scheme            string
	ObjectURL         string
	ExpectedSizeBytes *int64
	ExpectedSHA256    string
}

type ObjectManager

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

ObjectManager standardizes object lifecycle operations across all API surfaces.

func (*ObjectManager) BulkDeleteObjects

func (m *ObjectManager) BulkDeleteObjects(ctx context.Context, ids []string) error

func (*ObjectManager) BulkDeleteObjectsWithOptions added in v0.3.2

func (m *ObjectManager) BulkDeleteObjectsWithOptions(ctx context.Context, ids []string, opts DeleteOptions) error

func (*ObjectManager) BulkUpdateAccessMethods added in v0.2.5

func (m *ObjectManager) BulkUpdateAccessMethods(ctx context.Context, updates map[string][]drs.AccessMethod) error

func (*ObjectManager) CollapseProjectChecksumDuplicates added in v0.3.2

func (m *ObjectManager) CollapseProjectChecksumDuplicates(ctx context.Context, organization, project string) (int, error)

func (*ObjectManager) CompleteMultipartUpload

func (m *ObjectManager) CompleteMultipartUpload(ctx context.Context, bucket, key, uploadID string, parts []urlmanager.MultipartPart) error

func (*ObjectManager) CreateBucketScope

func (m *ObjectManager) CreateBucketScope(ctx context.Context, scope *models.BucketScope) error

func (*ObjectManager) CreateObjectAlias

func (m *ObjectManager) CreateObjectAlias(ctx context.Context, aliasID, canonicalID string) error

func (*ObjectManager) DeleteBucketScope added in v0.3.1

func (m *ObjectManager) DeleteBucketScope(ctx context.Context, organization, projectID, credentialID, pathPrefix string) error

func (*ObjectManager) DeleteBulkByScope added in v0.2.5

func (m *ObjectManager) DeleteBulkByScope(ctx context.Context, organization, project string) (int, error)

DeleteBulkByScope removes all objects matching an organization/project scope after verifying permissions.

func (*ObjectManager) DeleteObject

func (m *ObjectManager) DeleteObject(ctx context.Context, id string) error

func (*ObjectManager) DeleteObjectWithOptions added in v0.2.9

func (m *ObjectManager) DeleteObjectWithOptions(ctx context.Context, id string, opts DeleteOptions) error

func (*ObjectManager) DeleteObjectsByChecksums added in v0.2.8

func (m *ObjectManager) DeleteObjectsByChecksums(ctx context.Context, hashes []string) (int, error)

func (*ObjectManager) DeleteProjectStorageObjects added in v0.3.2

func (m *ObjectManager) DeleteProjectStorageObjects(ctx context.Context, organization, project string, objectURLs []string) []ProjectStorageDeleteResult

func (*ObjectManager) DeleteS3Credential

func (m *ObjectManager) DeleteS3Credential(ctx context.Context, credentialID string) error

func (*ObjectManager) GetBulkObjects

func (m *ObjectManager) GetBulkObjects(ctx context.Context, ids []string, requiredMethod string) ([]models.InternalObject, error)

func (*ObjectManager) GetObject

func (m *ObjectManager) GetObject(ctx context.Context, ident string, requiredMethod string) (*models.InternalObject, error)

GetObject retrieves an internal object by ID, Alias, or Checksum and validates access.

func (*ObjectManager) GetObjectsByChecksum

func (m *ObjectManager) GetObjectsByChecksum(ctx context.Context, checksum string, requiredMethod string) ([]models.InternalObject, error)

func (*ObjectManager) GetObjectsByChecksums

func (m *ObjectManager) GetObjectsByChecksums(ctx context.Context, hashes []string, requiredMethod string) (map[string][]models.InternalObject, error)

func (*ObjectManager) GetPendingLFSMeta

func (m *ObjectManager) GetPendingLFSMeta(ctx context.Context, oid string) (*models.PendingLFSMeta, error)

func (*ObjectManager) GetS3Credential

func (m *ObjectManager) GetS3Credential(ctx context.Context, credentialID string) (*models.S3Credential, error)

func (*ObjectManager) GetServiceInfo

func (m *ObjectManager) GetServiceInfo(ctx context.Context) (*drs.Service, error)

func (*ObjectManager) InitMultipartUpload

func (m *ObjectManager) InitMultipartUpload(ctx context.Context, bucket, key string) (string, error)

func (*ObjectManager) InspectProjectStorage added in v0.3.2

func (m *ObjectManager) InspectProjectStorage(ctx context.Context, organization, project string, inspectOptions ProjectStorageInspectOptions) (*ProjectStorageInspectResult, error)

func (*ObjectManager) InspectStorageObject added in v0.3.2

func (m *ObjectManager) InspectStorageObject(ctx context.Context, req InspectStorageRequest) (*StorageObjectMetadata, error)

func (*ObjectManager) InspectStorageObjects added in v0.3.2

func (m *ObjectManager) InspectStorageObjects(ctx context.Context, items []InspectStorageRequest) []StorageProbeResult

func (*ObjectManager) ListBucketScopes

func (m *ObjectManager) ListBucketScopes(ctx context.Context) ([]models.BucketScope, error)

func (*ObjectManager) ListMissingScopedSHA256 added in v0.3.2

func (m *ObjectManager) ListMissingScopedSHA256(ctx context.Context, organization, project string, checksums []string) ([]string, error)

ListMissingScopedSHA256 returns the requested SHA-256 checksums that are not registered for the given project. It deliberately uses the indexed checksum lookup and does not hydrate complete DRS records or access methods.

func (*ObjectManager) ListObjectIDsByScope added in v0.2.5

func (m *ObjectManager) ListObjectIDsByScope(ctx context.Context, organization, project string, requiredMethod string) ([]string, error)

func (*ObjectManager) ListObjectIDsPageByChecksum added in v0.2.8

func (m *ObjectManager) ListObjectIDsPageByChecksum(ctx context.Context, checksum, checksumType, organization, project, requiredMethod, startAfter string, limit, offset int) ([]string, error)

func (*ObjectManager) ListObjectIDsPageByScope added in v0.2.8

func (m *ObjectManager) ListObjectIDsPageByScope(ctx context.Context, organization, project, requiredMethod, startAfter string, limit, offset int) ([]string, error)

func (*ObjectManager) ListObjectIDsPageByURL added in v0.2.8

func (m *ObjectManager) ListObjectIDsPageByURL(ctx context.Context, objectURL, organization, project, requiredMethod, startAfter string, limit, offset int) ([]string, error)

func (*ObjectManager) ListObjectsByScope added in v0.3.2

func (m *ObjectManager) ListObjectsByScope(ctx context.Context, organization, project, requiredMethod string) ([]models.InternalObject, error)

func (*ObjectManager) ListPreparedObjectsPageByScope added in v0.3.2

func (m *ObjectManager) ListPreparedObjectsPageByScope(ctx context.Context, organization, project, requiredMethod, startAfter string, limit, offset int) ([]models.InternalObject, error)

func (*ObjectManager) ListProjectStorageObjects added in v0.3.2

func (m *ObjectManager) ListProjectStorageObjects(ctx context.Context, organization, project string, includeHead bool) ([]StorageBucketObject, error)

func (*ObjectManager) ListS3Credentials

func (m *ObjectManager) ListS3Credentials(ctx context.Context) ([]models.S3Credential, error)

func (*ObjectManager) ListValidateStorageObjects added in v0.3.2

func (m *ObjectManager) ListValidateStorageObjects(ctx context.Context, items []StorageListValidationRequest) []StorageListValidationResult

func (*ObjectManager) ListVisibleBuckets added in v0.2.8

func (m *ObjectManager) ListVisibleBuckets(ctx context.Context) (map[string]VisibleBucket, error)

func (*ObjectManager) PopPendingLFSMeta

func (m *ObjectManager) PopPendingLFSMeta(ctx context.Context, oid string) (*models.PendingLFSMeta, error)

func (*ObjectManager) PrepareScopedObjects added in v0.3.2

func (m *ObjectManager) PrepareScopedObjects(ctx context.Context, objects []models.InternalObject, organization, project, requiredMethod string) ([]models.InternalObject, error)

func (*ObjectManager) RecordDownload

func (m *ObjectManager) RecordDownload(ctx context.Context, id string) error

func (*ObjectManager) RecordProviderTransferEvents added in v0.2.5

func (m *ObjectManager) RecordProviderTransferEvents(ctx context.Context, events []models.ProviderTransferEvent) error

func (*ObjectManager) RecordTransferAttributionEvents added in v0.2.5

func (m *ObjectManager) RecordTransferAttributionEvents(ctx context.Context, events []models.TransferAttributionEvent) error

func (*ObjectManager) RecordUpload

func (m *ObjectManager) RecordUpload(ctx context.Context, id string) error

func (*ObjectManager) RegisterBulk

func (m *ObjectManager) RegisterBulk(ctx context.Context, candidates []drs.DrsObjectCandidate) (int, error)

RegisterBulk saves multiple internal objects as a single logical operation.

func (*ObjectManager) RegisterObjects

func (m *ObjectManager) RegisterObjects(ctx context.Context, objs []models.InternalObject) error

func (*ObjectManager) RemoveObjectControlledAccess added in v0.2.9

func (m *ObjectManager) RemoveObjectControlledAccess(ctx context.Context, objectID, resource string) (*models.InternalObject, error)

func (*ObjectManager) ReplaceObjects added in v0.2.8

func (m *ObjectManager) ReplaceObjects(ctx context.Context, objs []models.InternalObject) error

func (*ObjectManager) RequireObjectResources added in v0.2.8

func (m *ObjectManager) RequireObjectResources(ctx context.Context, method string, resources []string) error

func (*ObjectManager) ResolveBucket

func (m *ObjectManager) ResolveBucket(ctx context.Context, bucketName string) (string, error)

ResolveBucket validates a bucket name or returns the default one.

func (*ObjectManager) ResolveCanonicalStorageTarget added in v0.2.9

func (m *ObjectManager) ResolveCanonicalStorageTarget(ctx context.Context, req CanonicalStorageTargetRequest) (CanonicalStorageTarget, error)

func (*ObjectManager) ResolveProjectStoragePathPrefix added in v0.3.2

func (m *ObjectManager) ResolveProjectStoragePathPrefix(ctx context.Context, organization, project, pathPrefix string) (string, error)

func (*ObjectManager) ResolveScopedUploadTarget added in v0.2.9

func (m *ObjectManager) ResolveScopedUploadTarget(ctx context.Context, organization, project, key string) (CanonicalStorageTarget, error)

func (*ObjectManager) SavePendingLFSMeta

func (m *ObjectManager) SavePendingLFSMeta(ctx context.Context, entries []models.PendingLFSMeta) error

func (*ObjectManager) SaveS3Credential

func (m *ObjectManager) SaveS3Credential(ctx context.Context, cred *models.S3Credential) error

func (*ObjectManager) SetS3ObjectInspector added in v0.3.2

func (m *ObjectManager) SetS3ObjectInspector(fn func(context.Context, models.S3Credential, string, string) (*StorageObjectMetadata, error))

func (*ObjectManager) SetS3PrefixLister added in v0.3.2

func (m *ObjectManager) SetS3PrefixLister(fn func(context.Context, models.S3Credential, string, string, bool) ([]StorageBucketObject, error))

func (*ObjectManager) SetS3PrefixListerWithOptions added in v0.3.2

func (*ObjectManager) SignDownloadPart

func (m *ObjectManager) SignDownloadPart(ctx context.Context, bucket, accessURL string, start, end int64, options urlmanager.SignOptions) (string, error)

func (*ObjectManager) SignMultipartPart

func (m *ObjectManager) SignMultipartPart(ctx context.Context, bucket, key, uploadID string, partNum int32) (string, error)

func (*ObjectManager) SignObjectDownloadPart added in v0.2.8

func (m *ObjectManager) SignObjectDownloadPart(ctx context.Context, obj *models.InternalObject, bucket, accessURL string, start, end int64, options urlmanager.SignOptions) (string, error)

func (*ObjectManager) SignObjectURL added in v0.2.8

func (m *ObjectManager) SignObjectURL(ctx context.Context, obj *models.InternalObject, accessURL string, options urlmanager.SignOptions) (string, error)

func (*ObjectManager) SignURL

func (m *ObjectManager) SignURL(ctx context.Context, accessURL string, options urlmanager.SignOptions) (string, error)

SignURL generates a signed URL for an object's access method.

func (*ObjectManager) UpdateObjectAccessMethods added in v0.2.5

func (m *ObjectManager) UpdateObjectAccessMethods(ctx context.Context, objectID string, accessMethods []drs.AccessMethod) error

type ProjectStorageDeleteResult added in v0.3.2

type ProjectStorageDeleteResult struct {
	ObjectURL string
	Status    string
	Error     string
}

type ProjectStorageInspectMode added in v0.3.2

type ProjectStorageInspectMode string
const (
	ProjectStorageInspectItems   ProjectStorageInspectMode = "items"
	ProjectStorageInspectExists  ProjectStorageInspectMode = "exists"
	ProjectStorageInspectSummary ProjectStorageInspectMode = "summary"
)

type ProjectStorageInspectOptions added in v0.3.2

type ProjectStorageInspectOptions struct {
	Mode        ProjectStorageInspectMode
	IncludeHead bool
	PathPrefix  string
}

type ProjectStorageInspectResult added in v0.3.2

type ProjectStorageInspectResult struct {
	Summary ProjectStorageSummary
	Items   []StorageBucketObject
}

type ProjectStorageSummary added in v0.3.2

type ProjectStorageSummary struct {
	Provider    string
	Bucket      string
	Prefix      string
	ObjectURL   string
	Exists      bool
	ObjectCount int
	TotalBytes  int64
	ComputedAt  time.Time
	Mode        ProjectStorageInspectMode
}

type StorageBucketObject added in v0.3.2

type StorageBucketObject struct {
	ObjectURL   string
	Provider    string
	Bucket      string
	Key         string
	Path        string
	SizeBytes   int64
	MetaSHA256  string
	ETag        string
	LastModTime time.Time
}

type StorageInspectError added in v0.3.2

type StorageInspectError struct {
	Kind    StorageInspectErrorKind
	Message string
}

func (*StorageInspectError) Error added in v0.3.2

func (e *StorageInspectError) Error() string

type StorageInspectErrorKind added in v0.3.2

type StorageInspectErrorKind string
const (
	StorageInspectInvalidInput      StorageInspectErrorKind = "invalid_input"
	StorageInspectScopeNotFound     StorageInspectErrorKind = "scope_not_found"
	StorageInspectCredentialMissing StorageInspectErrorKind = "credential_missing"
	StorageInspectPermissionDenied  StorageInspectErrorKind = "permission_denied"
	StorageInspectObjectNotFound    StorageInspectErrorKind = "object_not_found"
	StorageInspectBucketUnavailable StorageInspectErrorKind = "bucket_unavailable"
	StorageInspectListingIncomplete StorageInspectErrorKind = "listing_incomplete"
	StorageInspectUnsupported       StorageInspectErrorKind = "unsupported"
)

type StorageListValidationRequest added in v0.3.2

type StorageListValidationRequest struct {
	ID                string
	ObjectURL         string
	ExpectedSizeBytes *int64
	ExpectedName      string
}

type StorageListValidationResult added in v0.3.2

type StorageListValidationResult struct {
	ID                   string
	ObjectURL            string
	Provider             string
	Bucket               string
	Key                  string
	Path                 string
	Exists               bool
	Status               StorageProbeStatus
	Error                string
	ErrorKind            string
	SizeBytes            *int64
	ETag                 string
	LastModTime          time.Time
	ValidationStatus     StorageValidationStatus
	SizeMatch            *bool
	NameMatch            *bool
	ValidationMismatches []string
}

type StorageObjectMetadata added in v0.3.2

type StorageObjectMetadata struct {
	ObjectURL   string
	Provider    string
	Bucket      string
	Key         string
	Path        string
	SizeBytes   int64
	MetaSHA256  string
	ETag        string
	LastModTime time.Time
}

type StoragePrefixListOptions added in v0.3.2

type StoragePrefixListOptions struct {
	IncludeHead bool
	ExactPrefix bool
	MaxKeys     int32
}

type StorageProbeResult added in v0.3.2

type StorageProbeResult struct {
	ID                   string
	ObjectURL            string
	Provider             string
	Bucket               string
	Key                  string
	Path                 string
	Exists               bool
	Status               StorageProbeStatus
	Error                string
	ErrorKind            string
	SizeBytes            *int64
	MetaSHA256           string
	ETag                 string
	LastModTime          time.Time
	ValidationStatus     StorageValidationStatus
	SizeMatch            *bool
	SHA256Match          *bool
	ValidationMismatches []string
}

type StorageProbeStatus added in v0.3.2

type StorageProbeStatus string
const (
	StorageProbeStatusPresent     StorageProbeStatus = "present"
	StorageProbeStatusNotFound    StorageProbeStatus = "not_found"
	StorageProbeStatusForbidden   StorageProbeStatus = "forbidden"
	StorageProbeStatusInvalid     StorageProbeStatus = "invalid"
	StorageProbeStatusUnsupported StorageProbeStatus = "unsupported"
	StorageProbeStatusError       StorageProbeStatus = "error"
)

type StorageValidationStatus added in v0.3.2

type StorageValidationStatus string
const (
	StorageValidationNotRequested StorageValidationStatus = "not_requested"
	StorageValidationMatched      StorageValidationStatus = "matched"
	StorageValidationMismatched   StorageValidationStatus = "mismatched"
	StorageValidationUnverifiable StorageValidationStatus = "unverifiable"
)

type VisibleBucket added in v0.2.8

type VisibleBucket struct {
	Credential models.S3Credential
	Programs   []string
}

Jump to

Keyboard shortcuts

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