MCPcopy Create free account
hub / github.com/Permify/permify / List

Method List

internal/servers/schema_server.go:232–258  ·  view source on GitHub ↗

List retrieves all schema versions for a tenant with pagination

(ctx context.Context, request *v1.SchemaListRequest)

Source from the content-addressed store, hash-verified

230
231// List retrieves all schema versions for a tenant with pagination
232func (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}

Callers

nothing calls this directly

Implementers 1

UnimplementedSchemaServerpkg/pb/base/v1/service_grpc.pb.go

Calls 12

NewPaginationFunction · 0.92
SizeFunction · 0.92
TokenFunction · 0.92
GetStatusFunction · 0.85
StartMethod · 0.80
ListSchemasMethod · 0.65
HeadVersionMethod · 0.65
StringMethod · 0.65
GetTenantIdMethod · 0.45
GetPageSizeMethod · 0.45
GetContinuousTokenMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected