Documentation
¶
Index ¶
- func AnalysisFromStore(op *store.Operation) *analysispb.Analysis
- func NewAnalyzer() analysispb.AnalysisServiceServer
- func OperationFromStore(op *store.Operation) *longrunningpb.Operation
- func ToProtoState(s store.State) analysispb.Analysis_State
- type Analyzer
- func (a *Analyzer) CreateAnalysis(ctx context.Context, req *analysispb.CreateAnalysisRequest) (*longrunningpb.Operation, error)
- func (a *Analyzer) GetAnalysis(ctx context.Context, req *analysispb.GetAnalysisRequest) (*analysispb.Analysis, error)
- func (a *Analyzer) ListAnalyses(ctx context.Context, req *analysispb.ListAnalysesRequest) (*analysispb.ListAnalysesResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnalysisFromStore ¶
func AnalysisFromStore(op *store.Operation) *analysispb.Analysis
toAnalysis converts a store.Operation to its proto representation. The resource name is always the analysis form: "analyses/{uuid}".
func NewAnalyzer ¶
func NewAnalyzer() analysispb.AnalysisServiceServer
func OperationFromStore ¶
func OperationFromStore(op *store.Operation) *longrunningpb.Operation
toOperation wraps a store.Operation in an AIP-151 LRO. The operation name is always the LRO form: "operations/{uuid}". done=true when the operation has reached a terminal state.
func ToProtoState ¶
func ToProtoState(s store.State) analysispb.Analysis_State
toProtoState maps a store.State to its analysispb.Analysis_State counterpart.
Types ¶
type Analyzer ¶
type Analyzer struct {
analysispb.UnimplementedAnalysisServiceServer
}
func (*Analyzer) CreateAnalysis ¶
func (a *Analyzer) CreateAnalysis( ctx context.Context, req *analysispb.CreateAnalysisRequest, ) (*longrunningpb.Operation, error)
CreateAnalysis implements the AIP-133 Create + AIP-151 LRO pattern.
Flow:
- Validate the request.
- Check the input-hash cache — return existing SUCCEEDED operation if hit.
- Resolve the operation name (client-provided or server-assigned).
- If the operation name already exists, return the existing operation.
- Insert the row as RUNNING and fire the executor goroutine.
- Return the LRO immediately (done=false if still running).
func (*Analyzer) GetAnalysis ¶
func (a *Analyzer) GetAnalysis( ctx context.Context, req *analysispb.GetAnalysisRequest, ) (*analysispb.Analysis, error)
GetAnalysis implements AIP-131.
The resource name may be provided in either its analysis form ("analyses/{uuid}") or its operation form ("operations/{uuid}") — both map to the same row. The returned Analysis carries the analysis resource name.
func (*Analyzer) ListAnalyses ¶
func (a *Analyzer) ListAnalyses( ctx context.Context, req *analysispb.ListAnalysesRequest, ) (*analysispb.ListAnalysesResponse, error)
ListAnalyses implements AIP-132 with keyset cursor pagination.
Results are ordered by (create_time DESC, operation_name), which:
- Returns the newest analyses first, matching typical operator usage.
- Provides a stable cursor: new rows inserted between pages only appear on page 1, never shift existing pages, enabling downstream services to use the first-page delta for drift detection.
Page size defaults to 50 and is capped at 1000. Pass NextPageToken from the previous response to advance to the next page.