env_workspace

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrParentUnpinned, IsErrParentUnpinned = errors.MakeTypedSentinel[pkgErrDisamb](
	"workspace parent is not pinned",
)

ErrParentUnpinned reports that a workspace's parent has no pinned pubkey (#287b): a legacy V1 workspace written before pinning, or one not yet pinned. Callers branch on it to choose the legacy path (TTY confirm-pin vs non-TTY hard fail) rather than treating it as a verification failure.

Functions

func AssertParentPubkeyMatches added in v0.2.7

func AssertParentPubkeyMatches(
	pinned string,
	live mad_domain_interfaces.MarklId,
) (err error)

AssertParentPubkeyMatches enforces the #287b invariant: a workspace's resolved parent must be the repo whose pubkey was pinned. pinned is the stored StringWithFormat() form ("" when unpinned); live is the parent repo's current public key. Returns ErrParentUnpinned when pinned=="" so the caller can decide the legacy path (TTY confirm-pin vs non-TTY hard fail), and a mismatch error otherwise.

func Make

func Make(
	envLocal env_local.Env,
	config Config,
	deletedPrinter interfaces.FuncIter[*fd.FD],
	envRepo env_repo.Env,
) (outputEnv *env, err error)

Types

type Config

type Env

type Env interface {
	mad_env_dir.Env
	GetWorkspaceDir() string
	AssertNotTemporary(errors.Context)
	AssertNotTemporaryOrOfferToCreate(errors.Context)
	IsTemporary() bool
	GetWorkspaceConfigTyped() workspace_config_blobs.TypedConfig
	GetWorkspaceConfig() workspace_config_blobs.Config
	GetWorkspaceConfigFilePath() string
	GetDefaults() repo_configs.Defaults
	CreateWorkspace(workspace_config_blobs.Config) (err error)
	GetParentPath() string
	GetSyncBaseline() (tai string, digest string)
	UpdateSyncBaseline(inventoryListStore sku.InventoryListStore) error
	GetParentPubkey() string
	PinParentPubkey(pubkey string) error
	GetStore() *Store

	// TODO identify users of this and reduce / isolate them
	GetStoreFS() *store_fs.Store

	SetWorkspaceTypes(map[string]*Store) (err error)
	SetSupplies(store_workspace.Supplies) (err error)

	Flush() (err error)
}

type ErrNotInWorkspace

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

func (ErrNotInWorkspace) AssertNotTemporary

func (env ErrNotInWorkspace) AssertNotTemporary(context errors.Context)

func (ErrNotInWorkspace) AssertNotTemporaryOrOfferToCreate

func (env ErrNotInWorkspace) AssertNotTemporaryOrOfferToCreate(context errors.Context)

func (ErrNotInWorkspace) CreateWorkspace

func (env ErrNotInWorkspace) CreateWorkspace(
	blob workspace_config_blobs.Config,
) (err error)

func (ErrNotInWorkspace) Error

func (err ErrNotInWorkspace) Error() string

func (ErrNotInWorkspace) Flush

func (env ErrNotInWorkspace) Flush() (err error)

func (ErrNotInWorkspace) GetDefaults

func (env ErrNotInWorkspace) GetDefaults() repo_configs.Defaults

func (ErrNotInWorkspace) GetErrorType

func (err ErrNotInWorkspace) GetErrorType() pkgErrDisamb

func (ErrNotInWorkspace) GetParentPath

func (env ErrNotInWorkspace) GetParentPath() string

func (ErrNotInWorkspace) GetParentPubkey added in v0.2.7

func (env ErrNotInWorkspace) GetParentPubkey() string

GetParentPubkey returns the pinned parent repo public key (#287b), or "" for a workspace whose parent has not been pinned (legacy V1 written before pinning, or a config version without the field).

func (ErrNotInWorkspace) GetStore

func (env ErrNotInWorkspace) GetStore() *Store

func (ErrNotInWorkspace) GetStoreFS

func (env ErrNotInWorkspace) GetStoreFS() *store_fs.Store

func (ErrNotInWorkspace) GetSyncBaseline

func (env ErrNotInWorkspace) GetSyncBaseline() (tai string, digest string)

func (ErrNotInWorkspace) GetWorkspaceConfig

func (env ErrNotInWorkspace) GetWorkspaceConfig() workspace_config_blobs.Config

func (ErrNotInWorkspace) GetWorkspaceConfigFilePath

func (env ErrNotInWorkspace) GetWorkspaceConfigFilePath() string

func (ErrNotInWorkspace) GetWorkspaceConfigTyped

func (env ErrNotInWorkspace) GetWorkspaceConfigTyped() workspace_config_blobs.TypedConfig

func (ErrNotInWorkspace) GetWorkspaceDir

func (env ErrNotInWorkspace) GetWorkspaceDir() string

func (ErrNotInWorkspace) Is

func (err ErrNotInWorkspace) Is(target error) bool

func (ErrNotInWorkspace) IsTemporary

func (env ErrNotInWorkspace) IsTemporary() bool

func (ErrNotInWorkspace) PinParentPubkey added in v0.2.7

func (env ErrNotInWorkspace) PinParentPubkey(pubkey string) (err error)

PinParentPubkey records pubkey as the workspace's pinned parent identity and rewrites the config. Only V1-and-later (repo-backed) workspaces carry the field; on a V0 / non-pinnable config it is a no-op so callers need not type switch.

func (ErrNotInWorkspace) Recover

func (ErrNotInWorkspace) SetSupplies

func (env ErrNotInWorkspace) SetSupplies(supplies store_workspace.Supplies) (err error)

func (ErrNotInWorkspace) SetWorkspaceTypes

func (env ErrNotInWorkspace) SetWorkspaceTypes(
	stores map[string]*Store,
) (err error)

TODO persist store types and bootstrap based on workspace config

func (ErrNotInWorkspace) ShouldShowStackTrace

func (err ErrNotInWorkspace) ShouldShowStackTrace() bool

func (ErrNotInWorkspace) UpdateSyncBaseline

func (env ErrNotInWorkspace) UpdateSyncBaseline(
	inventoryListStore sku.InventoryListStore,
) (err error)

type ErrUnsupportedOperation

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

func (ErrUnsupportedOperation) Error

func (e ErrUnsupportedOperation) Error() string

func (ErrUnsupportedOperation) GetErrorType

func (e ErrUnsupportedOperation) GetErrorType() pkgErrDisamb

func (ErrUnsupportedOperation) Is

func (e ErrUnsupportedOperation) Is(target error) bool

type ErrUnsupportedType

type ErrUnsupportedType struct {
	Type ids.Type
}

func (ErrUnsupportedType) Error

func (err ErrUnsupportedType) Error() string

func (ErrUnsupportedType) GetErrorType

func (err ErrUnsupportedType) GetErrorType() pkgErrDisamb

func (ErrUnsupportedType) Is

func (err ErrUnsupportedType) Is(target error) bool

type Store

type Store struct {
	store_workspace.Supplies
	store_workspace.StoreLike
	// contains filtered or unexported fields
}

func (*Store) CheckoutOne

func (store *Store) CheckoutOne(
	options checkout_options.Options,
	transactedGetter sku.TransactedGetter,
) (checkedOut sku.SkuType, err error)

func (*Store) DeleteCheckedOut

func (store *Store) DeleteCheckedOut(el *sku.CheckedOut) (err error)

func (*Store) Flush

func (store *Store) Flush() (err error)

func (*Store) GetObjectIdsForString

func (store *Store) GetObjectIdsForString(
	idString string,
) (ids []sku.ExternalObjectId, err error)

func (*Store) Initialize

func (store *Store) Initialize() (err error)

func (*Store) Merge

func (store *Store) Merge(
	conflicted sku.Conflicted,
) (err error)

func (*Store) MergeCheckedOut

func (store *Store) MergeCheckedOut(
	co *sku.CheckedOut,
	parentNegotiator sku.ParentNegotiator,
	allowMergeConflicts bool,
) (commitOptions sku.CommitOptions, err error)

func (*Store) Open

func (store *Store) Open(
	m checkout_mode.Mode,
	ph interfaces.FuncIter[string],
	zsc sku.SkuTypeSet,
) (err error)

func (*Store) QueryCheckedOut

func (store *Store) QueryCheckedOut(
	qg *queries.Query,
	f interfaces.FuncIter[sku.SkuType],
) (err error)

func (*Store) ReadAllExternalItems

func (store *Store) ReadAllExternalItems() (err error)

func (*Store) ReadCheckedOutFromTransacted

func (store *Store) ReadCheckedOutFromTransacted(
	object *sku.Transacted,
) (checkedOut *sku.CheckedOut, err error)

func (*Store) ReadExternalLikeFromObjectIdLike

func (store *Store) ReadExternalLikeFromObjectIdLike(
	commitObjects sku.CommitOptions,
	id interfaces.Stringer,
	objectInput *sku.Transacted,
) (objectOutput sku.ExternalLike, err error)

func (*Store) ReadTransactedFromObjectId

func (store *Store) ReadTransactedFromObjectId(
	o sku.CommitOptions,
	k1 ids.Id,
	t *sku.Transacted,
) (e sku.ExternalLike, err error)

func (*Store) SaveBlob

func (store *Store) SaveBlob(el sku.ExternalLike) (err error)

func (*Store) UpdateCheckoutFromCheckedOut

func (store *Store) UpdateCheckoutFromCheckedOut(
	options checkout_options.OptionsWithoutMode,
	col sku.SkuType,
) (err error)

func (*Store) UpdateTransacted

func (store *Store) UpdateTransacted(z *sku.Transacted) (err error)

Takes a given sku.Transacted (internal) and updates it with the state of its checked out counterpart (external).

func (*Store) UpdateTransactedFromBlobs

func (store *Store) UpdateTransactedFromBlobs(z sku.ExternalLike) (err error)

Source Files

  • errors.go
  • errors_not_in_workspace.go
  • main.go
  • store.go

Jump to

Keyboard shortcuts

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