Documentation
¶
Overview ¶
Package project — use-case-структура ProjectService. Реализует iamv1.ProjectServiceServer.
Index ¶
- type CreateProjectUseCase
- func (u *CreateProjectUseCase) Execute(ctx context.Context, p domain.Project) (*operations.Operation, error)
- func (u *CreateProjectUseCase) WithObjectReconciler(r ObjectReconciler) *CreateProjectUseCase
- func (u *CreateProjectUseCase) WithRelationStore(relations clients.RelationStore, logger *slog.Logger) *CreateProjectUseCase
- type DeleteProjectUseCase
- type GetProjectUseCase
- type Handler
- func (h *Handler) Create(ctx context.Context, req *iamv1.CreateProjectRequest) (*operationpb.Operation, error)
- func (h *Handler) Delete(ctx context.Context, req *iamv1.DeleteProjectRequest) (*operationpb.Operation, error)
- func (h *Handler) Get(ctx context.Context, req *iamv1.GetProjectRequest) (*iamv1.Project, error)
- func (h *Handler) List(ctx context.Context, req *iamv1.ListProjectsRequest) (*iamv1.ListProjectsResponse, error)
- func (h *Handler) ListOperations(ctx context.Context, req *iamv1.ListProjectOperationsRequest) (*iamv1.ListProjectOperationsResponse, error)
- func (h *Handler) Update(ctx context.Context, req *iamv1.UpdateProjectRequest) (*operationpb.Operation, error)
- func (h *Handler) WithListOperations(uc *shared.ListOperationsUseCase) *Handler
- type ListProjectsUseCase
- func (u *ListProjectsUseCase) Execute(ctx context.Context, f project.ListFilter) ([]domain.Project, string, error)
- func (u *ListProjectsUseCase) WithListScanRecorder(rec shared.ListScanRecorder) *ListProjectsUseCase
- func (u *ListProjectsUseCase) WithRelationStore(relations clients.RelationQueries) *ListProjectsUseCase
- type ObjectReconciler
- type Reader
- type Repo
- type UpdateProjectInput
- type UpdateProjectUseCase
- func (u *UpdateProjectUseCase) Execute(ctx context.Context, in UpdateProjectInput) (*operations.Operation, error)
- func (u *UpdateProjectUseCase) WithObjectReconciler(r ObjectReconciler) *UpdateProjectUseCase
- func (u *UpdateProjectUseCase) WithRelationStore(relations clients.RelationStore, logger *slog.Logger) *UpdateProjectUseCase
- type Writer
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 (u *CreateProjectUseCase) Execute(ctx context.Context, p domain.Project) (*operations.Operation, error)
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 ¶
func (u *DeleteProjectUseCase) Execute(ctx context.Context, id domain.ProjectID) (*operations.Operation, error)
type GetProjectUseCase ¶
type GetProjectUseCase struct {
// contains filtered or unexported fields
}
func NewGetProjectUseCase ¶
func NewGetProjectUseCase(r Repo) *GetProjectUseCase
func (*GetProjectUseCase) Execute ¶
func (u *GetProjectUseCase) Execute(ctx context.Context, id domain.ProjectID) (domain.Project, error)
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 NewHandler ¶
func NewHandler(c *CreateProjectUseCase, u *UpdateProjectUseCase, d *DeleteProjectUseCase, g *GetProjectUseCase, l *ListProjectsUseCase) *Handler
func (*Handler) Create ¶
func (h *Handler) Create(ctx context.Context, req *iamv1.CreateProjectRequest) (*operationpb.Operation, error)
func (*Handler) Delete ¶
func (h *Handler) Delete(ctx context.Context, req *iamv1.DeleteProjectRequest) (*operationpb.Operation, error)
func (*Handler) List ¶
func (h *Handler) List(ctx context.Context, req *iamv1.ListProjectsRequest) (*iamv1.ListProjectsResponse, error)
List — sync read with pagination.
Формат страницы судится по СЫРОМУ запросу первым стейтментом: сужение int64→int32 ниже насыщающее, и отрицательный page_size превратился бы в 0 («умолчание») до того, как его кто-либо увидит.
func (*Handler) ListOperations ¶
func (h *Handler) ListOperations(ctx context.Context, req *iamv1.ListProjectOperationsRequest) (*iamv1.ListProjectOperationsResponse, error)
func (*Handler) Update ¶
func (h *Handler) Update(ctx context.Context, req *iamv1.UpdateProjectRequest) (*operationpb.Operation, error)
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 (u *ListProjectsUseCase) Execute(ctx context.Context, f project.ListFilter) ([]domain.Project, string, error)
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 (u *UpdateProjectUseCase) Execute(ctx context.Context, in UpdateProjectInput) (*operations.Operation, error)
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