ownerscope

package
v0.6.19 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package ownerscope provides the fail-closed migration boundary for durable plugin state created before owner-scoped generations were mandatory.

Index

Constants

View Source
const (
	RedevenLegacyInventoryV1       = "redeven-redevplugin-v0.1.0-v0.1.5-layout-v1"
	RedevenV065InventoryV1         = "redeven-redevplugin-v0.6.5-layout-v1"
	BuiltInInventoryRegistrySHA256 = "f655313a641368383b3d84b6ea4f6a2a2ef42a44a4dd23f71211361c9c2e0505"
)
View Source
const (
	MigrationJournalName           = ".redevplugin-owner-scope-migration-v1.json"
	CleanupJournalName             = ".redevplugin-quarantine-cleanup-v1.json"
	RootRecoveryJournalName        = ".redevplugin-owner-scope-root-recovery-v1.json"
	RootRecoveryPendingJournalName = ".redevplugin-owner-scope-root-recovery-pending-v1.json"
	RootRecoverySourceJournalName  = ".redevplugin-owner-scope-root-recovery-source-v1.json"
)

Variables

View Source
var (
	ErrOwnerScopeMigrationRequired       = errors.New("owner scope migration is required")
	ErrOwnerScopeInventoryAmbiguous      = errors.New("owner scope inventory is ambiguous")
	ErrOwnerScopeInventoryCorrupt        = errors.New("owner scope legacy inventory is corrupt")
	ErrOwnerScopeJournalCorrupt          = errors.New("owner scope migration journal is corrupt")
	ErrOwnerScopeSnapshotChanged         = errors.New("owner scope migration snapshot changed")
	ErrOwnerScopeTransition              = errors.New("owner scope migration transition is invalid")
	ErrLegacyContainmentRequired         = errors.New("legacy containment evidence is required")
	ErrInvalidQuarantineID               = errors.New("quarantine id is invalid")
	ErrOwnerScopeUnsupported             = errors.New("owner scope migration is unsupported on this platform")
	ErrOwnerScopeRecoveryRequired        = errors.New("explicit owner scope root recovery is required")
	ErrOwnerScopeRecoveryNotEligible     = errors.New("owner scope root is not eligible for recovery")
	ErrOwnerScopeRecoveryPlanMismatch    = errors.New("owner scope root recovery plan does not match")
	ErrOwnerScopeRecoveryArchiveRetained = errors.New("owner scope recovery archive must be retained")
)

Functions

This section is empty.

Types

type CleanupState

type CleanupState string
const (
	CleanupStateNone              CleanupState = ""
	CleanupStateDeletePrepared    CleanupState = "delete_prepared"
	CleanupStateDeleting          CleanupState = "deleting"
	CleanupStateReconcileRequired CleanupState = "delete_reconcile_required"
	CleanupStateDeleted           CleanupState = "deleted"
)

type LegacyContainmentEvidence

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

func NewLegacyContainmentEvidence

func NewLegacyContainmentEvidence(request LegacyContainmentRequest) LegacyContainmentEvidence

type LegacyContainmentRequest

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

func (LegacyContainmentRequest) MigrationID

func (request LegacyContainmentRequest) MigrationID() string

func (LegacyContainmentRequest) QuarantineID

func (request LegacyContainmentRequest) QuarantineID() QuarantineID

func (LegacyContainmentRequest) QuarantineSHA256

func (request LegacyContainmentRequest) QuarantineSHA256() string

func (LegacyContainmentRequest) RootIdentitySHA256

func (request LegacyContainmentRequest) RootIdentitySHA256() string

type LegacyContainmentVerifier

type LegacyContainmentVerifier interface {
	VerifyLegacyContainment(context.Context, LegacyContainmentRequest) (LegacyContainmentEvidence, error)
}

type MigrationState

type MigrationState string
const (
	StatePrepared            MigrationState = "prepared"
	StateQuarantineWriting   MigrationState = "quarantine_writing"
	StateQuarantineCommitted MigrationState = "quarantine_committed"
	StateFreshPrepared       MigrationState = "fresh_prepared"
	StateFreshCommitted      MigrationState = "fresh_committed"
	StateReconcileRequired   MigrationState = "reconcile_required"
	StateFailed              MigrationState = "failed"
)

type OwnerScopeGeneration added in v0.6.6

type OwnerScopeGeneration struct {
	Path   string
	Status Status
}

OwnerScopeGeneration is the committed durable state generation prepared for host initialization. Path is the only directory where the host should create ReDevPlugin-owned durable state.

func PrepareOwnerScopeGeneration added in v0.6.6

func PrepareOwnerScopeGeneration(ctx context.Context, rootPath string) (generation OwnerScopeGeneration, err error)

PrepareOwnerScopeGeneration opens or resumes the owner-scope migration at rootPath and returns its committed active generation. Recognized unowned legacy state is quarantined and retained; this function never deletes it. A fully committed generation may resume after only its enclosing root directory identity changed and all recorded internal snapshot identities remain exact. Copied snapshots, unknown, corrupt, failed, or reconcile-required state remain fail closed.

type OwnerScopeMigration

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

func OpenOwnerScopeMigration

func OpenOwnerScopeMigration(rootDir *os.File, options OwnerScopeMigrationOptions) (*OwnerScopeMigration, error)

func (*OwnerScopeMigration) ActiveGenerationPath added in v0.6.6

func (migration *OwnerScopeMigration) ActiveGenerationPath(rootPath string) (string, error)

ActiveGenerationPath returns the durable state root for the committed owner-scoped generation. The supplied path must still identify the exact migration root that was opened, so callers cannot redirect state through a replacement directory between migration and host initialization.

func (*OwnerScopeMigration) Close

func (migration *OwnerScopeMigration) Close() error

func (*OwnerScopeMigration) CommitFreshGeneration

func (migration *OwnerScopeMigration) CommitFreshGeneration(ctx context.Context) (Status, error)

func (*OwnerScopeMigration) DeleteQuarantine

func (migration *OwnerScopeMigration) DeleteQuarantine(ctx context.Context) (Status, error)

func (*OwnerScopeMigration) QuarantineUnownedLegacy

func (migration *OwnerScopeMigration) QuarantineUnownedLegacy(ctx context.Context) (Status, error)

func (*OwnerScopeMigration) Status

func (migration *OwnerScopeMigration) Status() Status

type OwnerScopeMigrationOptions

type OwnerScopeMigrationOptions struct {
	Containment LegacyContainmentVerifier
}

type OwnerScopeRootRecoveryPlan added in v0.6.16

type OwnerScopeRootRecoveryPlan struct {
	PlanSHA256                  string
	RootIdentitySHA256          string
	SourceRecoveryJournalSHA256 string
	SourceJournalSHA256         string
	SourceSnapshotSHA256        string
	SourceEntryCount            int
	SourceBytes                 int64
	HasRetainedQuarantine       bool
	HasSourceRecoveryJournal    bool
}

OwnerScopeRootRecoveryPlan is immutable, non-secret evidence for a host's explicit review UI. PlanSHA256 binds commit to the exact inspected root.

func InspectOwnerScopeRootRecovery added in v0.6.16

func InspectOwnerScopeRootRecovery(rootPath string) (OwnerScopeRootRecoveryPlan, error)

InspectOwnerScopeRootRecovery performs a read-only admission check for the explicit copied-root recovery transaction.

type OwnerScopeRootRecoveryResult added in v0.6.16

type OwnerScopeRootRecoveryResult struct {
	Plan        OwnerScopeRootRecoveryPlan
	State       RootRecoveryState
	RecoveryID  string
	ArchivePath string
	Generation  OwnerScopeGeneration
}

OwnerScopeRootRecoveryResult identifies the retained untrusted source and the new empty owner-scoped generation. ArchivePath is never an active root.

func RecoverOwnerScopeRoot added in v0.6.16

func RecoverOwnerScopeRoot(ctx context.Context, rootPath, expectedPlanSHA256 string) (OwnerScopeRootRecoveryResult, error)

RecoverOwnerScopeRoot explicitly archives an inspected, untrusted copied root and commits a new empty generation. expectedPlanSHA256 must come from a matching InspectOwnerScopeRootRecovery result.

type QuarantineID

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

func ParseQuarantineID

func ParseQuarantineID(value string) (QuarantineID, error)

func (QuarantineID) IsZero

func (id QuarantineID) IsZero() bool

func (QuarantineID) String

func (id QuarantineID) String() string

type RootRecoveryState added in v0.6.16

type RootRecoveryState string
const (
	RootRecoveryStatePrepared          RootRecoveryState = "prepared"
	RootRecoveryStateArchiveWriting    RootRecoveryState = "archive_writing"
	RootRecoveryStateArchiveCommitted  RootRecoveryState = "archive_committed"
	RootRecoveryStateFreshPrepared     RootRecoveryState = "fresh_prepared"
	RootRecoveryStateFreshCommitted    RootRecoveryState = "fresh_committed"
	RootRecoveryStateRebindPrepared    RootRecoveryState = "rebind_prepared"
	RootRecoveryStateReconcileRequired RootRecoveryState = "reconcile_required"
	RootRecoveryStateFailed            RootRecoveryState = "failed"
)

type Status

type Status struct {
	MigrationID           string
	RootIdentitySHA256    string
	LegacySnapshotSHA256  string
	InventoryID           string
	InventorySHA256       string
	State                 MigrationState
	QuarantineID          QuarantineID
	QuarantineSHA256      string
	FreshGenerationID     string
	FreshGenerationSHA256 string
	CleanupState          CleanupState
	Stores                []StoreStatus
}

type StoreDisposition

type StoreDisposition string
const (
	StoreDispositionQuarantine StoreDisposition = "quarantine"
	StoreDispositionTerminate  StoreDisposition = "terminate"
)

type StoreStatus

type StoreStatus struct {
	ID          string
	Scope       string
	Disposition StoreDisposition
	Generation  string
	Outcome     string
}

Jump to

Keyboard shortcuts

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