project

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

Package project — use-case-структура ProjectService. Реализует iamv1.ProjectServiceServer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateProjectUseCase

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

func NewCreateProjectUseCase

func NewCreateProjectUseCase(r Repo, opsRepo operations.Repo) *CreateProjectUseCase

func (*CreateProjectUseCase) Execute

func (*CreateProjectUseCase) WithObjectReconciler

func (u *CreateProjectUseCase) WithObjectReconciler(r ObjectReconciler) *CreateProjectUseCase

WithObjectReconciler wires the post-commit synchronous per-object materializer (rbac-contract-a-fix, C-01b / issue #232). nil-safe.

func (*CreateProjectUseCase) WithRelationStore

func (u *CreateProjectUseCase) WithRelationStore(relations clients.RelationStore, logger *slog.Logger) *CreateProjectUseCase

WithRelationStore wires the project→account hierarchy-tuple writer.

type DeleteProjectUseCase

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

func NewDeleteProjectUseCase

func NewDeleteProjectUseCase(r Repo, opsRepo operations.Repo) *DeleteProjectUseCase

func (*DeleteProjectUseCase) Execute

type GetProjectUseCase

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

func NewGetProjectUseCase

func NewGetProjectUseCase(r Repo) *GetProjectUseCase

func (*GetProjectUseCase) Execute

Execute — sync read.

Authz (Design B, D-6/D-9): the caller must hold `v_get` on project:<id> OR be a cluster-admin. Otherwise (incl. anonymous) → NotFound (hide existence). Replaces the prior authenticated-pass-through guard, which exposed every project's metadata to any authenticated caller.

func (*GetProjectUseCase) WithRelationStore

func (u *GetProjectUseCase) WithRelationStore(relations clients.RelationStore) *GetProjectUseCase

WithRelationStore wires the FGA client authorizing the read via the verb-bearing `v_get` relation on project:<id> (+ cluster-admin short-circuit). Mirrors ListProjectsUseCase. Without it a non-cluster-admin Get fails closed.

type Handler

type Handler struct {
	iamv1.UnimplementedProjectServiceServer
	// contains filtered or unexported fields
}

func (*Handler) Create

func (*Handler) Delete

func (*Handler) Get

func (*Handler) List

List — sync read with pagination.

Формат страницы судится по СЫРОМУ запросу первым стейтментом: сужение int64→int32 ниже насыщающее, и отрицательный page_size превратился бы в 0 («умолчание») до того, как его кто-либо увидит.

func (*Handler) Update

func (*Handler) WithListOperations

func (h *Handler) WithListOperations(uc *shared.ListOperationsUseCase) *Handler

WithListOperations wires the per-resource operation-listing use-case.

type ListProjectsUseCase

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

func NewListProjectsUseCase

func NewListProjectsUseCase(r Repo) *ListProjectsUseCase

func (*ListProjectsUseCase) Execute

func (*ListProjectsUseCase) WithListScanRecorder

func (u *ListProjectsUseCase) WithListScanRecorder(rec shared.ListScanRecorder) *ListProjectsUseCase

WithRelationStore wires the relation-store port. WithListScanRecorder провязывает съём стоимости страницы (#653).

func (*ListProjectsUseCase) WithRelationStore

func (u *ListProjectsUseCase) WithRelationStore(relations clients.RelationQueries) *ListProjectsUseCase

type ObjectReconciler

type ObjectReconciler interface {
	// ReconcileObjectForward is the ADDITIVE forward fast-path for the freshly-created
	// project-AS-OBJECT (iam.project): it materializes ONLY that new project's per-object
	// owner/admin tuples across the matching bindings while holding NO advisory lock at
	// all (neither EXCLUSIVE nor SHARE, no O(scope) recompute), the throughput fix for the owner-tuple
	// materialization lag under a parallel project-create burst. It transparently delegates
	// to the FULL ReconcileObject if the object already has members (delete-stale guard).
	ReconcileObjectForwardNoStale(ctx context.Context, objectType, objectID string) error
	// ReconcileObjectForward — СТОРОЖЕВОЙ вход того же прохода: он сперва читает,
	// есть ли у объекта члены, и при непустом наборе уходит на полный проход ради
	// снятия устаревших. Пути СОЗДАНИЯ он не нужен (доказательство — выше), но
	// остаётся в порту: его зовёт правка того же пакета, где прежние факты есть
	// и снятие устаревших — как раз предмет.
	ReconcileObjectForward(ctx context.Context, objectType, objectID string) error
	// ReconcileObject is the FULL EXCLUSIVE object-fan-out (async at-least-once backstop —
	// delete-stale / audit / sweep), driven by the reconcile worker off the co-committed
	// reconcile-outbox event, not the create hot-path.
	ReconcileObject(ctx context.Context, objectType, objectID string) error
}

ObjectReconciler — narrow post-commit port (rbac-contract-a-fix, C-01b / issue #232): SYNCHRONOUSLY materialize the per-object access on a freshly-created iam-native object right after the create writer-tx commits. Under the flat rights model (Contract-A) the `<rel> from account` ACCESS cascade on iam leaf types is gone, so the owner's / account-admin's per-object admin/v_* tuple on project:<id> is materialized per-object by the reconciler — and the async event drain races a client that GETs the project right after the Operation reports done (iam-project newman `get-confirms` 403). The sync call closes that race. Implemented by reconcile.Reconciler (the SAME single materialization path the worker drives). nil-safe: when unwired the co-committed reconcile event + periodic sweep still materialize it, just not synchronously.

type Reader

type Reader = kanamerepo.Reader

type Repo

type Repo = kanamerepo.Repository

type UpdateProjectInput

type UpdateProjectInput struct {
	ID          domain.ProjectID
	Name        *domain.ProjectName
	Description *domain.Description
	Labels      domain.Labels
	UpdateMask  []string
}

type UpdateProjectUseCase

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

func NewUpdateProjectUseCase

func NewUpdateProjectUseCase(r Repo, opsRepo operations.Repo) *UpdateProjectUseCase

func (*UpdateProjectUseCase) Execute

func (*UpdateProjectUseCase) WithObjectReconciler

func (u *UpdateProjectUseCase) WithObjectReconciler(r ObjectReconciler) *UpdateProjectUseCase

WithObjectReconciler wires the post-commit per-object materializer used on a LABEL change (parity with the cross-service RegisterResource re-register path — see doUpdate). Optional; nil keeps the queue-only behaviour.

func (*UpdateProjectUseCase) WithRelationStore

func (u *UpdateProjectUseCase) WithRelationStore(relations clients.RelationStore, logger *slog.Logger) *UpdateProjectUseCase

WithRelationStore wires the scope-relation authority checker.

type Writer

type Writer = kanamerepo.Writer

Jump to

Keyboard shortcuts

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