(srv grpcapi.KopiaRepository_SessionServer, dr repo.DirectRepository)
| 587 | } |
| 588 | |
| 589 | func (s *Server) handleInitialSessionHandshake(srv grpcapi.KopiaRepository_SessionServer, dr repo.DirectRepository) (repo.WriteSessionOptions, error) { |
| 590 | initializeReq, err := srv.Recv() |
| 591 | if err != nil { |
| 592 | return repo.WriteSessionOptions{}, errors.Wrap(err, "unable to read initialization request") |
| 593 | } |
| 594 | |
| 595 | ir := initializeReq.GetInitializeSession() |
| 596 | if ir == nil { |
| 597 | return repo.WriteSessionOptions{}, errors.New("missing initialization request") |
| 598 | } |
| 599 | |
| 600 | scc := dr.ContentReader().SupportsContentCompression() |
| 601 | |
| 602 | if err := s.send(srv, initializeReq.GetRequestId(), &grpcapi.SessionResponse{ |
| 603 | Response: &grpcapi.SessionResponse_InitializeSession{ |
| 604 | InitializeSession: &grpcapi.InitializeSessionResponse{ |
| 605 | Parameters: &grpcapi.RepositoryParameters{ |
| 606 | HashFunction: dr.ContentReader().ContentFormat().GetHashFunction(), |
| 607 | HmacSecret: dr.ContentReader().ContentFormat().GetHmacSecret(), |
| 608 | Splitter: dr.ObjectFormat().Splitter, |
| 609 | SupportsContentCompression: scc, |
| 610 | }, |
| 611 | }, |
| 612 | }, |
| 613 | }); err != nil { |
| 614 | return repo.WriteSessionOptions{}, errors.Wrap(err, "unable to send response") |
| 615 | } |
| 616 | |
| 617 | return repo.WriteSessionOptions{ |
| 618 | Purpose: ir.GetPurpose(), |
| 619 | }, nil |
| 620 | } |
| 621 | |
| 622 | // RegisterGRPCHandlers registers server gRPC handler. |
| 623 | func (s *Server) RegisterGRPCHandlers(r grpc.ServiceRegistrar) { |
no test coverage detected