slask
Some checks failed
Build and Publish / BuildAndDeployAmd64 (push) Successful in 38s
Build and Publish / BuildAndDeployArm64 (push) Has been cancelled

This commit is contained in:
matst80
2025-12-02 09:04:42 +01:00
parent 060b3dfbf0
commit ee1b96fece
6 changed files with 254 additions and 76 deletions

View File

@@ -2,6 +2,7 @@ package actor
import (
"context"
"encoding/json"
"fmt"
"log"
"net"
@@ -15,6 +16,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb"
)
// ControlServer implements the ControlPlane gRPC services.
@@ -105,6 +107,22 @@ func (s *ControlServer[V]) AnnounceOwnership(ctx context.Context, req *messages.
}, nil
}
func (s *ControlServer[V]) Get(ctx context.Context, req *messages.GetRequest) (*messages.GetReply, error) {
grain, err := s.pool.Get(ctx, req.Id)
if err != nil {
return nil, err
}
data, err := json.Marshal(grain)
if err != nil {
return nil, err
}
return &messages.GetReply{
Grain: &anypb.Any{
Value: data,
},
}, nil
}
func (s *ControlServer[V]) AnnounceExpiry(ctx context.Context, req *messages.ExpiryAnnounce) (*messages.OwnerChangeAck, error) {
ctx, span := tracer.Start(ctx, "grpc_announce_expiry")
defer span.End()