mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
Add GetVDS and GetVDSs gRPC implementations
This commit is contained in:
parent
35675a3e59
commit
559a2c6864
1 changed files with 15 additions and 4 deletions
|
|
@ -75,12 +75,23 @@ func errToStatusError(err error) error {
|
|||
return status.Error(codes.Unknown, err.Error())
|
||||
}
|
||||
|
||||
func (*GRPCHandler) GetVDS(ctx context.Context, req *pb.GetVDSRequest) (*pb.GetVDSResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetVDS not implemented")
|
||||
func (h *GRPCHandler) GetVDS(ctx context.Context, req *pb.GetVDSRequest) (*pb.GetVDSResponse, error) {
|
||||
schema := h.api.Schema(ctx)
|
||||
for _, index := range schema {
|
||||
if req.Name == index.Name {
|
||||
return &pb.GetVDSResponse{Vds: &pb.VDS{Name: index.Name}}, nil
|
||||
}
|
||||
}
|
||||
return nil, status.Error(codes.NotFound, fmt.Sprintf("VDS with name %s not found", req.Name))
|
||||
}
|
||||
|
||||
func (*GRPCHandler) GetVDSs(ctx context.Context, req *pb.GetVDSsRequest) (*pb.GetVDSsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetVDSs not implemented")
|
||||
func (h *GRPCHandler) GetVDSs(ctx context.Context, req *pb.GetVDSsRequest) (*pb.GetVDSsResponse, error) {
|
||||
schema := h.api.Schema(ctx)
|
||||
vdss := make([]*pb.VDS, len(schema))
|
||||
for i, index := range schema {
|
||||
vdss[i] = &pb.VDS{Name: index.Name}
|
||||
}
|
||||
return &pb.GetVDSsResponse{Vdss: vdss}, nil
|
||||
}
|
||||
|
||||
func (*GRPCHandler) PostVDS(ctx context.Context, req *pb.PostVDSRequest) (*pb.PostVDSResponse, error) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue