-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
252 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* | ||
* Copyright 2021 Lightbend Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* Context for a view update event. | ||
* | ||
* @interface module:kalix.View.UpdateHandlerContext | ||
* @property {module:kalix.Metadata} metadata for the event | ||
* @property {string} commandName | ||
*/ | ||
|
||
/** | ||
* Options for a view. | ||
* | ||
* @typedef module:kalix.View~options | ||
* @property {string} [viewId=serviceName] The id for the view, used for persisting the view. | ||
* @property {array<string>} [includeDirs=["."]] The directories to include when looking up imported protobuf files. | ||
*/ | ||
|
||
/** | ||
* View handlers | ||
* The names of the properties must match the names of all the view methods specified in the gRPC | ||
* descriptor. | ||
* | ||
* @typedef module:kalix.View~handlers | ||
* @type {Object<string, module:kalix.View~handler>} | ||
*/ | ||
|
||
/** | ||
* A handler for transforming an incoming event and the previous view state into a new state | ||
* | ||
* @callback module:kalix.View~handler | ||
* @param {Object} event The event, this will be of the type of the gRPC event handler input type. | ||
* @param {undefined|module:kalix.Serializable} state The previous view state or 'undefined' if no previous state was stored. | ||
* @param {module:kalix.View.UpdateHandlerContext} context The view handler context. | ||
* @returns {undefined|module:kalix.Serializable} The state to store in the view or undefined to not update/store state for the event | ||
*/ | ||
|
||
/** | ||
* @classdesc Create a new view. | ||
* | ||
* @class module:kalix.View | ||
* @implements module:kalix.Component | ||
* @param {string|string[]} desc A descriptor or list of descriptors to parse, containing the service to serve. | ||
* @param {string} serviceName The fully qualified name of the service that provides this interface. | ||
* @param {module:kalix.View~options=} options The options for this view | ||
*/ | ||
|
||
/** | ||
* @name module:kalix.View#options | ||
* @type {module:kalix.View~options} | ||
*/ | ||
|
||
|
||
/** | ||
* @name module:kalix.View#serviceName | ||
* @type {string} | ||
*/ | ||
|
||
/** | ||
* @name module:kalix.View#service | ||
* @type {protobuf.Service} | ||
*/ | ||
|
||
/** | ||
* @function module:kalix.View#componentType | ||
* @return {string} view component type. | ||
*/ | ||
|
||
/** | ||
* Lookup a protobuf message type. | ||
* | ||
* This is provided as a convenience to lookup protobuf message types. | ||
* | ||
* @function module:kalix.View#lookupType | ||
* @param {string} messageType The fully qualified name of the type to lookup. | ||
* @return {protobuf.Type} The protobuf message type. | ||
*/ | ||
|
||
/** | ||
* Set the update handlers of the view. Only used for updates where event transformation is enabled through | ||
* "transform_updates: true" in the grpc descriptor. | ||
* | ||
* @function module:kalix.View#setUpdateHandlers | ||
* @param {module:kalix.View~handlers} handlers The handler callbacks. | ||
* @return {module:kalix.View} This view. | ||
*/ |
Oops, something went wrong.