storage

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FindingLegacyAccessURLRemovable  = "legacy_access_url_removable"
	FindingLegacyAccessURLRewritable = "legacy_access_url_rewritable"
	FindingNonCanonicalAccessURL     = "non_canonical_access_url"
	FindingMissingControlledAccess   = "missing_controlled_access"
	FindingDuplicateSHA256Sibling    = "duplicate_sha256_sibling"
	FindingStorageObjectMissing      = "storage_object_missing"
	FindingStorageProbeError         = "storage_probe_error"

	SeverityInfo  = "info"
	SeverityWarn  = "warn"
	SeverityError = "error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CredentialReader

type CredentialReader interface {
	GetS3Credential(context.Context, string) (*buckets.Credential, error)
	ListS3Credentials(context.Context) ([]buckets.Credential, error)
}

type DeletePort

type DeletePort interface {
	DeleteExact(context.Context, []storage.DeleteTarget) error
}

type Dependencies

type Dependencies struct {
	ScopeResolver ScopeResolver
	Credentials   CredentialReader
	Visibility    VisibilityReader
	Records       RecordRepairer
	ObjectCleanup ObjectScopeDeleter
	ScopeCatalog  ScopeCatalog
	Providers     Providers
}

type Error

type Error struct {
	Kind    ErrorKind
	Message string
	Cause   error
}

Error is a typed maintenance error. HTTP adapters map its Kind to status codes; domain callers can use errors.As without importing HTTP packages.

func (*Error) Error

func (e *Error) Error() string

func (*Error) ErrorCategory added in v0.4.1

func (e *Error) ErrorCategory() errorapi.ErrorCategory

func (*Error) ErrorCode added in v0.4.1

func (e *Error) ErrorCode() errorapi.ErrorCode

func (*Error) Is added in v0.4.1

func (e *Error) Is(target error) bool

func (*Error) PublicMessage added in v0.4.1

func (e *Error) PublicMessage() string

func (*Error) Unwrap added in v0.4.1

func (e *Error) Unwrap() error

type ErrorKind

type ErrorKind string
const (
	ErrorInvalidInput      ErrorKind = "invalid_input"
	ErrorScopeNotFound     ErrorKind = "scope_not_found"
	ErrorCredentialMissing ErrorKind = "credential_missing"
	ErrorPermissionDenied  ErrorKind = "permission_denied"
	ErrorObjectNotFound    ErrorKind = "object_not_found"
	ErrorBucketUnavailable ErrorKind = "bucket_unavailable"
	ErrorListingIncomplete ErrorKind = "listing_incomplete"
	ErrorUnsupported       ErrorKind = "unsupported"
)

type InspectionMode

type InspectionMode string

InspectionMode controls the amount of inventory returned by InspectProjectStorage.

const (
	ModeItems   InspectionMode = "items"
	ModeExists  InspectionMode = "exists"
	ModeSummary InspectionMode = "summary"
)

type InspectionOptions

type InspectionOptions struct {
	Mode        InspectionMode
	IncludeHead bool
	PathPrefix  string
}

type InventoryPort

type InventoryPort interface {
	Inventory(context.Context, storage.InventoryRequest) (storage.InventoryResult, error)
}

type ObjectScopeDeleter

type ObjectScopeDeleter interface {
	DeleteBulkByScope(context.Context, string, string) (int, error)
}

type ProbePort

type ProbePort interface {
	Probe(context.Context, []storage.ProbeTarget) []storage.ProbeResult
}

type ProjectCleanupResult

type ProjectCleanupResult struct {
	Organization        string
	ProjectID           string
	DeletedObjects      int
	DeletedBucketScopes int
}

ProjectCleanupResult reports the durable rows removed by one project cleanup.

type Providers added in v0.4.2

type Providers struct {
	Inventory InventoryPort
	Probe     ProbePort
	Delete    DeletePort
}

type RecordRepairer added in v0.4.2

type RecordRepairer interface {
	ListObjects(context.Context, objects.RecordListQuery) ([]drs.DrsObject, error)
	ListRepairCandidates(context.Context, objects.RepairCandidateQuery) (objects.RepairCandidatePage, error)
	ListPhysicalObjectsByScope(context.Context, string, string, string) ([]drs.DrsObject, error)
	RepairMissingControlledAccess(context.Context, string, string, objects.Scope) error
	UpdateObjectMetadata(context.Context, string, drs.DrsObject, objects.Scope, *int64) (drs.DrsObject, error)
	CollapseProjectChecksumDuplicates(context.Context, string, string) (int, error)
}

type ScopeCatalog

type ScopeCatalog interface {
	ListBucketScopes(context.Context) ([]buckets.Scope, error)
	DeleteBucketScope(context.Context, string, string, string, string) error
}

type ScopeResolver added in v0.4.2

type ScopeResolver interface {
	ResolveStorageScope(context.Context, string, string) (buckets.StorageScope, error)
}

type Service

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

func NewService

func NewService(deps Dependencies) *Service

func (*Service) ApplyAuthorized added in v0.4.2

ApplyAuthorized requires read and update access for the requested scope before applying repairs.

func (*Service) AuditAuthorized added in v0.4.2

AuditAuthorized checks read access for the requested scope before auditing it.

func (*Service) DeleteProjectDataAuthorized added in v0.4.2

func (s *Service) DeleteProjectDataAuthorized(ctx context.Context, organization, project string) (ProjectCleanupResult, error)

DeleteProjectDataAuthorized applies the maintenance write policy before entering the trusted cleanup sequence.

func (*Service) DeleteProjectObjects added in v0.4.2

func (s *Service) DeleteProjectObjects(ctx context.Context, organization, project string, objectURLs []string) []internalapi.InternalDeleteProjectBucketObjectsItem

DeleteProjectObjects authorizes each URL against the resolved S3 scope, deduplicates in first-seen order, and dispatches exact physical URLs one at a time. This preserves per-item provider failures and retry ordering.

func (*Service) InspectProjectRecords added in v0.4.2

func (s *Service) InspectProjectRecords(ctx context.Context, organization, project, pathPrefix string) ([]drs.DrsObject, error)

InspectProjectRecords returns the physical catalog rows associated with a project and optionally restricts them to a logical or configured S3 prefix.

func (*Service) InspectProjectStorage added in v0.4.2

func (s *Service) InspectProjectStorage(ctx context.Context, organization, project string, options InspectionOptions) (*internalapi.InternalInspectProjectBucketResponse, error)

InspectProjectStorage inventories the S3 target selected by the project's configured scope.

func (*Service) ProbeObject added in v0.4.2

func (*Service) ProbeObjects added in v0.4.2

func (*Service) ValidateInventoryObjects added in v0.4.2

ValidateInventoryObjects compares requested physical S3 locations with inventory evidence. Exact targets are deduplicated, dense sibling keys are coalesced at the historical threshold, and output is always restored to input order including duplicate requests.

type VisibilityReader

type VisibilityReader interface {
	ListVisibleBuckets(context.Context) (map[string]buckets.VisibleBucket, error)
}

Jump to

Keyboard shortcuts

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