Documentation
¶
Index ¶
- func BackfillAccessGrants(ctx context.Context, dbConn *sql.DB, dialect Dialect) error
- type CredentialCodec
- type Dialect
- type Store
- func (db *Store) BulkDeleteObjects(ctx context.Context, ids []string) error
- func (db *Store) BulkUpdateAccessMethods(ctx context.Context, updates map[string][]drs.AccessMethod) error
- func (db *Store) ClaimMultipartAbort(ctx context.Context, uploadID, token string, now, staleBefore time.Time) (transfers.MultipartSession, bool, error)
- func (db *Store) ClaimMultipartCompletion(ctx context.Context, uploadID, token, partsFingerprint string, ...) (transfers.MultipartSession, bool, error)
- func (db *Store) ClaimMultipartCompletionWithParts(ctx context.Context, uploadID, token, partsFingerprint string, ...) (transfers.MultipartSession, bool, error)
- func (s *Store) Close() error
- func (db *Store) CompactCompletedMultipartSessions(ctx context.Context, before time.Time, limit int) error
- func (db *Store) ConsumePendingMetadata(ctx context.Context, expected transferlfs.PendingMetadata) (bool, error)
- func (db *Store) CreateBucketScope(ctx context.Context, scope *buckets.Scope) error
- func (db *Store) CreateObjectAlias(ctx context.Context, aliasID, canonicalObjectID string) error
- func (s *Store) DB() *sql.DB
- func (db *Store) DeleteBucketScopeConfiguration(ctx context.Context, scope buckets.Scope) ([]string, error)
- func (db *Store) DeleteObject(ctx context.Context, id string) error
- func (db *Store) DeleteS3Credential(ctx context.Context, credentialID string) error
- func (db *Store) FinishMultipartAbort(ctx context.Context, uploadID, token string, _ time.Time) (bool, error)
- func (db *Store) FinishMultipartCompletion(ctx context.Context, uploadID, token, location string, now time.Time) (bool, error)
- func (db *Store) GetBucketScope(ctx context.Context, organization, projectID string) (*buckets.Scope, error)
- func (db *Store) GetBulkObjects(ctx context.Context, ids []string) ([]drs.DrsObject, error)
- func (db *Store) GetFileUsage(ctx context.Context, objectID string) (*metricsapi.FileUsage, error)
- func (db *Store) GetFileUsageSummary(ctx context.Context, inactiveSince *time.Time) (metricsapi.FileUsageSummary, error)
- func (db *Store) GetFileUsageSummaryByResources(ctx context.Context, resources []string, includeUnscoped bool, ...) (metricsapi.FileUsageSummary, error)
- func (db *Store) GetFileUsageSummaryByScope(ctx context.Context, organization, project string, inactiveSince *time.Time) (metricsapi.FileUsageSummary, error)
- func (db *Store) GetMultipartCompletionReceipt(ctx context.Context, uploadID string) (transfers.MultipartCompletionReceipt, error)
- func (db *Store) GetMultipartSession(ctx context.Context, uploadID string) (transfers.MultipartSession, error)
- func (db *Store) GetObject(ctx context.Context, id string) (*drs.DrsObject, error)
- func (db *Store) GetObjectsByChecksums(ctx context.Context, checksums []string) (map[string][]drs.DrsObject, error)
- func (db *Store) GetPendingMetadata(ctx context.Context, oid string) (*transferlfs.PendingMetadata, error)
- func (db *Store) GetProjectRecordSummaryByScope(ctx context.Context, organization, project string) (metricsapi.FileUsageSummary, error)
- func (db *Store) GetPublicReadByIDs(ctx context.Context, ids []string) (map[string]bool, error)
- func (db *Store) GetS3Credential(ctx context.Context, credentialID string) (*buckets.Credential, error)
- func (db *Store) ListBucketScopes(ctx context.Context) ([]buckets.Scope, error)
- func (db *Store) ListBucketVisibilityRows(ctx context.Context, resources []string, ...) ([]buckets.VisibilityRow, error)
- func (db *Store) ListFileUsage(ctx context.Context, limit, offset int, inactiveSince *time.Time) ([]metricsapi.FileUsage, error)
- func (db *Store) ListFileUsageByObjectIDs(ctx context.Context, ids []string) ([]metricsapi.FileUsage, error)
- func (db *Store) ListFileUsagePageByResources(ctx context.Context, resources []string, includeUnscoped bool, ...) ([]metricsapi.FileUsage, error)
- func (db *Store) ListFileUsagePageByScope(ctx context.Context, organization, project string, limit, offset int, ...) ([]metricsapi.FileUsage, error)
- func (db *Store) ListMultipartSessionsForReconcile(ctx context.Context, inactiveBefore, completedBefore time.Time, limit int) ([]transfers.MultipartSession, error)
- func (db *Store) ListObjectIDsByResources(ctx context.Context, resources []string, includeUnscoped bool) ([]string, error)
- func (db *Store) ListObjectIDsByScope(ctx context.Context, organization, project string) ([]string, error)
- func (db *Store) ListObjectIDsPageByAuthorizedScope(ctx context.Context, organization, project, startAfter string, ...) ([]string, error)
- func (db *Store) ListObjectIDsPageByScope(ctx context.Context, organization, project, startAfter string, ...) ([]string, error)
- func (db *Store) ListObjectIDsPageByURL(ctx context.Context, objectURL, organization, project, startAfter string, ...) ([]string, error)
- func (db *Store) ListS3Credentials(ctx context.Context) ([]buckets.Credential, error)
- func (db *Store) ListScopedObjectIDsByChecksums(ctx context.Context, organization, project string, checksums []string) (map[string][]string, error)
- func (db *Store) QueryTransferBreakdown(ctx context.Context, filter usage.Filter, groupBy string, resources []string) ([]metricsapi.TransferAttributionBreakdown, error)
- func (db *Store) QueryTransferSummary(ctx context.Context, filter usage.Filter, resources []string) (metricsapi.TransferAttributionSummary, error)
- func (db *Store) RecordFileDownload(ctx context.Context, objectID string) error
- func (db *Store) RecordFileUpload(ctx context.Context, objectID string) error
- func (db *Store) RecordProviderTransferEvents(ctx context.Context, events []metricsapi.ProviderTransferEvent) error
- func (db *Store) RecordTransferAttributionEvents(ctx context.Context, events []usage.Event) error
- func (db *Store) RegisterObjects(ctx context.Context, objects []drs.DrsObject) error
- func (db *Store) ReleaseMultipartCompletion(ctx context.Context, uploadID, token string, now time.Time) error
- func (db *Store) RemoveObjectControlledAccess(ctx context.Context, objectID, resource string) error
- func (db *Store) RemoveObjectControlledAccessBulk(ctx context.Context, objectIDs []string, resource string) (int, error)
- func (db *Store) RepairCanonicalDuplicates(ctx context.Context, repairs []objects.CanonicalRepair) error
- func (db *Store) ReplaceObjects(ctx context.Context, objects []drs.DrsObject) error
- func (db *Store) ResolveObjectAlias(ctx context.Context, aliasID string) (string, error)
- func (db *Store) SaveBucketConfiguration(ctx context.Context, configuration buckets.BucketConfiguration) error
- func (db *Store) SaveMultipartSession(ctx context.Context, session transfers.MultipartSession) error
- func (db *Store) SavePendingMetadata(ctx context.Context, entries []transferlfs.PendingMetadata) error
- func (db *Store) SaveS3Credential(ctx context.Context, cred *buckets.Credential) error
- func (db *Store) TouchMultipartSession(ctx context.Context, uploadID string, now time.Time) error
- func (db *Store) UpdateObjectAccessMethods(ctx context.Context, objectID string, accessMethods []drs.AccessMethod) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackfillAccessGrants ¶
BackfillAccessGrants runs the transfer attribution bootstrap against an already-open database. Backend schema bootstraps use this boundary so the migration itself remains owned by Store.
Types ¶
type CredentialCodec ¶
type CredentialCodec interface {
Prepare(context.Context, *buckets.Credential) (*buckets.Credential, error)
Parse(context.Context, *buckets.Credential) (*buckets.Credential, error)
Enabled() (bool, error)
}
CredentialCodec is the persistence boundary for credential field encoding.
type Dialect ¶
type Dialect interface {
Rebind(string) string
ListArgs(string, []string) (string, []any)
LockContentWrite(context.Context, *sql.Tx) error
Bootstrap(context.Context, *sql.DB) error
}
Dialect contains the SQL and locking behavior that cannot be shared across the SQLite and PostgreSQL implementations.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store owns the database handle and the shared, dialect-independent SQL operation state. SQLite and PostgreSQL constructors return this concrete implementation directly.
func Open ¶
Open bootstraps db through dialect and returns the shared store. A nil codec is accepted for callers that do not use credential persistence.
func OpenPrepared ¶
OpenPrepared adopts an already validated database handle without running dialect bootstrap. Production PostgreSQL startup uses this path after a read-only schema check. Schema writes stay in the SQL mounted into the cluster DB-init Job.
func (*Store) BulkDeleteObjects ¶
func (*Store) BulkUpdateAccessMethods ¶
func (*Store) ClaimMultipartAbort ¶
func (*Store) ClaimMultipartCompletion ¶
func (*Store) ClaimMultipartCompletionWithParts ¶
func (*Store) CompactCompletedMultipartSessions ¶
func (*Store) ConsumePendingMetadata ¶
func (db *Store) ConsumePendingMetadata(ctx context.Context, expected transferlfs.PendingMetadata) (bool, error)
ConsumePendingMetadata removes the expected pending entry if it is still the entry that was read by the caller. A missing or replaced entry is an expected no-op: another stage or verification operation owns that metadata.
func (*Store) CreateBucketScope ¶
func (*Store) CreateObjectAlias ¶
func (*Store) DB ¶
DB exposes the owned handle to backend migration tests that must assert schema and transaction behavior directly.
func (*Store) DeleteBucketScopeConfiguration ¶
func (db *Store) DeleteBucketScopeConfiguration(ctx context.Context, scope buckets.Scope) ([]string, error)
DeleteBucketScopeConfiguration atomically removes one scope and its unused credential. Returned aliases are safe to invalidate because commit succeeded.
func (*Store) DeleteS3Credential ¶
func (*Store) FinishMultipartAbort ¶
func (*Store) FinishMultipartCompletion ¶
func (*Store) GetBucketScope ¶
func (*Store) GetBulkObjects ¶
func (*Store) GetFileUsage ¶
func (*Store) GetFileUsageSummary ¶
func (db *Store) GetFileUsageSummary(ctx context.Context, inactiveSince *time.Time) (metricsapi.FileUsageSummary, error)
func (*Store) GetFileUsageSummaryByResources ¶
func (db *Store) GetFileUsageSummaryByResources(ctx context.Context, resources []string, includeUnscoped bool, inactiveSince *time.Time) (metricsapi.FileUsageSummary, error)
func (*Store) GetFileUsageSummaryByScope ¶
func (db *Store) GetFileUsageSummaryByScope(ctx context.Context, organization, project string, inactiveSince *time.Time) (metricsapi.FileUsageSummary, error)
func (*Store) GetMultipartCompletionReceipt ¶
func (*Store) GetMultipartSession ¶
func (*Store) GetObjectsByChecksums ¶
func (*Store) GetPendingMetadata ¶
func (db *Store) GetPendingMetadata(ctx context.Context, oid string) (*transferlfs.PendingMetadata, error)
func (*Store) GetProjectRecordSummaryByScope ¶
func (db *Store) GetProjectRecordSummaryByScope(ctx context.Context, organization, project string) (metricsapi.FileUsageSummary, error)
func (*Store) GetPublicReadByIDs ¶
func (*Store) GetS3Credential ¶
func (*Store) ListBucketScopes ¶
func (*Store) ListBucketVisibilityRows ¶
func (*Store) ListFileUsage ¶
func (*Store) ListFileUsageByObjectIDs ¶
func (*Store) ListFileUsagePageByResources ¶
func (*Store) ListFileUsagePageByScope ¶
func (*Store) ListMultipartSessionsForReconcile ¶
func (*Store) ListObjectIDsByResources ¶
func (*Store) ListObjectIDsByScope ¶
func (*Store) ListObjectIDsPageByAuthorizedScope ¶
func (*Store) ListObjectIDsPageByScope ¶
func (*Store) ListObjectIDsPageByURL ¶
func (*Store) ListS3Credentials ¶
func (*Store) ListScopedObjectIDsByChecksums ¶
func (*Store) QueryTransferBreakdown ¶
func (db *Store) QueryTransferBreakdown(ctx context.Context, filter usage.Filter, groupBy string, resources []string) ([]metricsapi.TransferAttributionBreakdown, error)
func (*Store) QueryTransferSummary ¶
func (db *Store) QueryTransferSummary(ctx context.Context, filter usage.Filter, resources []string) (metricsapi.TransferAttributionSummary, error)
func (*Store) RecordFileDownload ¶
func (*Store) RecordFileUpload ¶
func (*Store) RecordProviderTransferEvents ¶
func (db *Store) RecordProviderTransferEvents(ctx context.Context, events []metricsapi.ProviderTransferEvent) error
func (*Store) RecordTransferAttributionEvents ¶
func (*Store) RegisterObjects ¶
RegisterObjects is the content identity write boundary. Every SHA-bearing registration is merged while the SQLite writer lock is held, so the parent row, children, aliases, and public policy commit together.
func (*Store) ReleaseMultipartCompletion ¶
func (*Store) RemoveObjectControlledAccess ¶
func (*Store) RemoveObjectControlledAccessBulk ¶
func (*Store) RepairCanonicalDuplicates ¶
func (db *Store) RepairCanonicalDuplicates(ctx context.Context, repairs []objects.CanonicalRepair) error
RepairCanonicalDuplicates is the transactional repair boundary for legacy physical rows that share one checksum. Duplicate rows are removed before the merged canonical row is registered, because registration rejects an ambiguous checksum family. The whole operation, including alias creation, commits or rolls back together.
func (*Store) ReplaceObjects ¶
ReplaceObjects is the checked, atomic boundary for whole-object updates. Registration remains additive; replacement is reserved for callers that have update authority over every current grant.
func (*Store) ResolveObjectAlias ¶
func (*Store) SaveBucketConfiguration ¶
func (db *Store) SaveBucketConfiguration(ctx context.Context, configuration buckets.BucketConfiguration) error
SaveBucketConfiguration atomically persists a credential and its scope. A failure in either write leaves both rows unchanged.
func (*Store) SaveMultipartSession ¶
func (*Store) SavePendingMetadata ¶
func (db *Store) SavePendingMetadata(ctx context.Context, entries []transferlfs.PendingMetadata) error