roo_transport
API Documentation for roo_transport
Loading...
Searching...
No Matches
status.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "roo_logging.h"
4
5
namespace
roo_transport
{
6
7
// Modeled after Google's gRPC status codes.
8
enum
RpcStatus
{
9
// Success (not an error).
10
kOk
= 0,
11
12
// The operation was cancelled, typically by the caller.
13
kCancelled
= 1,
14
15
// Unknown error. For example, this error may be returned when
16
// a `Status` value received from another address space belongs to
17
// an error space that is not known in this address space. Also
18
// errors raised by APIs that do not return enough error information
19
// may be converted to this error.
20
kUnknown
= 2,
21
22
// The client specified an invalid argument. Note that this differs
23
// from `kFailedPrecondition`. `kInvalidArgument` indicates arguments
24
// that are problematic regardless of the state of the system
25
// (e.g., a malformed file name).
26
kInvalidArgument
= 3,
27
28
// The deadline expired before the operation could complete. For operations
29
// that change the state of the system, this error may be returned
30
// even if the operation has completed successfully. For example, a
31
// successful response from a server could have been delayed long
32
// enough for the deadline to expire.
33
kDeadlineExceeded
= 4,
34
35
// Some requested entity (e.g., file or directory) was not found.
36
//
37
// Note to server developers: if a request is denied for an entire class
38
// of users, such as gradual feature rollout or undocumented allowlist,
39
// `kNotFound` may be used. If a request is denied for some users within
40
// a class of users, such as user-based access control, `kPermissionDenied`
41
// must be used.
42
kNotFound
= 5,
43
44
// The entity that a client attempted to create (e.g., file or directory)
45
// already exists.
46
kAlreadyExists
= 6,
47
48
// The caller does not have permission to execute the specified
49
// operation. `kPermissionDenied` must not be used for rejections
50
// caused by exhausting some resource (use `kResourceExhausted`
51
// instead for those errors). `kPermissionDenied` must not be
52
// used if the caller can not be identified (use `kUnauthenticated`
53
// instead for those errors). This error code does not imply the
54
// request is valid or the requested entity exists or satisfies
55
// other pre-conditions.
56
kPermissionDenied
= 7,
57
58
// The request does not have valid authentication credentials for the
59
// operation.
60
kUnauthenticated
= 16,
61
62
// Some resource has been exhausted, perhaps a per-user quota, or
63
// perhaps the entire file system is out of space.
64
kResourceExhausted
= 8,
65
66
// The operation was rejected because the system is not in a state
67
// required for the operation's execution. For example, the directory
68
// to be deleted is non-empty, an rmdir operation is applied to
69
// a non-directory, etc.
70
//
71
// Service implementors can use the following guidelines to decide
72
// between `kFailedPrecondition`, `kAborted`, and `kUnavailable`:
73
// (a) Use `kUnavailable` if the client can retry just the failing call.
74
// (b) Use `kAborted` if the client should retry at a higher level. For
75
// example, when a client-specified test-and-set fails, indicating the
76
// client should restart a read-modify-write sequence.
77
// (c) Use `kFailedPrecondition` if the client should not retry until
78
// the system state has been explicitly fixed. For example, if an "rmdir"
79
// fails because the directory is non-empty, `kFailedPrecondition`
80
// should be returned since the client should not retry unless
81
// the files are deleted from the directory.
82
kFailedPrecondition
= 9,
83
84
// The operation was aborted, typically due to a concurrency issue such as
85
// a sequencer check failure or transaction abort.
86
//
87
// See the guidelines above for deciding between `kFailedPrecondition`,
88
// `kAborted`, and `kUnavailable`.
89
kAborted
= 10,
90
91
// The operation was attempted past the valid range. E.g., seeking or
92
// reading past end-of-file.
93
//
94
// Unlike `kInvalidArgument`, this error indicates a problem that may
95
// be fixed if the system state changes. For example, a 32-bit file
96
// system will generate `kInvalidArgument` if asked to read at an
97
// offset that is not in the range [0,2^32-1], but it will generate
98
// `kOutOfRange` if asked to read from an offset past the current
99
// file size.
100
//
101
// There is a fair bit of overlap between `kFailedPrecondition` and
102
// `kOutOfRange`. We recommend using `kOutOfRange` (the more specific
103
// error) when it applies so that callers who are iterating through
104
// a space can easily look for an `kOutOfRange` error to detect when
105
// they are done.
106
kOutOfRange
= 11,
107
108
// The operation is not implemented or is not supported/enabled in this
109
// service.
110
kUnimplemented
= 12,
111
112
// Internal errors. This means that some invariants expected by the
113
// underlying system have been broken. This error code is reserved
114
// for serious errors.
115
kInternal
= 13,
116
117
// The service is currently unavailable. This is most likely a
118
// transient condition, which can be corrected by retrying with
119
// a backoff. Note that it is not always safe to retry
120
// non-idempotent operations.
121
//
122
// See the guidelines above for deciding between `kFailedPrecondition`,
123
// `kAborted`, and `kUnavailable`.
124
kUnavailable
= 14,
125
126
// Unrecoverable data loss or corruption.
127
kDataLoss
= 15
128
};
129
130
const
char
*
RpcStatusAsString
(
RpcStatus
status);
131
132
inline
roo_logging::Stream&
operator<<
(roo_logging::Stream&
s
,
133
RpcStatus
status) {
134
s
<<
RpcStatusAsString
(status);
135
return
s
;
136
}
137
138
}
// namespace roo_transport
roo_transport
Definition
in_buffer.h:8
roo_transport::RpcStatus
RpcStatus
Definition
status.h:8
roo_transport::kUnimplemented
@ kUnimplemented
Definition
status.h:110
roo_transport::kNotFound
@ kNotFound
Definition
status.h:42
roo_transport::kUnknown
@ kUnknown
Definition
status.h:20
roo_transport::kOutOfRange
@ kOutOfRange
Definition
status.h:106
roo_transport::kPermissionDenied
@ kPermissionDenied
Definition
status.h:56
roo_transport::kInternal
@ kInternal
Definition
status.h:115
roo_transport::kCancelled
@ kCancelled
Definition
status.h:13
roo_transport::kOk
@ kOk
Definition
status.h:10
roo_transport::kAlreadyExists
@ kAlreadyExists
Definition
status.h:46
roo_transport::kUnavailable
@ kUnavailable
Definition
status.h:124
roo_transport::kInvalidArgument
@ kInvalidArgument
Definition
status.h:26
roo_transport::kUnauthenticated
@ kUnauthenticated
Definition
status.h:60
roo_transport::kAborted
@ kAborted
Definition
status.h:89
roo_transport::kFailedPrecondition
@ kFailedPrecondition
Definition
status.h:82
roo_transport::kDeadlineExceeded
@ kDeadlineExceeded
Definition
status.h:33
roo_transport::kDataLoss
@ kDataLoss
Definition
status.h:127
roo_transport::kResourceExhausted
@ kResourceExhausted
Definition
status.h:64
roo_transport::RpcStatusAsString
const char * RpcStatusAsString(RpcStatus status)
Definition
status.cpp:5
roo_transport::operator<<
roo_logging::Stream & operator<<(roo_logging::Stream &s, RpcStatus status)
Definition
status.h:132
roo_transport::Serializer
Definition
serialization.h:20
temp_repos
roo_transport
src
roo_transport
rpc
status.h
Generated by
1.9.8