MCPcopy Index your code
hub / github.com/PasarGuard/node / SyncUser

Method SyncUser

controller/rpc/user.go:17–35  ·  view source on GitHub ↗
(stream grpc.ClientStreamingServer[common.User, common.Empty])

Source from the content-addressed store, hash-verified

15)
16
17func (s *Service) SyncUser(stream grpc.ClientStreamingServer[common.User, common.Empty]) error {
18 for {
19 user, err := stream.Recv()
20 if err != nil {
21 return stream.SendAndClose(&common.Empty{})
22 }
23
24 if user.GetEmail() == "" {
25 return errors.New("email is required")
26 }
27
28 log.Printf("Got user: %v", user.GetEmail())
29
30 if err = s.Backend().SyncUser(stream.Context(), user); err != nil {
31 log.Printf("Error syncing user: %v", err)
32 return status.Errorf(codes.Internal, "failed to update user: %v", err)
33 }
34 }
35}
36
37func (s *Service) SyncUsers(ctx context.Context, users *common.Users) (*common.Empty, error) {
38 if err := s.Backend().SyncUsers(ctx, users.GetUsers()); err != nil {

Callers

nothing calls this directly

Implementers 1

Controllercontroller/controller.go

Calls 3

BackendMethod · 0.80
GetEmailMethod · 0.65
SyncUserMethod · 0.65

Tested by

no test coverage detected