@dxos/protocols 0.1.58-main.fc3ea9b → 0.1.58-main.ffb4cc4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/cjs/src/errors/base-errors.d.ts +27 -0
  2. package/dist/cjs/src/errors/base-errors.d.ts.map +1 -0
  3. package/dist/cjs/src/errors/base-errors.js +43 -0
  4. package/dist/cjs/src/errors/base-errors.js.map +1 -0
  5. package/dist/cjs/src/errors/encoding.d.ts +1 -1
  6. package/dist/cjs/src/errors/encoding.d.ts.map +1 -1
  7. package/dist/cjs/src/errors/errors.d.ts +2 -28
  8. package/dist/cjs/src/errors/errors.d.ts.map +1 -1
  9. package/dist/cjs/src/errors/errors.js +52 -55
  10. package/dist/cjs/src/errors/errors.js.map +1 -1
  11. package/dist/cjs/src/errors/errors.test.js +2 -2
  12. package/dist/cjs/src/errors/errors.test.js.map +1 -1
  13. package/dist/cjs/src/errors/helpers.d.ts +7 -3
  14. package/dist/cjs/src/errors/helpers.d.ts.map +1 -1
  15. package/dist/cjs/src/errors/helpers.js +21 -58
  16. package/dist/cjs/src/errors/helpers.js.map +1 -1
  17. package/dist/cjs/src/errors/index.d.ts +1 -0
  18. package/dist/cjs/src/errors/index.d.ts.map +1 -1
  19. package/dist/cjs/src/errors/index.js +1 -0
  20. package/dist/cjs/src/errors/index.js.map +1 -1
  21. package/dist/cjs/src/proto/gen/dxos/client/services.d.ts +175 -175
  22. package/dist/cjs/src/proto/gen/dxos/client/services.d.ts.map +1 -1
  23. package/dist/cjs/src/proto/gen/dxos/client/services.js +25 -25
  24. package/dist/cjs/src/proto/gen/dxos/client/services.js.map +1 -1
  25. package/dist/cjs/src/proto/gen/dxos/config.d.ts +46 -0
  26. package/dist/cjs/src/proto/gen/dxos/config.d.ts.map +1 -1
  27. package/dist/cjs/src/proto/gen/dxos/config.js.map +1 -1
  28. package/dist/cjs/src/proto/gen/dxos/devtools/host.d.ts +31 -31
  29. package/dist/cjs/src/proto/gen/dxos/devtools/host.d.ts.map +1 -1
  30. package/dist/cjs/src/proto/gen/dxos/error.d.ts +2 -0
  31. package/dist/cjs/src/proto/gen/dxos/error.d.ts.map +1 -1
  32. package/dist/cjs/src/proto/gen/index.d.ts +1 -0
  33. package/dist/cjs/src/proto/gen/index.d.ts.map +1 -1
  34. package/dist/cjs/src/proto/gen/index.js +1 -1
  35. package/dist/cjs/src/proto/gen/index.js.map +1 -1
  36. package/dist/cjs/tsconfig.tsbuildinfo +1 -1
  37. package/dist/esm/src/errors/base-errors.d.ts +27 -0
  38. package/dist/esm/src/errors/base-errors.d.ts.map +1 -0
  39. package/dist/esm/src/errors/base-errors.js +38 -0
  40. package/dist/esm/src/errors/base-errors.js.map +1 -0
  41. package/dist/esm/src/errors/encoding.d.ts +1 -1
  42. package/dist/esm/src/errors/encoding.d.ts.map +1 -1
  43. package/dist/esm/src/errors/errors.d.ts +2 -28
  44. package/dist/esm/src/errors/errors.d.ts.map +1 -1
  45. package/dist/esm/src/errors/errors.js +30 -34
  46. package/dist/esm/src/errors/errors.js.map +1 -1
  47. package/dist/esm/src/errors/errors.test.js +1 -1
  48. package/dist/esm/src/errors/errors.test.js.map +1 -1
  49. package/dist/esm/src/errors/helpers.d.ts +7 -3
  50. package/dist/esm/src/errors/helpers.d.ts.map +1 -1
  51. package/dist/esm/src/errors/helpers.js +17 -57
  52. package/dist/esm/src/errors/helpers.js.map +1 -1
  53. package/dist/esm/src/errors/index.d.ts +1 -0
  54. package/dist/esm/src/errors/index.d.ts.map +1 -1
  55. package/dist/esm/src/errors/index.js +1 -0
  56. package/dist/esm/src/errors/index.js.map +1 -1
  57. package/dist/esm/src/proto/gen/dxos/client/services.d.ts +175 -175
  58. package/dist/esm/src/proto/gen/dxos/client/services.d.ts.map +1 -1
  59. package/dist/esm/src/proto/gen/dxos/client/services.js +24 -24
  60. package/dist/esm/src/proto/gen/dxos/client/services.js.map +1 -1
  61. package/dist/esm/src/proto/gen/dxos/config.d.ts +46 -0
  62. package/dist/esm/src/proto/gen/dxos/config.d.ts.map +1 -1
  63. package/dist/esm/src/proto/gen/dxos/config.js.map +1 -1
  64. package/dist/esm/src/proto/gen/dxos/devtools/host.d.ts +31 -31
  65. package/dist/esm/src/proto/gen/dxos/devtools/host.d.ts.map +1 -1
  66. package/dist/esm/src/proto/gen/dxos/error.d.ts +2 -0
  67. package/dist/esm/src/proto/gen/dxos/error.d.ts.map +1 -1
  68. package/dist/esm/src/proto/gen/index.d.ts +1 -0
  69. package/dist/esm/src/proto/gen/index.d.ts.map +1 -1
  70. package/dist/esm/src/proto/gen/index.js +1 -1
  71. package/dist/esm/src/proto/gen/index.js.map +1 -1
  72. package/package.json +5 -5
  73. package/src/errors/base-errors.ts +34 -0
  74. package/src/errors/errors.test.ts +1 -1
  75. package/src/errors/errors.ts +50 -36
  76. package/src/errors/helpers.ts +20 -94
  77. package/src/errors/index.ts +1 -0
  78. package/src/proto/dxos/config.proto +18 -0
  79. package/src/proto/dxos/error.proto +1 -0
  80. package/src/proto/gen/dxos/client/services.ts +175 -175
  81. package/src/proto/gen/dxos/config.ts +46 -0
  82. package/src/proto/gen/dxos/devtools/host.ts +31 -31
  83. package/src/proto/gen/dxos/error.ts +2 -0
  84. package/src/proto/gen/index.ts +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/proto/gen/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAuDhE,OAAO,aAAa,MAAM,kBAAkB,CAAC;AA+e7C,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,gn0FAAgn0F,CAAC,CAAC,CAAC;AACzq0F,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAkB,UAAU,EAAE,aAAa,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/proto/gen/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAuDhE,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAgf7C,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,uy2FAAuy2F,CAAC,CAAC,CAAC;AACh22F,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAkB,UAAU,EAAE,aAAa,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/protocols",
3
- "version": "0.1.58-main.fc3ea9b",
3
+ "version": "0.1.58-main.ffb4cc4",
4
4
  "description": "Protobuf definitions for DXOS protocols.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -33,10 +33,10 @@
33
33
  "src"
34
34
  ],
35
35
  "dependencies": {
36
- "@dxos/codec-protobuf": "0.1.58-main.fc3ea9b",
37
- "@dxos/invariant": "0.1.58-main.fc3ea9b",
38
- "@dxos/keys": "0.1.58-main.fc3ea9b",
39
- "@dxos/timeframe": "0.1.58-main.fc3ea9b"
36
+ "@dxos/codec-protobuf": "0.1.58-main.ffb4cc4",
37
+ "@dxos/invariant": "0.1.58-main.ffb4cc4",
38
+ "@dxos/keys": "0.1.58-main.ffb4cc4",
39
+ "@dxos/timeframe": "0.1.58-main.ffb4cc4"
40
40
  },
41
41
  "devDependencies": {
42
42
  "glob": "~7.1.6"
@@ -0,0 +1,34 @@
1
+ //
2
+ // Copyright 2021 DXOS.org
3
+ //
4
+
5
+ /**
6
+ * NOTE: Messages should be sentences (Start with a capital letter and end with a period).
7
+ * Errors can optionally include a JSON context object.
8
+ */
9
+ export class BaseError extends Error {
10
+ constructor(readonly code: string, message?: string, readonly context?: Record<string, any>) {
11
+ super(message ?? code);
12
+ this.name = code;
13
+ // NOTE: Restores prototype chain (https://stackoverflow.com/a/48342359).
14
+ Object.setPrototypeOf(this, new.target.prototype);
15
+ }
16
+ }
17
+
18
+ /**
19
+ * User facing API Errors.
20
+ * E.g., something was misconfigured.
21
+ */
22
+ export class ApiError extends BaseError {}
23
+
24
+ /**
25
+ * Internal system errors.
26
+ * E.g., unexpected/unrecoverable runtime error.
27
+ */
28
+ export class SystemError extends BaseError {}
29
+
30
+ /**
31
+ * Database errors.
32
+ */
33
+ // TODO(wittjosiah): Same as ApiError?
34
+ export class DatabaseError extends BaseError {}
@@ -7,7 +7,7 @@ import chaiAsPromised from 'chai-as-promised';
7
7
 
8
8
  import { describe, test } from '@dxos/test';
9
9
 
10
- import { ApiError } from './errors';
10
+ import { ApiError } from './base-errors';
11
11
 
12
12
  chai.use(chaiAsPromised);
13
13
 
@@ -2,45 +2,12 @@
2
2
  // Copyright 2021 DXOS.org
3
3
  //
4
4
 
5
- import type { PublicKey } from '@dxos/keys';
5
+ import { PublicKey } from '@dxos/keys';
6
6
 
7
+ import { ApiError, DatabaseError, SystemError, BaseError } from './base-errors';
8
+ import { registerError, registerErrorMessageContext, registerErrorNoArgs } from './helpers';
7
9
  import type { ItemID } from '../types';
8
10
 
9
- /**
10
- * NOTE: Messages should be sentences (Start with a capital letter and end with a period).
11
- * Errors can optionally include a JSON context object.
12
- */
13
- class BaseError extends Error {
14
- constructor(
15
- readonly code: string,
16
- message?: string,
17
- readonly context?: Record<string, any>,
18
- ) {
19
- super(message ?? code);
20
- this.name = code;
21
- // NOTE: Restores prototype chain (https://stackoverflow.com/a/48342359).
22
- Object.setPrototypeOf(this, new.target.prototype);
23
- }
24
- }
25
-
26
- /**
27
- * User facing API Errors.
28
- * E.g., something was misconfigured.
29
- */
30
- export class ApiError extends BaseError {}
31
-
32
- /**
33
- * Internal system errors.
34
- * E.g., unexpected/unrecoverable runtime error.
35
- */
36
- export class SystemError extends BaseError {}
37
-
38
- /**
39
- * Database errors.
40
- */
41
- // TODO(wittjosiah): Same as ApiError?
42
- export class DatabaseError extends BaseError {}
43
-
44
11
  /**
45
12
  * Thrown when request was terminated because the RPC endpoint has been closed.
46
13
  */
@@ -50,6 +17,8 @@ export class RpcClosedError extends SystemError {
50
17
  }
51
18
  }
52
19
 
20
+ registerErrorNoArgs('RPC_CLOSED', RpcClosedError);
21
+
53
22
  /**
54
23
  * Thrown when `request` is called when RPC has not been opened.
55
24
  */
@@ -59,18 +28,24 @@ export class RpcNotOpenError extends SystemError {
59
28
  }
60
29
  }
61
30
 
31
+ registerErrorNoArgs('RPC_NOT_OPEN', RpcNotOpenError);
32
+
62
33
  export class CancelledError extends SystemError {
63
34
  constructor(message?: string, context?: Record<string, any>) {
64
35
  super('CANCELLED', message, context);
65
36
  }
66
37
  }
67
38
 
39
+ registerErrorMessageContext('CANCELLED', CancelledError);
40
+
68
41
  export class InvalidConfigError extends ApiError {
69
42
  constructor(message?: string, context?: Record<string, any>) {
70
43
  super('INVALID_CONFIG', message, context);
71
44
  }
72
45
  }
73
46
 
47
+ registerErrorMessageContext('INVALID_CONFIG', InvalidConfigError);
48
+
74
49
  /**
75
50
  * Explicit failure to connect with remote client services.
76
51
  */
@@ -80,6 +55,8 @@ export class RemoteServiceConnectionError extends ApiError {
80
55
  }
81
56
  }
82
57
 
58
+ registerErrorMessageContext('REMOTE_SERVICE_CONNECTION_ERROR', RemoteServiceConnectionError);
59
+
83
60
  /**
84
61
  * Failed to open a connection to remote client services.
85
62
  */
@@ -89,42 +66,56 @@ export class RemoteServiceConnectionTimeout extends ApiError {
89
66
  }
90
67
  }
91
68
 
69
+ registerErrorMessageContext('REMOTE_SERVICE_CONNECTION_TIMEOUT', RemoteServiceConnectionTimeout);
70
+
92
71
  export class DataCorruptionError extends SystemError {
93
72
  constructor(message?: string, context?: Record<string, any>) {
94
73
  super('DATA_CORRUPTION', message, context);
95
74
  }
96
75
  }
97
76
 
77
+ registerErrorMessageContext('DATA_CORRUPTION', DataCorruptionError);
78
+
98
79
  export class InvalidInvitationExtensionRoleError extends SystemError {
99
80
  constructor(message?: string, context?: Record<string, any>) {
100
81
  super('INVALID_INVITATION_EXTENSION_ROLE', message, context);
101
82
  }
102
83
  }
103
84
 
85
+ registerErrorMessageContext('INVALID_INVITATION_EXTENSION_ROLE', InvalidInvitationExtensionRoleError);
86
+
104
87
  export class IdentityNotInitializedError extends DatabaseError {
105
88
  constructor(message?: string, context?: Record<string, any>) {
106
89
  super('IDENTITY_NOT_INITIALIZED', message, context);
107
90
  }
108
91
  }
109
92
 
93
+ registerErrorMessageContext('IDENTITY_NOT_INITIALIZED', IdentityNotInitializedError);
94
+
110
95
  export class InvalidInvitationError extends DatabaseError {
111
96
  constructor(message?: string, context?: Record<string, any>) {
112
97
  super('INVALID_INVITATION', message, context);
113
98
  }
114
99
  }
115
100
 
101
+ registerErrorMessageContext('INVALID_INVITATION', InvalidInvitationError);
102
+
116
103
  export class ConnectionResetError extends BaseError {
117
104
  constructor(message?: string, context?: any) {
118
105
  super('CONNECTION_RESET', message, context);
119
106
  }
120
107
  }
121
108
 
109
+ registerErrorMessageContext('CONNECTION_RESET', ConnectionResetError);
110
+
122
111
  export class TimeoutError extends BaseError {
123
112
  constructor(message?: string, context?: any) {
124
113
  super('TIMEOUT', message, context);
125
114
  }
126
115
  }
127
116
 
117
+ registerErrorMessageContext('TIMEOUT', TimeoutError);
118
+
128
119
  // General protocol error.
129
120
  export class ProtocolError extends BaseError {
130
121
  constructor(message?: string, context?: any) {
@@ -132,6 +123,8 @@ export class ProtocolError extends BaseError {
132
123
  }
133
124
  }
134
125
 
126
+ registerErrorMessageContext('PROTOCOL_ERROR', ProtocolError);
127
+
135
128
  // General connectivity errors.
136
129
  export class ConnectivityError extends BaseError {
137
130
  constructor(message?: string, context?: any) {
@@ -139,32 +132,53 @@ export class ConnectivityError extends BaseError {
139
132
  }
140
133
  }
141
134
 
135
+ registerErrorMessageContext('CONNECTIVITY_ERROR', ConnectivityError);
136
+
142
137
  // TODO(nf): Rename? the protocol isn't what's unknown...
143
138
  export class UnknownProtocolError extends BaseError {
144
139
  constructor(message?: string, innerError?: Error) {
145
140
  super('UNKNOWN_PROTOCOL_ERROR', message, innerError);
146
141
  }
147
142
  }
143
+
144
+ registerErrorMessageContext('UNKNOWN_PROTOCOL_ERROR', UnknownProtocolError);
145
+
148
146
  export class InvalidStorageVersionError extends DatabaseError {
149
147
  constructor(expected: number, actual: number) {
150
148
  super('INVALID_STORAGE_VERSION', 'Invalid storage version.', { expected, actual });
151
149
  }
152
150
  }
153
151
 
152
+ registerError('INVALID_STORAGE_VERSION', (_, context) => {
153
+ return new InvalidStorageVersionError(context.expected ?? NaN, context.actual ?? NaN);
154
+ });
155
+
154
156
  export class SpaceNotFoundError extends DatabaseError {
155
157
  constructor(spaceKey: PublicKey) {
156
158
  super('SPACE_NOT_FOUND', 'Space not found.', { spaceKey });
157
159
  }
158
160
  }
159
161
 
162
+ registerError('SPACE_NOT_FOUND', (_, context) => {
163
+ return new SpaceNotFoundError(PublicKey.safeFrom(context.spaceKey) ?? PublicKey.from('00'));
164
+ });
165
+
160
166
  export class EntityNotFoundError extends DatabaseError {
161
167
  constructor(entityId: ItemID) {
162
168
  super('ITEM_NOT_FOUND', 'Item not found.', { entityId });
163
169
  }
164
170
  }
165
171
 
172
+ registerError('ITEM_NOT_FOUND', (_, context) => {
173
+ return new EntityNotFoundError(context.entityId);
174
+ });
175
+
166
176
  export class UnknownModelError extends DatabaseError {
167
177
  constructor(model: string) {
168
178
  super('UNKNOWN_MODEL', 'Unknown model.', { model });
169
179
  }
170
180
  }
181
+
182
+ registerError('UNKNOWN_MODEL', (_, context) => {
183
+ return new UnknownModelError(context.model);
184
+ });
@@ -3,30 +3,8 @@
3
3
  //
4
4
 
5
5
  import { invariant } from '@dxos/invariant';
6
- import { PublicKey } from '@dxos/keys';
7
6
 
8
- import {
9
- CancelledError,
10
- ConnectionResetError,
11
- ConnectivityError,
12
- DataCorruptionError,
13
- EntityNotFoundError,
14
- IdentityNotInitializedError,
15
- InvalidConfigError,
16
- InvalidInvitationError,
17
- InvalidInvitationExtensionRoleError,
18
- InvalidStorageVersionError,
19
- ProtocolError,
20
- RemoteServiceConnectionError,
21
- RemoteServiceConnectionTimeout,
22
- RpcClosedError,
23
- RpcNotOpenError,
24
- SpaceNotFoundError,
25
- SystemError,
26
- TimeoutError,
27
- UnknownModelError,
28
- UnknownProtocolError,
29
- } from './errors';
7
+ import { SystemError } from './base-errors';
30
8
  import { Error as SerializedErrorProto } from '../proto/gen/dxos/error';
31
9
 
32
10
  export const reconstructError = (error: SerializedErrorProto) => {
@@ -34,80 +12,28 @@ export const reconstructError = (error: SerializedErrorProto) => {
34
12
  return errorFromCode(name, message, context);
35
13
  };
36
14
 
37
- export const errorFromCode = (code?: string, message?: string, context?: any) => {
38
- switch (code) {
39
- case 'RPC_CLOSED':
40
- return new RpcClosedError();
41
-
42
- case 'RPC_NOT_OPEN':
43
- return new RpcNotOpenError();
44
-
45
- case 'CANCELLED':
46
- return new CancelledError(message, context);
47
-
48
- case 'INVALID_CONFIG':
49
- return new InvalidConfigError(message, context);
50
-
51
- case 'REMOTE_SERVICE_CONNECTION_ERROR':
52
- return new RemoteServiceConnectionError(message, context);
53
-
54
- case 'REMOTE_SERVICE_CONNECTION_TIMEOUT':
55
- return new RemoteServiceConnectionTimeout(message, context);
56
-
57
- case 'DATA_CORRUPTION':
58
- return new DataCorruptionError(message, context);
59
-
60
- case 'INVALID_INVITATION_EXTENSION_ROLE':
61
- return new InvalidInvitationExtensionRoleError(message, context);
62
-
63
- case 'CONNECTION_RESET':
64
- return new ConnectionResetError(message, context);
65
-
66
- case 'TIMEOUT':
67
- return new TimeoutError(message, context);
15
+ const errorRegistry = new Map<string, (message?: string, context?: any) => Error>();
68
16
 
69
- case 'PROTOCOL_ERROR':
70
- return new ProtocolError(message, context);
71
-
72
- case 'CONNECTIVITY_ERROR':
73
- return new ConnectivityError(message, context);
74
-
75
- case 'UNKNOWN_PROTOCOL_ERROR':
76
- return new UnknownProtocolError(message, context);
77
-
78
- case 'IDENTITY_NOT_INITIALIZED':
79
- return new IdentityNotInitializedError(message, context);
80
-
81
- case 'INVALID_INVITATION':
82
- return new InvalidInvitationError(message, context);
83
-
84
- case 'INVALID_STORAGE_VERSION': {
85
- const { expected, actual } = context;
86
- invariant(expected);
87
- invariant(actual);
88
- return new InvalidStorageVersionError(expected, actual);
89
- }
90
-
91
- case 'SPACE_NOT_FOUND': {
92
- const { spaceKey: key } = context;
93
- const spaceKey = PublicKey.safeFrom(key);
94
- invariant(spaceKey);
95
- return new SpaceNotFoundError(spaceKey);
96
- }
17
+ export const registerError = (code: string, make: (message?: string, context?: any) => Error) => {
18
+ invariant(!errorRegistry.has(code), `Error code already registered: ${code}`);
19
+ errorRegistry.set(code, make);
20
+ };
97
21
 
98
- case 'ITEM_NOT_FOUND': {
99
- const { entityId } = context;
100
- invariant(typeof entityId === 'string');
101
- return new EntityNotFoundError(entityId);
102
- }
22
+ export const registerErrorNoArgs = (code: string, Constructor: { new (): Error }) => {
23
+ registerError(code, () => new Constructor());
24
+ };
103
25
 
104
- case 'UNKNOWN_MODEL': {
105
- const { model } = context;
106
- invariant(typeof model === 'string');
107
- return new UnknownModelError(model);
108
- }
26
+ export const registerErrorMessageContext = (
27
+ code: string,
28
+ Constructor: { new (message?: string, context?: any): Error },
29
+ ) => {
30
+ registerError(code, (message?: string, context?: string) => new Constructor(message, context));
31
+ };
109
32
 
110
- default:
111
- return new SystemError(code ?? 'Error', message, context);
33
+ export const errorFromCode = (code?: string, message?: string, context?: any) => {
34
+ if (code && errorRegistry.has(code)) {
35
+ return errorRegistry.get(code)!(message, context);
36
+ } else {
37
+ return new SystemError(code ?? 'Error', message, context);
112
38
  }
113
39
  };
@@ -5,3 +5,4 @@
5
5
  export * from './encoding';
6
6
  export * from './errors';
7
7
  export * from './helpers';
8
+ export * from './base-errors';
@@ -156,7 +156,25 @@ message Runtime {
156
156
  int32 port = 1;
157
157
  }
158
158
 
159
+ /// Automatic epoch creation.
160
+ message EpochMontior {
161
+ optional bool enabled = 5;
162
+
163
+ /// Number of mutations required since last epoch to trigger a new epoch.
164
+ optional int32 minMessagesBetweenEpochs = 1;
165
+
166
+ /// Amount of time (in milliseconds) required to pass since last epoch to trigger a new epoch.
167
+ optional int32 minTimeBetweenEpochs = 2;
168
+
169
+ /// Amount of time (in milliseconds) required to pass since last mutation to trigger a new epoch.
170
+ optional int32 minInactivityBeforeEpoch = 3;
171
+
172
+ /// Maximum amount of time (in milliseconds) to wait for an inactivity period before triggering a new epoch.
173
+ optional int32 maxInactivityDelay = 4;
174
+ }
175
+
159
176
  optional Functions functions = 1;
177
+ optional EpochMontior epoch_monitor = 2;
160
178
  }
161
179
 
162
180
  optional Plugins plugins = 1;
@@ -10,6 +10,7 @@ option go_package = "github.com/dxos/kube/proto/def/dxos/error";
10
10
 
11
11
  /// Serialized error.
12
12
  message Error {
13
+ /// Also error code. Will be used to reconstruct a known error type.
13
14
  optional string name = 1;
14
15
  optional string message = 2;
15
16
  optional google.protobuf.Struct context = 4;