tap.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. *
  3. * Copyright 2016 gRPC authors.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. */
  18. // Package tap defines the function handles which are executed on the transport
  19. // layer of gRPC-Go and related information. Everything here is EXPERIMENTAL.
  20. package tap
  21. import (
  22. "golang.org/x/net/context"
  23. )
  24. // Info defines the relevant information needed by the handles.
  25. type Info struct {
  26. // FullMethodName is the string of grpc method (in the format of
  27. // /package.service/method).
  28. FullMethodName string
  29. // TODO: More to be added.
  30. }
  31. // ServerInHandle defines the function which runs when a new stream is created
  32. // on the server side. Note that it is executed in the per-connection I/O goroutine(s) instead
  33. // of per-RPC goroutine. Therefore, users should NOT have any blocking/time-consuming
  34. // work in this handle. Otherwise all the RPCs would slow down.
  35. type ServerInHandle func(ctx context.Context, info *Info) (context.Context, error)