records

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessMethodWriter

type AccessMethodWriter interface {
	UpdateObjectAccessMethods(ctx context.Context, objectID string, accessMethods []objectmodel.AccessMethod) error
	BulkUpdateAccessMethods(ctx context.Context, updates map[string][]objectmodel.AccessMethod) error
}

AccessMethodWriter updates provider access methods attached to records.

type AccessPolicyWriter

type AccessPolicyWriter interface {
	RemoveObjectControlledAccess(ctx context.Context, objectID, resource string) error
	RemoveObjectControlledAccessBulk(ctx context.Context, objectIDs []string, resource string) (int, error)
}

AccessPolicyWriter updates controlled-access policy on records.

type AliasStore

type AliasStore interface {
	DeleteObjectAlias(ctx context.Context, aliasID string) error
	CreateObjectAlias(ctx context.Context, aliasID, canonicalObjectID string) error
	ResolveObjectAlias(ctx context.Context, aliasID string) (string, error)
}

AliasStore owns physical-to-canonical object alias operations.

type BulkOverwriteResult

type BulkOverwriteResult struct {
	Created         int
	Replaced        int
	DIDMatched      int
	ChecksumMatched int
}

BulkOverwriteResult summarizes a project-scoped, source-wins metadata copy.

type ChecksumScopeQuery

type ChecksumScopeQuery interface {
	ListScopedObjectIDsByChecksums(ctx context.Context, organization, project string, checksums []string) (map[string][]string, error)
}

ChecksumScopeQuery expands checksums within a specific object scope.

type ContentReader

type ContentReader interface {
	GetObjectsByChecksum(ctx context.Context, checksum string) ([]objectmodel.Record, error)
	GetObjectsByChecksums(ctx context.Context, checksums []string) (map[string][]objectmodel.Record, error)
}

ContentReader reads physical records that share a checksum.

type DeleteOptions

type DeleteOptions struct {
	DeleteStorageData bool
}

type Dependencies

type Dependencies struct {
	Reader        RecordReader
	Writer        RecordWriter
	AccessMethods AccessMethodWriter
	AccessPolicy  AccessPolicyWriter
	Aliases       AliasStore
	Content       ContentReader
	ChecksumScope ChecksumScopeQuery
	Scope         ScopeQuery
	Resources     OptionalResourceQuery
	Pages         OptionalPageQuery
	URLPages      OptionalURLQuery
	Authorized    OptionalAuthorizedQuery
}

Dependencies contains the consumer-owned repository ports used by Service. Optional query ports are optimization hooks; scan-based behavior remains available when they are absent.

type OptionalAuthorizedQuery

type OptionalAuthorizedQuery interface {
	ListObjectIDsByScopeAndResources(ctx context.Context, organization, project string, resources []string, restrictToResources bool) ([]string, error)
	ListObjectIDsByChecksumsAndResources(ctx context.Context, checksums []string, resources []string, includeUnscoped, restrictToResources bool) (map[string][]string, error)
}

OptionalAuthorizedQuery is an optional authorization-aware bulk query capability.

type OptionalPageQuery

type OptionalPageQuery interface {
	ListObjectIDsPageByScope(ctx context.Context, organization, project, startAfter string, limit, offset int) ([]string, error)
	ListObjectIDsPageByResources(ctx context.Context, resources []string, includeUnscoped bool, startAfter string, limit, offset int) ([]string, error)
}

OptionalPageQuery is an optional pagination optimization for object IDs.

type OptionalResourceQuery

type OptionalResourceQuery interface {
	ListObjectIDsByResources(ctx context.Context, resources []string, includeUnscoped bool) ([]string, error)
}

OptionalResourceQuery is an optional authorization-aware object ID query.

type OptionalURLQuery

type OptionalURLQuery interface {
	ListObjectIDsPageByURL(ctx context.Context, objectURL, organization, project, startAfter string, limit, offset int, resources []string, includeUnscoped, restrictToResources bool) ([]string, error)
}

OptionalURLQuery is an optional URL-filtered pagination optimization.

type RecordReader

type RecordReader interface {
	GetObject(ctx context.Context, id string) (*objectmodel.Record, error)
	GetBulkObjects(ctx context.Context, ids []string) ([]objectmodel.Record, error)
}

RecordReader reads physical object records.

type RecordWriter

type RecordWriter interface {
	DeleteObject(ctx context.Context, id string) error
	CreateObject(ctx context.Context, obj *objectmodel.Record) error
	BulkDeleteObjects(ctx context.Context, ids []string) error
	RegisterObjects(ctx context.Context, objects []objectmodel.Record) error
	ReplaceObjects(ctx context.Context, objects []objectmodel.Record) error
}

RecordWriter mutates physical object records.

type ScopeQuery

type ScopeQuery interface {
	ListObjectIDsByScope(ctx context.Context, organization, project string) ([]string, error)
}

ScopeQuery lists object IDs in a specific object scope.

type Service

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

Service owns stateful record lookup and mutation operations. The value types remain in the parent objects package so this package depends on the domain model without creating a reverse dependency.

func NewService

func NewService(deps Dependencies) *Service

NewService composes the record service from repository ports.

func (Service) BulkDeleteObjects

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

func (Service) BulkDeleteObjectsWithOptions

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

func (Service) BulkOverwriteObjects

func (m Service) BulkOverwriteObjects(ctx context.Context, organization, project string, candidates []objectmodel.Record) (BulkOverwriteResult, error)

BulkOverwriteObjects replaces records from one project snapshot without canonicalizing checksum siblings. A checksum can therefore exist in more than one project, while still identifying an existing record in this scope.

func (Service) BulkUpdateAccessMethods

func (m Service) BulkUpdateAccessMethods(ctx context.Context, updates map[string][]objectmodel.AccessMethod) error

func (Service) CollapseProjectChecksumDuplicates

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

func (Service) CreateObjectAlias

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

func (Service) DeleteBulkByScope

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

func (Service) DeleteObject

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

func (Service) DeleteObjectWithOptions

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

func (Service) DeleteObjectsByChecksums

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

func (Service) GetBulkObjects

func (m Service) GetBulkObjects(ctx context.Context, ids []string, requiredMethod string) ([]objectmodel.Record, error)

func (Service) GetCanonicalContent

func (m Service) GetCanonicalContent(ctx context.Context, ident string, requiredMethod string) (*objectmodel.CanonicalContent, error)

GetCanonicalContent resolves a physical lookup to the prepared same-content view. The returned ContentID is checksum-derived and Records retains the physical rows used to build the merged objectmodel.Record.

func (Service) GetObject

func (m Service) GetObject(ctx context.Context, ident string, requiredMethod string) (*objectmodel.Record, error)

GetObject retrieves the prepared canonical record identified by ID, alias, or checksum and validates access. Callers that need the identity and physical-record distinction should use GetCanonicalContent.

func (Service) GetObjectsByChecksum

func (m Service) GetObjectsByChecksum(ctx context.Context, checksum string, requiredMethod string) ([]objectmodel.Record, error)

func (Service) GetObjectsByChecksums

func (m Service) GetObjectsByChecksums(ctx context.Context, hashes []string, requiredMethod string) (map[string][]objectmodel.Record, error)

func (Service) GetPreparedScopedObjects

func (m Service) GetPreparedScopedObjects(ctx context.Context, ids []string, organization, project, requiredMethod string) ([]objectmodel.Record, error)

func (Service) ListMissingScopedSHA256

func (m Service) 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 (Service) ListObjectIDsByScope

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

func (Service) ListObjectIDsPageByChecksum

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

func (Service) ListObjectIDsPageByScope

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

func (Service) ListObjectIDsPageByURL

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

func (Service) ListObjectsByScope

func (m Service) ListObjectsByScope(ctx context.Context, organization, project, requiredMethod string) ([]objectmodel.Record, error)

func (Service) ListPhysicalObjectsByScope

func (m Service) ListPhysicalObjectsByScope(ctx context.Context, organization, project, requiredMethod string) ([]objectmodel.Record, error)

ListPhysicalObjectsByScope returns each stored object row in a project scope. Callers that repair physical access methods need the row identity and methods without the same-checksum canonical merge used by normal reads.

func (Service) ListPreparedObjectsPageByScope

func (m Service) ListPreparedObjectsPageByScope(ctx context.Context, organization, project, requiredMethod, startAfter string, limit, offset int) ([]objectmodel.Record, error)

func (Service) PrepareScopedObjects

func (m Service) PrepareScopedObjects(ctx context.Context, objects []objectmodel.Record, organization, project, requiredMethod string) ([]objectmodel.Record, error)

func (Service) RegisterObjects

func (m Service) RegisterObjects(ctx context.Context, objs []objectmodel.Record) error

func (Service) RemoveObjectControlledAccess

func (m Service) RemoveObjectControlledAccess(ctx context.Context, objectID, resource string) (*objectmodel.Record, error)

func (Service) ReplaceObjects

func (m Service) ReplaceObjects(ctx context.Context, objs []objectmodel.Record) error

func (Service) RequireObjectResources

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

func (Service) UpdateObjectAccessMethods

func (m Service) UpdateObjectAccessMethods(ctx context.Context, objectID string, accessMethods []objectmodel.AccessMethod) error

func (Service) UpdateRecord

func (m Service) UpdateRecord(ctx context.Context, id string, update objectmodel.Record, explicitSize *int64, now time.Time) (objectmodel.Record, error)

Jump to

Keyboard shortcuts

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