constants.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright 2019 gRPC authors.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17. export enum Status {
  18. OK = 0,
  19. CANCELLED,
  20. UNKNOWN,
  21. INVALID_ARGUMENT,
  22. DEADLINE_EXCEEDED,
  23. NOT_FOUND,
  24. ALREADY_EXISTS,
  25. PERMISSION_DENIED,
  26. RESOURCE_EXHAUSTED,
  27. FAILED_PRECONDITION,
  28. ABORTED,
  29. OUT_OF_RANGE,
  30. UNIMPLEMENTED,
  31. INTERNAL,
  32. UNAVAILABLE,
  33. DATA_LOSS,
  34. UNAUTHENTICATED,
  35. }
  36. export enum LogVerbosity {
  37. DEBUG = 0,
  38. INFO,
  39. ERROR,
  40. NONE,
  41. }
  42. /**
  43. * NOTE: This enum is not currently used in any implemented API in this
  44. * library. It is included only for type parity with the other implementation.
  45. */
  46. export enum Propagate {
  47. DEADLINE = 1,
  48. CENSUS_STATS_CONTEXT = 2,
  49. CENSUS_TRACING_CONTEXT = 4,
  50. CANCELLATION = 8,
  51. // https://github.com/grpc/grpc/blob/master/include/grpc/impl/codegen/propagation_bits.h#L43
  52. DEFAULTS = 0xffff |
  53. Propagate.DEADLINE |
  54. Propagate.CENSUS_STATS_CONTEXT |
  55. Propagate.CENSUS_TRACING_CONTEXT |
  56. Propagate.CANCELLATION,
  57. }
  58. // -1 means unlimited
  59. export const DEFAULT_MAX_SEND_MESSAGE_LENGTH = -1;
  60. // 4 MB default
  61. export const DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH = 4 * 1024 * 1024;