List retrieves all schema versions for a tenant with pagination
(ctx context.Context, request *v1.SchemaListRequest)
| 230 | |
| 231 | // List retrieves all schema versions for a tenant with pagination |
| 232 | func (r *SchemaServer) List(ctx context.Context, request *v1.SchemaListRequest) (*v1.SchemaListResponse, error) { // List schemas |
| 233 | ctx, span := internal.Tracer.Start(ctx, "schemas.list") |
| 234 | defer span.End() |
| 235 | // Fetch schemas with pagination |
| 236 | schemas, ct, err := r.sr.ListSchemas(ctx, request.GetTenantId(), database.NewPagination(database.Size(request.GetPageSize()), database.Token(request.GetContinuousToken()))) // List schemas |
| 237 | if err != nil { // Check for errors |
| 238 | span.RecordError(err) // Record error in span |
| 239 | span.SetStatus(otelCodes.Error, err.Error()) // Set error status |
| 240 | slog.ErrorContext(ctx, err.Error()) |
| 241 | return nil, status.Error(GetStatus(err), err.Error()) // Return list error |
| 242 | } |
| 243 | |
| 244 | // Get the latest version |
| 245 | head, err := r.sr.HeadVersion(ctx, request.GetTenantId()) // Get head version |
| 246 | if err != nil { // Check for errors |
| 247 | return nil, status.Error(GetStatus(err), err.Error()) // Return version error |
| 248 | } |
| 249 | |
| 250 | // Record metrics |
| 251 | r.listSchemaHistogram.Record(ctx, 1) |
| 252 | // Return schema list response |
| 253 | return &v1.SchemaListResponse{ // Create response |
| 254 | Head: head, |
| 255 | Schemas: schemas, |
| 256 | ContinuousToken: ct.String(), |
| 257 | }, nil |
| 258 | } |
nothing calls this directly
no test coverage detected