Class: View

akkaserverless. View

A view.


new View(desc, serviceName [, options])

Create a new view.

Parameters:
Name Type Argument Description
desc string | Array.<string>

A descriptor or list of descriptors to parse, containing the service to serve.

serviceName string

The fully qualified name of the service that provides this interface.

options module:akkaserverless.View~options <optional>

The options for this view

Implements:

Members


options :module:akkaserverless.View~options

Type:

service :protobuf.Service

Type:
  • protobuf.Service

serviceName :string

Type:
  • string

Methods


componentType()

Returns:

view component type.

Type
string

lookupType(messageType)

Lookup a protobuf message type.

This is provided as a convenience to lookup protobuf message types.

Parameters:
Name Type Description
messageType string

The fully qualified name of the type to lookup.

Returns:

The protobuf message type.

Type
protobuf.Type

setUpdateHandlers(handlers)

Set the update handlers of the view. Only used for updates where event transformation is enabled through "transform_updates: true" in the grpc descriptor.

Parameters:
Name Type Description
handlers module:akkaserverless.View~handlers

The handler callbacks.

Returns:

This view.

Type
module:akkaserverless.View

Type Definitions


handler(event, state, context)

A handler for transforming an incoming event and the previous view state into a new state

Parameters:
Name Type Description
event Object

The event, this will be of the type of the gRPC event handler input type.

state undefined | module:akkaserverless.Serializable

The previous view state or 'undefined' if no previous state was stored.

context module:akkaserverless.View.UpdateHandlerContext

The view handler context.

Returns:

The state to store in the view or undefined to not update/store state for the event

Type
undefined | module:akkaserverless.Serializable

handlers

View handlers The names of the properties must match the names of all the view methods specified in the gRPC descriptor.

Type:

options

Options for a view.

Properties:
Name Type Argument Default Description
viewId string <optional>
serviceName

The id for the view, used for persisting the view.

includeDirs array.<string> <optional>
["."]

The directories to include when looking up imported protobuf files.